What is Grok Build Observability? #
Grok Build is xAI's terminal coding agent. It ships its own OpenTelemetry exporter, so instrumenting it is a matter of configuration: there is no library to install and no collector to run. Once enabled, it emits metrics covering token usage, turns, tool calls, errors, and startup timings, plus a stream of structured events for each session.
With full Grok Build observability in SigNoz, you can see how much your team is spending in tokens and on which models, which tools the agent actually reaches for, how often turns fail and why, and where startup time is going.
Prerequisites #
-
SigNoz setup (choose one): SigNoz Cloud accountwith an active ingestion key- Self-hosted SigNoz instance
-
Grok Build installed. See the xAI installation guide - A SuperGrok subscription or an
XAI_API_KEY
Monitor Grok Build with OpenTelemetry #
Grok Build's telemetry is a double opt-in. The GROK_EXTERNAL_OTEL
master switch and at least one exporter must both be set, since either alone emits nothing.
Step 1: Launch Grok Build with telemetry enabled
export GROK_EXTERNAL_OTEL=1
export OTEL_METRICS_EXPORTER=otlp
export OTEL_LOGS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.<region>.signoz.cloud:443"
export OTEL_EXPORTER_OTLP_HEADERS="signoz-ingestion-key=<your-ingestion-key>"
export OTEL_METRIC_EXPORT_INTERVAL=10000
grok
Verify these values:
<region>
: YourSigNoz Cloud region.<your-ingestion-key>
: Your SigNozingestion key.
Step 2: Generate some telemetry
Run a few prompts that make the agent read files or run commands, so tool and token metrics have something to report.
grok -p "List the files in this directory and summarise what this project does."
The default metric export interval is 60 seconds, which is why the snippet above lowers it to 10 seconds while you verify the pipeline. Events are exported every 5 seconds by default.
View Grok Build Metrics in SigNoz #
Metrics are Grok Build's primary signal. Open the Metrics Explorer, search for grok_code.token.usage
, and run the query to confirm data is arriving.
Every metric lives under the ai.xai.grok_code
meter scope. All the counters are monotonic delta sums, so aggregate them with increase
to get totals rather than rate
.
| Metric | Unit | Key attributes |
|---|---|---|
grok_code.session.count |
{session} |
base attributes only |
grok_code.turn.count |
{turn} |
outcome (completed , cancelled , error ), model |
grok_code.token.usage |
{token} |
type (input , output , reasoning , cache_read ), model |
grok_code.tool.usage |
{call} |
tool_name , outcome |
grok_code.tool.decision |
{decision} |
tool_name , decision , access_kind , permission_mode |
grok_code.error.count |
{error} |
error_category , model |
grok_code.startup.total |
ms |
outcome , auth_mode |
grok_code.startup.phase_duration |
ms |
phase , outcome , auth_mode |
View Grok Build Logs in SigNoz #
Open the Logs Explorer and filter with service.name = 'grok-cli'
to see the event stream. Each event carries its detail in attributes rather than in the log body, so open a record to inspect it.
Useful attributes include model
, input_tokens
, output_tokens
, cache_read_tokens
, reasoning_tokens
, tool_name
, outcome
, and duration_ms
. Every event also carries session.id
and prompt.id
, so you can group everything produced while handling a single prompt.
Grok Build Observability Dashboard #
The Grok Build dashboard gives you token usage by type and model, tool activity, error categories, and startup latency out of the box.
Troubleshooting Grok Build Observability #
No data in SigNoz
Check that both GROK_EXTERNAL_OTEL=1
and at least one exporter are set. Either on its own emits nothing. Then run grok --debug
and search the log under ~/.grok/debug/
for external otel:
lines, which report whether the stream resolved its configuration and whether exports are succeeding.
Metrics are missing but events arrive
The two signals have different export intervals. Metrics default to 60 seconds while events default to 5, so metrics can look absent for a full minute after startup. Set OTEL_METRIC_EXPORT_INTERVAL=10000
while you verify.
Nothing arrives for the first few seconds
Grok Build holds telemetry closed at startup until it has fetched fleet policy from xAI, since that policy can disable the stream. The wait is bounded and emission begins within 30 seconds regardless.
Export errors mentioning gRPC
Set OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
. gRPC is documented as supported but does not work in version 1.0.3.
Related integrations #
Instrument the other AI coding agents you run, using the same OpenTelemetry pipeline:
Monitor OpenAI Codex with OpenTelemetry- track Codex CLI sessions, token spend, and command-level tracesClaude Code monitoring with OpenTelemetry- track token usage, costs, and tool decisionsOpenCode observability with OpenTelemetry- trace OpenCode sessions, tool calls, and per-message cost
Browse all LLM observability integrations to instrument the rest of your stack.
Additional resources: