Skip to content

Statistics Configuration

System statistics measure operations where they happen (job executions, queue wait, worker capacity, process and activity executions, external service calls), aggregate them in memory and store only aggregated windows. No record is written per operation, and the job tables are not scanned to produce statistics.

Statistics settings are host level: they affect the resource usage of the whole system and cannot be changed by domain administrators.

How Statistics Are Collected

  • Each node aggregates its own measurements in UTC aligned windows (five minutes by default). Window boundaries do not depend on the node start time.
  • A completed window is written to the wStatistics table of the application database in one batch. Writing the same window again replaces it, so retries never count twice. A restarted node writes its windows under a new session and never overwrites the windows of its previous run.
  • Gauge values, such as worker concurrency or open database connections, are sampled every 30 seconds.
  • On graceful shutdown the running window is written and marked as partial. Measurements after the last write of a node that stops abruptly are lost; affected windows are reported as partial where known.
  • A maintenance task rolls five-minute windows up to hourly windows and hourly windows up to daily windows, and a second task removes windows after their retention. Source windows are removed only after their rollup exists.
  • If the database is unavailable, completed windows wait in memory and are retried. When the configured limit is reached, the oldest window is dropped and counted. Statistics failures never stop workflow processing.

Settings

Setting Default Description
Statistics:Enabled true Collects and stores statistics. When false, nothing is collected and queries report collection as disabled.
Statistics:CollectionPeriod 00:05:00 Base window. Must be whole seconds that divide one hour.
Statistics:GaugeSamplingPeriod 00:00:30 Sampling interval of gauge metrics.
Statistics:Retention:Base 14 Days base windows are kept.
Statistics:Retention:Hourly 90 Days hourly windows are kept.
Statistics:Retention:Daily 365 Days daily windows are kept.
Statistics:Limits:MaxActiveSeries 20000 Series aggregated in memory at the same time. New series beyond it are dropped and counted.
Statistics:Limits:MaxPendingBatches 48 Completed windows waiting for persistence before the oldest is dropped.
Statistics:Limits:MaxMemoryUsage 64 Upper bound of the estimated aggregation memory in megabytes.

Invalid values fall back to the defaults.

Configuration Examples

Example appsettings.json configuration:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
{
  "Statistics": {
    "Enabled": true,
    "CollectionPeriod": "00:05:00",
    "GaugeSamplingPeriod": "00:00:30",
    "Retention": {
      "Base": 14,
      "Hourly": 90,
      "Daily": 365
    },
    "Limits": {
      "MaxActiveSeries": 20000,
      "MaxPendingBatches": 48,
      "MaxMemoryUsage": 64
    }
  }
}

Example environment variable overrides:

1
2
AK_Statistics__Enabled=false
AK_Statistics__Retention__Base=7

Data Volume

The table grows with the number of active series (metric, domain, node and dimension combinations), not with the number of operations. One series that is active in every window keeps at most about 4,032 five-minute, 2,160 hourly and 365 daily rows with the default retention. Windows without measurements create no rows.

Monitoring the Collector

The Statistics Collector health check reports degraded when completed windows wait for persistence. The collector also exports its own metrics through the regular metrics pipeline: statistics.active.series, statistics.pending.batches, statistics.memory.usage, statistics.persistence.duration, statistics.persistence.failure, statistics.dropped.measurements, statistics.rollup.duration and statistics.rollup.failure. These metrics are not stored in the statistics table.