# Class ServerStatsReportService | EchoHub Documentation
Background job that periodically snapshots server activity over a window, logs it as pretty-printed JSON (which also surfaces in the live server-logs room), and persists it to the database for historical trends. Interval and retention are configurable via the &quot;Stats&quot; section; the default cadence is every 6 hours.

# Class ServerStatsReportService

Namespace
  EchoHub.Server.Services.Stats

Assembly
  EchoHub.Server.dll

Background job that periodically snapshots server activity over a window, logs it as pretty-printed JSON (which also surfaces in the live server-logs room), and persists it to the database for historical trends. Interval and retention are configurable via the "Stats" section; the default cadence is every 6 hours.

    public sealed class ServerStatsReportService : BackgroundService, IDisposable

Inheritance
  object
  BackgroundService
  ServerStatsReportService

Implements
  IDisposable

Inherited Members
  object.GetType()
  object.ToString()
  object.Equals(object)
  object.Equals(object, object)
  object.ReferenceEquals(object, object)
  object.GetHashCode()

## Constructors

### ServerStatsReportService(IServiceScopeFactory, PresenceTracker, ServerStatsCollector, StatsOptions, ILogger<ServerStatsReportService>)

    public ServerStatsReportService(IServiceScopeFactory scopeFactory, PresenceTracker presence, ServerStatsCollector collector, StatsOptions options, ILogger<ServerStatsReportService> logger)

#### Parameters

`scopeFactory` IServiceScopeFactory
`presence` PresenceTracker
`collector` ServerStatsCollector
`options` StatsOptions
`logger` ILogger<ServerStatsReportService>

## Methods

### ExecuteAsync(CancellationToken)

    protected override Task ExecuteAsync(CancellationToken stoppingToken)

#### Parameters

`stoppingToken` CancellationToken

#### Returns

Task