Skip to main content

Traffic Accounting and Billing Cycles

Dash builds traffic statistics from network counters reported by nodes. The system stores raw inbound and outbound counters; the accounting view is determined by direction mode.

Modes

ModeValueBehavior
LiteliteStores monthly inbound/outbound totals and estimated peak
BillingbillingMaintains 5-minute facts, daily summaries, P95, coverage, and monthly snapshots

GET /api/statistics/traffic/daily is available only in billing mode. Otherwise it returns 409 traffic_daily_requires_billing.

Global Settings

FieldDescription
guest_access_modeAnonymous access mode
usage_modelite or billing
cycle_modeBilling cycle mode
billing_start_dayDay from 1 to 31
billing_anchor_dateWHMCS anchor date
billing_timezoneIANA timezone
direction_modeAccounting direction mode

Billing Cycle Modes

ModeBehavior
calendar_monthCalendar month, billing_start_day=1
clamp_to_month_endStarts on configured day; short months clamp to month end
whmcs_compatibleWHMCS-compatible cycle; can use billing_anchor_date

billing_anchor_date accepts YYYY-MM-DD or RFC3339 and is stored as YYYY-MM-DD.

billing_timezone must be an IANA timezone loadable by Go.

Node Override

Nodes can override global billing cycle fields:

FieldDescription
traffic_cycle_modedefault inherits global settings; otherwise one of the cycle modes
traffic_billing_start_day1 to 31
traffic_billing_anchor_dateWHMCS anchor date
traffic_billing_timezoneNode billing timezone
traffic_p95_enabledWhether P95 is calculated for the node

Normalization:

  • default clears node billing fields and inherits global settings.
  • calendar_month stores traffic_billing_start_day=1.
  • Non-whmcs_compatible modes store an empty traffic_billing_anchor_date.
  • Empty traffic_billing_timezone in non-default mode uses the app timezone on read.

Direction Mode

ModeAccounting view
outOutbound only
bothInbound + outbound
maxLarger value from inbound and outbound for each metric

Responses keep raw fields and expose selected view fields such as selected_bytes, selected_peak_bytes_per_sec, and selected_p95_bytes_per_sec.

Background Service

The traffic background service:

  • Materializes 5-minute traffic facts every 5 minutes.
  • Refreshes monthly snapshots hourly.
  • Backfills monthly usage in chunks.
  • Fills missing 5-minute buckets in billing mode.

traffic_retention_days controls the 5-minute fact retention window.