Skip to content

docs: fix Datadog example -- correct endpoint, add required header and temporality env var#29

Closed
MichaelRuhwedel wants to merge 1 commit into
DEVtheOPS:mainfrom
MichaelRuhwedel:fix/respect-metrics-temporality-preference
Closed

docs: fix Datadog example -- correct endpoint, add required header and temporality env var#29
MichaelRuhwedel wants to merge 1 commit into
DEVtheOPS:mainfrom
MichaelRuhwedel:fix/respect-metrics-temporality-preference

Conversation

@MichaelRuhwedel
Copy link
Copy Markdown
Contributor

@MichaelRuhwedel MichaelRuhwedel commented Apr 20, 2026

Description

Impact: Anyone following the current Datadog example in the README will get zero metrics -- the endpoint is wrong, the auth header is missing, and the required temporality setting is undocumented.

Three issues fixed:

  1. Wrong endpoint -- api.datadoghq.com is the REST API, not the OTLP intake. The correct endpoint is otlp.datadoghq.com (Datadog OTLP docs).
  2. Missing auth header -- Datadog's OTLP intake requires dd-api-key in the request headers.
  3. Missing temporality env var -- Datadog requires delta aggregation temporality for counters and histograms. Without OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=delta, the OTel SDK defaults to cumulative and Datadog silently drops the data (Datadog delta temporality guide, OTel spec). The JS SDK's OTLP exporter already reads this env var -- no code change needed.

Also adds region guidance (EU, US3, etc.) with a link to the official docs.

Type of change

  • Documentation update

Checklist

  • I have read the CONTRIBUTING.md document
  • My code follows the style guidelines of this project
  • bun run lint passes with no errors
  • bun run check:jsdoc-coverage passes with no errors
  • bun run typecheck passes with no errors
  • bun test passes with no errors
  • I have updated the documentation accordingly
  • My commits follow the Conventional Commits specification

Related issues

Discovered while integrating this plugin with Datadog's direct OTLP intake at otlp.datadoghq.com.

Summary by CodeRabbit

  • Documentation
    • Refreshed Datadog configuration examples with updated OTLP endpoint details and correct hostname information
    • Added environment variable configuration examples for proper API key setup
    • Enhanced documentation with regional endpoint variants to support global deployments across different geographic regions

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 20, 2026

📝 Walkthrough

Walkthrough

The README.md documentation was updated to reflect current Datadog OTLP configuration best practices. The changes include a new endpoint URL, additional environment variable for authentication headers, metric temporality preference setting, and clarification notes regarding regional endpoint variants.

Changes

Cohort / File(s) Summary
Documentation & Configuration
README.md
Updated Datadog OTLP integration configuration with corrected endpoint URL (https://otlp.datadoghq.com), added OPENCODE_OTLP_HEADERS variable for API key authentication, introduced OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=delta setting, and added documentation clarifying endpoint hostname and regional variants (.eu, .us3).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: fixing the Datadog example by correcting the endpoint, adding the required header, and introducing the temporality environment variable.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@MichaelRuhwedel MichaelRuhwedel changed the title LSH-40253 fix(otel): respect OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE for delta temporality fix(otel): respect OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE for delta temporality Apr 20, 2026
@MichaelRuhwedel MichaelRuhwedel force-pushed the fix/respect-metrics-temporality-preference branch from f467f2f to 55e6439 Compare April 20, 2026 16:03
@MichaelRuhwedel MichaelRuhwedel changed the title fix(otel): respect OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE for delta temporality docs: fix Datadog example -- correct endpoint, add required header and temporality env var Apr 20, 2026
@MichaelRuhwedel MichaelRuhwedel marked this pull request as ready for review April 20, 2026 16:04
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@README.md`:
- Around line 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.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a9e188c1-edd0-4047-ad13-855977c260f7

📥 Commits

Reviewing files that changed from the base of the PR and between 92c9583 and 55e6439.

📒 Files selected for processing (1)
  • README.md

Comment thread README.md
Comment on lines +157 to +158
# Required — Datadog's OTLP intake only accepts delta temporality
export OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=delta
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.

@MichaelRuhwedel MichaelRuhwedel deleted the fix/respect-metrics-temporality-preference branch April 20, 2026 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant