What is OpenCode Observability?
OpenCode observability and monitoring gives you real-time visibility into your AI coding sessions by collecting traces, logs, and metrics using OpenTelemetry. This guide shows you how to instrument OpenCode with the OpenTelemetry plugin and send telemetry data to SigNoz, so you can monitor tool calls, track token usage, and debug performance issues directly from your development workflow.
With full OpenCode observability in SigNoz, you can correlate traces, logs, and metrics in a single dashboard, set up alerts for error rates or high latency, and analyze usage patterns over time to continuously improve reliability and efficiency.
Prerequisites
-
SigNoz setup (choose one): SigNoz Cloud accountwith an active ingestion key- Self-hosted SigNoz instance
-
Internet access to send telemetry data to SigNoz Cloud OpenCodeinstalled and running on your system
Monitor OpenCode with OpenTelemetry
The steps below walk you through installing and configuring OpenTelemetry for OpenCode to export traces, logs, and metrics to SigNoz. For full plugin details, see the official plugin documentation
Step 1: Install the OpenTelemetry Plugin
Add the plugin to your OpenCode config at ~/.config/opencode/opencode.json
(create the file if it doesn't already exist):
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@devtheops/opencode-plugin-otel"]
}
Step 2: Configure OpenTelemetry Environment Variables
Set the required environment variables to enable telemetry and configure the OpenTelemetry endpoint:
export OPENCODE_ENABLE_TELEMETRY=1
export OPENCODE_OTLP_ENDPOINT="https://ingest.<region>.signoz.cloud:443"
export OPENCODE_OTLP_HEADERS="signoz-ingestion-key=<your-ingestion-key>"
<region>
: YourSigNoz Cloud region<your-ingestion-key>
: Your SigNozingestion key
Step 3: Run OpenCode with Telemetry Enabled
With the environment variables set, you can now run OpenCode in one of two ways:
Option 1: Via VSCode
Open your project in VSCode with the code
command:
code .
The OpenCode VSCode extension will automatically pick up the environment variables and start with telemetry enabled.
Option 2: Via Terminal
Run OpenCode directly in your terminal using the opencode
command:
opencode
View OpenCode Traces, Logs, and Metrics in SigNoz
Once configured, OpenCode automatically emits traces, logs, and metrics for every AI coding session.
OpenCode traces are available in SigNoz under the Traces tab:
When you click on a trace in SigNoz, you'll see a detailed view of the trace, including all associated spans, along with their events and attributes.
OpenCode logs are available in SigNoz under the Logs tab.
When you click on any of these logs in SigNoz, you'll see a detailed view of the log, including attributes:
OpenCode metrics are available in SigNoz under the Metrics tab:
When you click on any of these metrics in SigNoz, you'll see a detailed view of the metric, including attributes:
Troubleshooting OpenCode Observability
Troubleshooting OpenCode Observability
If you don't see your telemetry data:
Verify network connectivity: Ensure your application can reach SigNoz Cloud endpoints** Check ingestion key**: Verify your SigNoz ingestion key is correct** Wait for data**: OpenTelemetry batches data before sending, so wait 10-30 seconds after making API calls** Try a console exporter**: Enable a console exporter locally to confirm that your application is generating telemetry data before it’s sent to SigNoz
OpenCode Observability Dashboard
The OpenCode observability dashboard gives you pre-built charts tailored for AI coding agents, so you can monitor token usage, tool calls, and session performance out of the box.
Setup OpenTelemetry Collector (Optional)
Setup OpenTelemetry Collector (Optional)
What is the OpenTelemetry Collector?
Think of the OTel Collector as a middleman between your app and SigNoz. Instead of your application sending data directly to SigNoz, it sends everything to the Collector first, which then forwards it along.
Why use it?
Cleaning up data: Filter out noisy traces you don't care about, or remove sensitive info before it leaves your servers.** Keeping your app lightweight**: Let the Collector handle batching, retries, and compression instead of your application code.** Adding context automatically**: The Collector can tag your data with useful info like which Kubernetes pod or cloud region it came from.** Future flexibility**: Want to send data to multiple backends later? The Collector makes that easy without changing your app.
See Switch from direct export to Collector for step-by-step instructions to convert your setup.
For more details, see Why use the OpenTelemetry Collector? and the Collector configuration guide.
Additional resources:
- Set up alertsfor high latency or error rates - Learn more about querying traces - Explore log correlation