fix: disable nonproduction RUM collection

Merged
TG
7d ago
+109-3

Summary

  • Restrict dashboard Datadog RUM initialization to production hosts.
  • Apply the same host restriction to Elements, preventing preview builds with RUM credentials from starting collection. The configured telemetry environment remains a label, not a second collection gate.
  • Cover development, staging, preview, localhost, and production initialization paths with regression tests.

Motivation

Development and staging sessions were being collected at full sampling rates. Gate collection before SDK initialization to prevent unnecessary RUM and session replay usage.

No visible UI changes; Gutternote review steps are not applicable.


Summary by cubic

Stops Datadog RUM and session replay collection on non-production hosts, preventing dev, staging, and preview sessions from consuming full sampling rates. The production host is now the single gate for collection in both dashboard and Elements; the configured telemetry environment is only a label.

  • Dashboard telemetry initializes only on production hosts and always uses the prod environment.
  • Elements error tracking collects only on production hosts, regardless of the configured telemetry label.
  • Adds regression tests covering dev, staging, preview, localhost, and production hosts for both dashboard and Elements.