Overview
This guide walks you through enabling observability and monitoring in OpenCode using OpenTelemetry and exporting traces, logs, and metrics to SigNoz using OpenTelemetry. Once set up, you’ll be able to track coding session activity, log outputs, and system-level metrics in SigNoz, giving you visibility into performance trends, error rates, and usage patterns directly from your development workflow.
Instrumenting OpenCode with telemetry provides full observability into how coding assistance is used in practice. With SigNoz, you can correlate traces, logs, and metrics in a single dashboard, set up alerts, and analyze historical data to continuously improve reliability, efficiency, and user experience.
Prerequisites
- SigNoz setup (choose one):
- SigNoz Cloud account with an active ingestion key
- Self-hosted SigNoz instance
- Internet access to send telemetry data to SigNoz Cloud
- OpenCode installed and running on your system
Monitoring OpenCode
For detailed instructions on setting up OpenTelemetry instrumentation for OpenCode, check out 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>: Your SigNoz Cloud region<your-ingestion-key>: Your SigNoz ingestion 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 Traces, Logs, and Metrics in SigNoz
Your OpenCode usage should now automatically emit traces, logs, and metrics.
You should be able to view traces in SigNoz Cloud 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.

You should be able to view logs in SigNoz Cloud 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:

You should be able to see OpenCode related metrics in SigNoz Cloud 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
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
Next Steps
You can also check out our custom OpenCode dashboard here which provides specialized visualizations for monitoring your OpenCode usage. The dashboard includes pre-built charts specifically tailored for AI coding agents, along with import instructions to get started quickly.

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 alerts for high latency or error rates
- Learn more about querying traces
- Explore log correlation