Skip to main content
Refer to Audit events concept for how the one trail works. Contracts are on the Events reference.

Overview

Streaming correlates several signals on the same governed traffic. Each signal answers a different operational question. Streaming reads the same Audit v1 trail as Audit events. Stream for live operations. Query and export for history and compliance. The typical workflow is:
  1. Stream events for live governed traffic.
  2. Optionally review token usage and cost.
  3. Optionally configure OpenTelemetry or product usage telemetry for your own stack.

Token classes

Every LLM call resolves to a disjoint partition across five token classes. The window total is their sum. Adapters normalize provider-specific usage records into this partition. Per-class pricing is applied at read time and surfaced as estimated_cost_usd.

Usage cubes

Token usage and call counts fan out across the workspace aggregate and four read-time cubes so you can attribute consumption by the dimension you care about.

Requirements

Before you begin:
  • Authenticate to Dome and select a workspace
  • Have traffic in the workspace when you want live events to appear

Permissions

Live event streams and token-usage reads require platform permissions. People and scoped API keys call these surfaces. Agent credentials are not the usual path. All workspace roles can stream events and read token usage with audit.view. OpenTelemetry and product usage telemetry are configured on the api-server and gateway processes with environment variables. They do not use workspace permissions.

Stream events

Stream audit events in real time with server-sent events (SSE). The stream delivers events as they occur, without polling.
Requires audit.view.
Filter by class, type, agent, or trace:
For the complete stream flag reference, refer to dome audit stream. Find valid event types in the Events catalog reference.
Each streamed event is a full AuditEventV1 envelope.

Filter the stream

Narrow the stream further by combining multiple type filters.
Requires audit.view.
The stream remains open until you terminate it. It fits live monitoring during deployments, incident investigation, or development testing.

Token usage and cost

Query LLM consumption across every agent, API key, identity, and served model in the workspace. The dashboard token panel, the dome usage CLI, and the dome_usage MCP tool share one summary endpoint, so numbers line up everywhere.
Requires audit.view.
The estimated cost is a blended cross-model rate intended for trend-watching and demos, not a bill. Each token class is priced at its own per-million rate and re-priced at read time, so a price change re-prices history without a migration. Pricing is never persisted.
Print the workspace token total and estimated cost for the last 24 hours.
The output mirrors the dashboard token panel. Add --json for machine-readable output and pipe into jq for scripted budgets.
Reference: dome usage

Configure OpenTelemetry

Every Dome service exports OpenTelemetry traces, metrics, and logs over OTLP/HTTP. Point the standard OTEL_* env vars at your collector (Jaeger, Tempo, Datadog Agent, OTel Collector, Axiom, or anything that speaks OTLP) to wire Dome into your existing observability stack.
Dome is vendor-neutral: it emits standard OTLP and reads standard OTEL_* variables. The collector decides where data lands. Swap backends without redeploying Dome.

Enable

Set OTEL_EXPORTER_OTLP_ENDPOINT on the api-server and gateway processes. When the variable is unset, the SDK runs in silent no-op mode. That is useful for local development without a collector.
Health probes (/healthz, /readyz, /health, /ready) are filtered out of traces and HTTP metrics automatically.

Identity attributes

Every span and log record carries the same dome.* vocabulary so you can pivot from a trace to its logs with a single tag filter: Logs also carry the OTel trace_id, so a single query (dome.tenant_id="...") returns the full request story across spans and logs for that tenant.

Product metrics

Eight product-level instruments emit on the global OTel meter. Counters omit tenant_id to keep cardinality bounded. Pivot per-tenant via the span attributes above.

Sampling and cost

Trace volume is head-sampled at 1% by default. Boilerplate database spans from otelpgx (transaction state, pool acquire, prepare statements) are dropped at the source. They accounted for ~99% of trace volume in early staging. Tail-sampling decisions belong at your collector.

Configure product usage telemetry

Stream product-usage events to your own analytics backend to see which features each tenant exercises. Telemetry is separate from audit. It answers “which orgs are active, which features get used, where do users get stuck”, not “what did this agent do”.
Use audit for compliance evidence. Use telemetry for product analytics. Telemetry is best-effort: events drop on queue overflow, sink errors, or shutdown, and the request path is never blocked or failed because of telemetry.
Telemetry is opt-in and off by default. Set USAGE_TELEMETRY_ENABLED=true on the api-server and gateway processes to turn it on. Any other value, including unset, installs a no-op client and emits nothing.

Sinks

Select a sink with USAGE_TELEMETRY_SINK. Leave it unset to use the env-driven default. A misconfigured sink (missing token, unreachable endpoint at startup, malformed headers) falls back to noop and logs the error. Startup never fails because of telemetry.

Configure

Set the telemetry envvars in the api-server and gateway environments. One client per process. The same configuration applies to both. Local development (logger sink, visible at DEBUG):
Self-hosted OTLP collector:

Event coverage

Telemetry covers two surfaces: lifecycle events when resources are created, changed, or removed, and runtime events on every request the gateway evaluates.
Each runtime event carries trace_id so you can join a usage event to the matching audit event for the same call.

Event envelope

Every event, regardless of sink, has the same normalized shape:
Add a new field to an existing event freely. Additive changes do not bump version. Renaming or repurposing a field requires a new event name or a version bump.

PII handling

Telemetry drops sensitive properties before any sink sees them. Property keys matching email, username, password, secret, token, prompt, response, arguments, or args, and keys containing oauth_code, tool_result, user_name, raw_*, or act_as_subject, are stripped at the client. Runtime constructors never accept raw tool args, prompts, or model responses in the first place. Putting PII under a non-matching key name does not bypass this. The package is the second line of defense.

Tuning behavior

V1 ships with fixed batching parameters: 100 events per batch, 10 s flush interval, 10,000-event in-memory queue, 5 s send timeout, 2 retries with 250 ms backoff. These are not configurable via env in V1.
  • Queue full → event drops, warn log, dropped counter increments.
  • Sink error → batch retries once, then drops, error log, dropped increments by batch size.
  • Shutdown → queue drains, final batch flushes, sink shuts down.

Next steps