Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,18 @@ export OPENCODE_DISABLE_METRICS="cache.count,session.duration,session.token.tota

```bash
export OPENCODE_ENABLE_TELEMETRY=1
export OPENCODE_OTLP_ENDPOINT=https://api.datadoghq.com
export OPENCODE_OTLP_ENDPOINT=https://otlp.datadoghq.com
export OPENCODE_OTLP_PROTOCOL=http/protobuf
export OPENCODE_OTLP_HEADERS="dd-api-key=YOUR_DATADOG_API_KEY"

# Required — Datadog's OTLP intake only accepts delta temporality
export OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=delta
Comment on lines +157 to +158
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check if config.ts handles OPENCODE_OTLP_METRICS_TEMPORALITY_PREFERENCE

# Search for temporality preference handling in config.ts
rg -n -A5 -B5 'TEMPORALITY|temporality' --glob 'src/config.ts'

# Also check if the variable is used directly in other files
rg -n 'OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE' --glob 'src/**/*.ts'

Repository: DEVtheOPS/opencode-plugin-otel

Length of output: 56


🏁 Script executed:

# Check what config.ts actually looks like
fd 'config.ts' -t f && wc -l src/config.ts

Repository: DEVtheOPS/opencode-plugin-otel

Length of output: 104


🏁 Script executed:

# Look for how OPENCODE_ variables are handled in config.ts
rg -n 'OPENCODE_' src/config.ts

Repository: DEVtheOPS/opencode-plugin-otel

Length of output: 1072


🏁 Script executed:

# Check how OTEL_ variables are set/copied
rg -n 'OTEL_EXPORTER_OTLP' src/config.ts

Repository: DEVtheOPS/opencode-plugin-otel

Length of output: 223


🏁 Script executed:

# Look at the full context of config.ts to understand the pattern
cat -n src/config.ts

Repository: DEVtheOPS/opencode-plugin-otel

Length of output: 3264


Use OPENCODE_ prefix for plugin configuration variables.

The documentation instructs users to set OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE directly, but this violates the plugin's established design pattern. All plugin configuration must use the OPENCODE_ prefix (e.g., OPENCODE_OTLP_HEADERS, OPENCODE_RESOURCE_ATTRIBUTES, OPENCODE_OTLP_ENDPOINT), which are then copied to their OTEL_* equivalents before SDK initialization.

The temporality preference should follow this same pattern:

# User-facing configuration variable (OPENCODE_ prefix)
export OPENCODE_OTLP_METRICS_TEMPORALITY_PREFERENCE=delta

Then in src/config.ts, add handling to copy this to OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE before the SDK initializes (similar to the existing OPENCODE_OTLP_HEADERS and OPENCODE_RESOURCE_ATTRIBUTES handling).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 157 - 158, Update the README recommendation to use
OPENCODE_ prefix for the temporality setting (replace
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE with
OPENCODE_OTLP_METRICS_TEMPORALITY_PREFERENCE in the example) and add handling in
src/config.ts to copy process.env.OPENCODE_OTLP_METRICS_TEMPORALITY_PREFERENCE
into process.env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE before SDK
initialization (follow the same pattern used for OPENCODE_OTLP_HEADERS and
OPENCODE_RESOURCE_ATTRIBUTES), ensuring the SDK sees the OTEL_* variable while
users configure the OPENCODE_* variable.

```

> **Note:** The endpoint is `otlp.datadoghq.com` (not `api.datadoghq.com`).
> Use `otlp.datadoghq.eu` for EU, `otlp.us3.datadoghq.com` for US3, etc.
> See [Datadog OTLP docs](https://docs.datadoghq.com/opentelemetry/interoperability/otlp_ingest_in_the_agent/) for all regions.

### Honeycomb example

```bash
Expand Down
Loading