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:
- Stream events for live governed traffic.
- Optionally review token usage and cost.
- 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 withaudit.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.- CLI
- MCP
- API
- Agent
dome audit stream. Find valid event types in the Events catalog reference.Reference:
dome audit streamAuditEventV1 envelope.
Filter the stream
Narrow the stream further by combining multiple type filters.Requires
audit.view.- CLI
- MCP
- API
- Agent
Reference:
dome audit streamToken usage and cost
Query LLM consumption across every agent, API key, identity, and served model in the workspace. The dashboard token panel, thedome usage CLI, and the dome_usage MCP tool share one summary endpoint, so numbers line up everywhere.
Requires
audit.view.- CLI
- MCP
- API
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 usageConfigure OpenTelemetry
Every Dome service exports OpenTelemetry traces, metrics, and logs over OTLP/HTTP. Point the standardOTEL_* 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
SetOTEL_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 samedome.* 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 omittenant_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 fromotelpgx (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”. Telemetry is opt-in and off by default. SetUSAGE_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 withUSAGE_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):
Event coverage
Telemetry covers two surfaces: lifecycle events when resources are created, changed, or removed, and runtime events on every request the gateway evaluates.Lifecycle events
Lifecycle events
Runtime events
Runtime events
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: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 matchingemail, 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,
droppedcounter increments. - Sink error → batch retries once, then drops, error log,
droppedincrements by batch size. - Shutdown → queue drains, final batch flushes, sink shuts down.
Next steps
- Audit events for historical queries, exports, and the full event envelope
- Subscribe to Events to push signed events to external systems
- Set Usage Limits when quota exhaustion shows up in the stream