Skip to main content
StatsD is the metrics provider: it emits counters, gauges, timings, and histograms to any StatsD-compatible backend (Datadog, Telegraf, Graphite) and ships a mock: true flag that silently no-ops all calls in dev and test.

The MetricsType interface

Every metrics provider satisfies the same contract:
Keep tag values bounded and low-cardinality — never use user IDs, emails, or timestamps as tag values:

Why

StatsD is a widely supported, UDP-based metrics protocol with near-zero overhead. The hot-shots client supports Datadog DogStatsD extensions (tags, histograms) and runs equally well against a local Telegraf agent or a cloud service like Datadog. The mock: true option means you don’t need a StatsD server running in dev at all.

Setup

  1. In apps/backend/package.json, ensure "tooling-metrics-statsd": "workspace:*" is listed under dependencies.
  2. Run make deps-install.
  3. In development.ts and test.ts, use mock mode:
  4. In production.ts, point at your StatsD agent:
  5. In your production environment, set:
  6. Run make test module=tooling-metrics-statsd and make test module=backend.

Emitting metrics

Gotchas

  • StatsD uses UDP — metric sends are fire-and-forget and will not throw on failure. Errors are routed to tools.logger.error via the errorHandler in buildStatsdClient.
  • globalTags are merged into every metric. Keep them low-cardinality (env, service) — never put per-request data in global tags.
  • mock: true must be removed in production. If you accidentally leave it on, all metrics are silently swallowed — your dashboards will appear empty.
  • Never omit host and port in production. hot-shots defaults to localhost:8125, which silently drops metrics if no agent is listening there.

What’s next?