Skip to content

[WIP] feat(otel): add otel logs support#5446

Draft
mabdinur wants to merge 3 commits intomasterfrom
munir/implement-otel-logs
Draft

[WIP] feat(otel): add otel logs support#5446
mabdinur wants to merge 3 commits intomasterfrom
munir/implement-otel-logs

Conversation

@mabdinur
Copy link
Copy Markdown
Contributor

What does this PR do?

Adds OpenTelemetry logs support to the Datadog Ruby tracer. When DD_LOGS_OTEL_ENABLED is true, the tracer configures the OpenTelemetry logs SDK with a BatchLogRecordProcessor and OTLP exporter (with Datadog telemetry), wired through the existing SDK configurator. Adds configuration (endpoint, protocol, headers, timeouts, BLRP options), app-started telemetry for logs settings, supported-configurations entries, RBS types, and specs (one pending for trace-context bridging).

Motivation:

Enable users to send OpenTelemetry logs via the tracer using standard OTEL env vars and DD_LOGS_OTEL_ENABLED, aligned with the existing OTel metrics integration.

Change log entry

  • [OpenTelemetry] Add OpenTelemetry logs support. Set DD_LOGS_OTEL_ENABLED=true and use standard OTEL logs env vars (e.g. OTEL_EXPORTER_OTLP_LOGS_ENDPOINT) to export logs via OTLP.

Additional Notes:

N/A

How to test the change?

  • Integration test: spec/datadog/opentelemetry/logs_spec.rb.
  • Manual test: Enable logs in a test app with DD_LOGS_OTEL_ENABLED=true and confirm logs are exported to the configured OTLP endpoint.

@github-actions github-actions Bot added core Involves Datadog core libraries otel OpenTelemetry-related changes labels Mar 12, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 12, 2026

👋 Hey @DataDog/ruby-guild, please fill "Change log entry" section in the pull request description.

If changes need to be present in CHANGELOG.md you can state it this way

**Change log entry**

Yes. A brief summary to be placed into the CHANGELOG.md

(possible answers Yes/Yep/Yeah)

Or you can opt out like that

**Change log entry**

None.

(possible answers No/Nope/None)

Visited at: 2026-03-12 20:34:24 UTC

@mabdinur mabdinur changed the title feat(otel): add otel logs support [WIP] feat(otel): add otel logs support Mar 12, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 12, 2026

Typing analysis

Ignored files

This PR introduces 2 ignored files. It decreases the percentage of typed files from 45.64% to 45.53% (-0.11%).

Ignored files (+2-0)Introduced:
lib/datadog/opentelemetry/logs.rb
lib/datadog/opentelemetry/sdk/logs_exporter.rb

Note: Ignored files are excluded from the next sections.

Untyped methods

This PR introduces 7 partially typed methods, and clears 5 partially typed methods. It increases the percentage of typed methods from 61.14% to 61.31% (+0.17%).

Partially typed methods (+7-5)Introduced:
sig/datadog/opentelemetry/configuration/settings.rbs:13
└── def self.normalize_logs_protocol: (::String env_var_name) -> untyped
sig/datadog/opentelemetry/configuration/settings.rbs:15
└── def self.headers_parser: (::String env_var_name) -> untyped
sig/datadog/opentelemetry/configuration/settings.rbs:18
└── def self.settings: (untyped name) ?{ (untyped) -> void } -> untyped
sig/datadog/opentelemetry/configuration/settings.rbs:20
└── def self.option: (untyped name) ?{ (untyped) -> void } -> untyped
sig/datadog/opentelemetry/configuration/settings.rbs:35
└── def headers: () -> ::Hash[untyped, untyped]
sig/datadog/opentelemetry/configuration/settings.rbs:55
└── def headers: () -> ::Hash[untyped, untyped]?
sig/datadog/opentelemetry/configuration/settings.rbs:73
└── def headers: () -> ::Hash[untyped, untyped]?
Cleared:
sig/datadog/opentelemetry/configuration/settings.rbs:13
└── def self.headers_parser: (::String env_var_name) -> untyped
sig/datadog/opentelemetry/configuration/settings.rbs:16
└── def self.settings: (untyped name) ?{ (untyped) -> void } -> untyped
sig/datadog/opentelemetry/configuration/settings.rbs:18
└── def self.option: (untyped name) ?{ (untyped) -> void } -> untyped
sig/datadog/opentelemetry/configuration/settings.rbs:31
└── def headers: () -> ::Hash[untyped, untyped]
sig/datadog/opentelemetry/configuration/settings.rbs:51
└── def headers: () -> ::Hash[untyped, untyped]?

If you believe a method or an attribute is rightfully untyped or partially typed, you can add # untyped:accept on the line before the definition to remove it from the stats.

@mabdinur mabdinur force-pushed the munir/implement-otel-logs branch from 163ee55 to ab5c738 Compare March 12, 2026 20:38
@datadog-datadog-prod-us1
Copy link
Copy Markdown
Contributor

datadog-datadog-prod-us1 Bot commented Mar 12, 2026

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 94.66%
Overall Coverage: 95.15% (-0.01%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 808da4f | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback!

@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented Mar 12, 2026

Benchmarks

Benchmark execution time: 2026-03-12 21:21:29

Comparing candidate commit 808da4f in PR branch munir/implement-otel-logs with baseline commit 273706c in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 46 metrics, 0 unstable metrics.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

@mabdinur mabdinur added the AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos label Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos core Involves Datadog core libraries otel OpenTelemetry-related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant