Telemetry Ingest
Summary
Zeeq ingests and processes OpenTelemetry (OTEL) data from agent harnesses which carry information about:
- Token usage
- Tool usage
- Prompts
- Pricing (Claude)
Flow
Telemetry volume can easily overwhelm the system, so Zeeq uses a multi-stage ingest pipeline to process telemetry data.
While Zeeq can directly ingest OTEL logs and spans (used for harnesses like Pi), it is recommended to use the open source OTEL collector to pre-process and filter high volume telemetry data streams to retain only the relevant logs and spans for Zeeq. Additionally, the OTEL collector is configured to filter requests based on incoming authentication headers as well.
Antigravity
The Antigravity CLI plugin sends session telemetry to the import API with harness_name: "antigravity". IDE launches are not supported or tested. At the Stop hook, it reads new rows from the session transcript and maps prompts, tool calls and results, and model completions to Zeeq events. A per-conversation cursor prevents sending the cumulative transcript again on each turn. The hook sends in the background and fails open so ingest failures do not block the agent.
A SessionStart recovery flush can send pending rows after an interrupted run. A final turn may remain unsent if the process is killed and Antigravity does not start again.
OTEL Collector configuration
Production collector
Production agent telemetry should be sent to the standalone collector at:
https://otel.zeeq.ai
The collector runs on a Compute Engine VM behind Caddy. Caddy terminates TLS on public 443, keeps 80 open for automatic HTTPS challenge/redirect traffic, and forwards OTLP/HTTP to the collector's private Docker-network listener:
zeeq-otel-collector:4318
Do not expose collector port 4318 publicly. The public endpoint uses normal HTTPS because OTLP/HTTP is the protocol, not a requirement to publish the default collector port on the internet.
Production deployment artifacts live in the Zeeq app repository:
build/otel-collector-config.gcp.yamlbuild/otel-collector/Dockerfilebuild/pack-otel-collector.shbuild/init/gcp-otel-collector-vm.shbuild/ship-otel-collector.sh
The production config keeps the same core behavior as the local filtered collector used for testing:
- OIDC validation at the collector edge;
- original
Authorizationheader forwarding throughheaders_setter; - per-token batching with
metadata_keys: [authorization]; - Claude Code and Codex log filtering;
- Copilot Chat trace filtering.
It removes local-only Aspire fan-out, omits OTLP/gRPC, binds the collector HTTP receiver to 0.0.0.0:4318 inside the private zeeq-otel Docker network, runs Caddy with explicit published 80/443 ports on that network, and adds a memory limiter.
The production OpenIddict issuer is:
https://app.zeeq.ai/
Keep the trailing slash. Zeeq's discovery document reports that exact issuer, and OIDC issuer comparison is exact.
Production harness endpoints
Claude Code and Copilot Chat can use the base endpoint:
https://otel.zeeq.ai
Codex must include the logs signal path explicitly:
https://otel.zeeq.ai/v1/logs
Every harness request must carry:
Authorization=Bearer <zeeq-user-token>
The collector validates the token at the edge and forwards the same header to Zeeq.
Zeeq then derives user and organization scope from the authenticated principal, not from telemetry payload attributes.
Local development
For local development, the OTEL collector should be configured to send telemetry data to both Zeeq and Aspire as this will allow troubleshooting of the telemetry flow with better visibility since agents can directly dump the telemetry from Aspire.
Aspire only (for full telemetry flow)
# Configuration to use for an OTEL collector forwarding to Aspire
# This is a basic setup that allows sending traces and logs to Aspire which makes
# it easier to understand the real shape of the telemetry flow.
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
exporters:
otlp/aspire:
endpoint: "${env:OTEL_EXPORTER_OTLP_ENDPOINT}"
headers:
x-otlp-api-key: "${env:ASPIRE_DASHBOARD_OTLP_API_KEY}"
tls:
insecure: true
processors:
batch:
send_batch_max_size: 100
send_batch_size: 10
timeout: 10s
service:
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [otlp/aspire]
logs:
receivers: [otlp]
processors: [batch]
exporters: [otlp/aspire]
Aspire and Zeeq (for simulation of upstream filtering)
The collector can be configured to forward to multiple endpoints simultaneously which allows sending to Aspire as well as Zeeq. This is useful for simulating the upstream filtering that would occur in production.
This is the actual config used locally (host/otel-collector-config.filtered.yaml), bind-mounted into the otel-collector Aspire resource:
# Configured to forward to multiple targets with JWT auth and header forwarding
extensions:
# Validates the caller's Bearer JWT against Zeeq's OpenIddict issuer via
# standard OIDC discovery (/.well-known/openid-configuration + JWKS).
# This is a cheap outer gate that keeps unauthenticated noise off Zeeq.
oidc:
issuer_url: "${env:ZEEQ_ISSUER_URL}" # e.g. https://app.zeeq.ai/auth
# No dedicated telemetry OpenIddict resource/scope exists yet, so this
# points at the same resource already registered for MCP user tokens
# (AppSettings:Auth:Resource) - an existing Zeeq user token satisfies
# this check without new server-side provisioning.
audience: "${env:ZEEQ_TELEMETRY_AUDIENCE}"
username_claim: sub
# Forwards the original caller's Authorization header from the inbound request
# onto the exporter request, so Zeeq sees the end user's token, not a
# collector service identity. Requires include_metadata: true on the receiver
# and metadata_keys on the batch processor (see below).
headers_setter:
headers:
- action: upsert
key: authorization
from_context: authorization
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
auth:
authenticator: oidc
include_metadata: true # required for from_context in headers_setter
http:
endpoint: 0.0.0.0:4318
auth:
authenticator: oidc
include_metadata: true
exporters:
# Forward to Zeeq with per-user JWT pass-through via headers_setter.
# The Authorization header from the inbound request is forwarded; if no
# user token is present, the collector can fall back to a service-level
# client_credentials identity via additional_auth on headers_setter.
# otlphttp (not gRPC): Zeeq's Kestrel endpoint accepts both HTTP/1.1 and
# HTTP/2 locally, so a plain HTTP exporter/receiver pair is simplest.
# otlphttp auto-appends /v1/logs and /v1/traces to this base endpoint.
otlphttp/zeeq:
endpoint: "${env:ZEEQ_OTLP_HTTP_ENDPOINT}"
auth:
authenticator: headers_setter
sending_queue:
enabled: true
tls:
insecure: true # Local
# Fan-out to Aspire dashboard for full-telemetry visibility.
otlp/aspire:
endpoint: "${env:OTEL_EXPORTER_OTLP_ENDPOINT}"
headers:
x-otlp-api-key: "${env:ASPIRE_DASHBOARD_OTLP_API_KEY}"
tls:
insecure: true
processors:
# ---- LOGS: keep only Claude Code + Codex session events (drop-if-true) ----
filter/agent_session_logs:
error_mode: ignore
logs:
log_record:
- |
not (
resource.attributes["service.name"] == "claude-code" and
(log.body == "claude_code.user_prompt" or
log.body == "claude_code.tool_result" or
log.body == "claude_code.api_request" or
log.body == "claude_code.tool_decision")
) and not (
IsMatch(resource.attributes["service.name"], ".*codex.*") and
(log.attributes["prompt_length"] != nil or
(log.attributes["tool_name"] != nil and log.attributes["call_id"] != nil) or
log.attributes["event.kind"] == "response.completed" or
(log.attributes["mcp_servers"] != nil and log.attributes["approval_policy"] != nil))
)
# ---- TRACES: keep only Copilot Chat business spans (drop-if-true) ----
filter/agent_session_traces:
error_mode: ignore
traces:
span:
- |
not (
resource.attributes["service.name"] == "copilot-chat" and
span.attributes["copilot_chat.chat_session_id"] != nil and
(span.attributes["gen_ai.operation.name"] == "invoke_agent" or
span.attributes["gen_ai.operation.name"] == "chat" or
span.attributes["gen_ai.operation.name"] == "execute_tool")
)
batch:
send_batch_size: 128
send_batch_max_size: 512
timeout: 5s
# One batcher per distinct caller token: preserves per-user Authorization
# forwarding correctness. Without this, records from two users could land
# in one exported batch carrying a single Authorization header.
metadata_keys: [authorization]
metadata_cardinality_limit: 1000
service:
extensions: [oidc, headers_setter]
pipelines:
traces:
receivers: [otlp]
processors: [filter/agent_session_traces, batch]
exporters: [otlp/aspire, otlphttp/zeeq]
logs:
receivers: [otlp]
processors: [filter/agent_session_logs, batch]
exporters: [otlp/aspire, otlphttp/zeeq]
Authentication
The OTLP receivers validate incoming JWTs using the OIDC extension (configured with Zeeq's OpenIddict issuer). Only authenticated requests are accepted; invalid or missing bearer tokens are rejected at the collector edge.
Note: Aspire health checks (172.18.0.1) will log "Authentication failed: missing or empty header" warnings in the collector logs. These are expected and benign—health checks intentionally have no bearer token. Use the separate otlp/health receivers (ports 4319/4320) if cleaner logs are preferred, though they add complexity for what is fundamentally a deployment detail.
Local networking notes
The oidc extension fetches discovery/JWKS once at collector startup and fails the whole container (no retry) if that fetch errors, so a few local-dev-only details matter:
- Issuer trailing slash. OpenIddict's
SetIssuercanonicalizes to a root-path URI (http://zeeq-web.localhost:8095/), and theoidcextension does an exact string match betweenissuer_urland the discovery document's self-reportedissuerfield. Omitting the trailing slash fails collector startup with adid not match the issuer URL returned by providererror. - DNS resolution inside the container.
zeeq-web.localhostis a browser/OS-resolved loopback hostname, not a Docker network name, and does not resolve inside the collector container by default. The AppHost maps it via--add-host zeeq-web.localhost:host-gateway(Docker 20.10+), which routes back through the host machine to YARP's published port, preserving the hostname theoidcextension needs verbatim. - Startup ordering. Discovery routes through
zeeq-web.localhost -> yarp-reverse-proxy -> Vite dev server -> zeeq-server, not directly to the backend, so the collector resource waits on the full chain (WaitFor(backend/frontend/proxy)), and the frontend resource has an explicitWithHttpHealthCheck("/")so that wait blocks on Vite actually serving, not just the process having started.
Agent harness configuration
Verified live against Claude Code 2.1.308, Codex CLI 0.144.3, and VS Code Copilot Chat. Each harness needs its OTLP exporter pointed at the collector's HTTP endpoint (http://localhost:44318 locally), with the caller's Zeeq user token attached, matching what the oidc/filter blocks above expect. Claude Code and Copilot Chat use a base URL that gets /v1/logs//v1/traces auto-appended; Codex does not auto-append and needs the full path (see its section below).
Claude Code
Claude Code 2.1.308 is configured through launch environment variables for telemetry enablement and OTLP destination. Claude Code ignores repository .claude/settings.json and .claude/settings.local.json values for those exporter variables. Repository settings can still configure otelHeadersHelper, which supplies request headers dynamically. Anthropic documents these rules under administrator configuration and dynamic headers.
Trusted central configuration is also valid: administrators can set telemetry variables in the env block of managed settings, and developers can use user ~/.claude/settings.json. Use an absolute otelHeadersHelper path for configuration shared across repositories. Keep the bearer token private. Central settings apply across projects; project launch configuration scopes telemetry to selected repositories where managed policy permits it. Managed settings can lock the collector destination.
The Zeeq API token must already be present in the environment that starts Claude Code. MCP OAuth login does not populate ZEEQ_OTEL_ACCESS_TOKEN; a valid Zeeq API token may be shared by MCP and telemetry, but OAuth login alone does not authenticate telemetry.
No version manager or environment loader is required. For a local session, prepare an ordinary shell with the local collector address and a token issued by the local Zeeq issuer. The Claude telemetry setup guide compares plain shell, an asdf-compatible wrapper, direnv, and mise:
export ZEEQ_OTEL_ACCESS_TOKEN="<local-zeeq-token>"
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:44318
export OTEL_LOGS_EXPORTER=otlp
export OTEL_METRICS_EXPORTER=none
export OTEL_LOG_USER_PROMPTS=0
export OTEL_LOG_TOOL_DETAILS=0
Production uses https://otel.zeeq.ai instead of http://localhost:44318. Keep the token out of shared repository files. A production token fails against the local issuer; local development requires a local-issued token and does not bypass authentication.
Add the dynamic header helper entry to the project .claude/settings.json alongside any existing project settings:
{
"otelHeadersHelper": ".claude/zeeq-otel-headers.sh"
}
The helper fails when the token is missing and returns the JSON header format expected by Claude Code:
#!/usr/bin/env bash
set -euo pipefail
: "${ZEEQ_OTEL_ACCESS_TOKEN:?Set ZEEQ_OTEL_ACCESS_TOKEN before launching Claude Code}"
printf '{"Authorization":"Bearer %s"}\n' "$ZEEQ_OTEL_ACCESS_TOKEN"
After configuring the helper and exporting the telemetry variables, start Claude Code with either a plain shell or optional mise:
chmod +x .claude/zeeq-otel-headers.sh
claude
chmod +x .claude/zeeq-otel-headers.sh
mise exec -- claude
Enable prompt and tool detail capture only when the user or organization explicitly accepts that content collection. Set OTEL_LOG_USER_PROMPTS=1 and OTEL_LOG_TOOL_DETAILS=1 in the launch environment to opt in. Zeeq derives session metrics from log events, so OTEL_METRICS_EXPORTER=none avoids a redundant separate metrics stream.
The optional trusted project mise.toml can hold non-secret settings when you use mise. The Tera expression enables telemetry only if the token was inherited when mise started; keep the token itself in a shell secret store or ignored local file:
[env]
CLAUDE_CODE_ENABLE_TELEMETRY = "{% if env.ZEEQ_OTEL_ACCESS_TOKEN is defined and env.ZEEQ_OTEL_ACCESS_TOKEN != '' %}1{% else %}0{% endif %}"
OTEL_EXPORTER_OTLP_PROTOCOL = "http/protobuf"
OTEL_EXPORTER_OTLP_ENDPOINT = "http://localhost:44318"
OTEL_LOGS_EXPORTER = "otlp"
OTEL_METRICS_EXPORTER = "none"
OTEL_LOG_USER_PROMPTS = "0"
OTEL_LOG_TOOL_DETAILS = "0"
mise applies project [env] values to commands run with mise exec. See the mise environment documentation. After configuring the helper and mise settings, launch with mise exec -- claude. Restart an existing Claude Code process after changing these variables.
The collector filter keeps Claude Code user_prompt, tool_result, api_request, and tool_decision log events, identified by log.body.
Raw SDK query_source activity counts as real work. The verified generate_session_title source is classified as housekeeping. Zeeq counts reported completion usage and cost once, including auxiliary events; housekeeping events are excluded from prompt and tool activity counts. The Sessions inbox hides a Claude conversation until persisted history contains at least one non-housekeeping prompt, tool result, or completion. It checks the full history, so later real work makes an earlier auxiliary-only session visible. The existing minimum-cost filter still applies.
For zeeq_agent_token_usage, input includes cached input and output includes reasoning/tool output. Metric aggregation sums the input and output dimensions; cached, reasoning, and tool subset samples remain stored but are not added again. Legacy samples without token_kind remain included.
Codex
Configured via [otel] in ~/.codex/config.toml:
[otel]
exporter = "otlp-http"
log_user_prompt = true
[otel.exporter."otlp-http"]
endpoint = "http://localhost:44318/v1/logs"
headers = { authorization = "Bearer <zeeq-user-token>" }
OTEL_EXPORTER_OTLP_ENDPOINT convention and auto-append /v1/logs//v1/traces to a base URL), Codex's endpoint is used verbatim with no path appended - confirmed directly from Codex's Rust source (codex-rs/otel/tests/suite/otlp_http_loopback.rs), where every OtlpHttp test endpoint is constructed with an explicit /v1/logs or /v1/traces suffix. Omitting it here means every export 404s silently at the collector.The filter above keeps Codex session events by attribute shape, not by an event.name attribute (also absent on Codex's wire despite docs claiming otherwise): a prompt_length attribute identifies a prompt, tool_name+call_id identifies a tool result, and event.kind == "response.completed" identifies a completion.
Copilot Chat
Use application-scoped User Settings, not repository settings. See the Copilot setup guide for production setup, private authentication headers, restart behavior, and central configuration. The local VS Code configuration uses the Aspire collector's gRPC port; HTTP is also available:
{
"github.copilot.chat.otel.enabled": true,
"github.copilot.chat.otel.exporterType": "otlp-http",
"github.copilot.chat.otel.protocol": "http/protobuf",
"github.copilot.chat.otel.otlpEndpoint": "http://localhost:44318",
"github.copilot.chat.otel.captureContent": false
}
{
"github.copilot.chat.otel.enabled": true,
"github.copilot.chat.otel.exporterType": "otlp-grpc",
"github.copilot.chat.otel.protocol": "grpc",
"github.copilot.chat.otel.otlpEndpoint": "http://localhost:44317",
"github.copilot.chat.otel.captureContent": false
}
Attach a local Zeeq token through OTEL_EXPORTER_OTLP_HEADERS in the environment that starts VS Code. Current Copilot versions also support github.copilot.chat.otel.headers; do not store credentials in shared settings. MCP OAuth sign-in is separate from OTLP authentication.
captureContent is optional and off in these examples. Enable it deliberately for prompt, response, and tool content. The running extension must reload after settings changes. A changed shell environment requires a fresh VS Code process.
Zeeq's Copilot adapter uses trace spans rather than log records. The collector keeps invoke_agent, chat, and execute_tool spans under service.name=copilot-chat with copilot_chat.chat_session_id. The adapter takes completion usage from each chat span instead of the parent agent's aggregate totals. It records supported MCP tool results and filters built-in tools. Available nano-AIU billing units can enrich cost; other cost estimates depend on the available model and token data.
These instructions cover the extension-host Copilot Chat pipeline. Agent Host telemetry uses different settings and services; enabling that pipeline alone does not establish compatibility with Zeeq's current collector filter.