Skip to content

feat(logging): decouple OTLP export from console log format - #12424

Merged
jh-nv merged 4 commits into
ai-dynamo:mainfrom
jellysnack:decouple-otel-export-console-format
Aug 7, 2026
Merged

jh-nv merged 4 commits into
ai-dynamo:mainfrom
jellysnack:decouple-otel-export-console-format

Conversation

@jellysnack

@jellysnack jellysnack commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Overview:

Decouple the stderr console log format from OpenTelemetry export configuration.

This allows Dynamo to export traces and structured log records through OTLP while keeping human-readable console output. Existing deployments using DYN_LOGGING_JSONL remain backward compatible.

Details:

  • Add DYN_LOGGING_CONSOLE_FORMAT with readable and jsonl values.
  • Make DYN_LOGGING_CONSOLE_FORMAT take precedence over the legacy DYN_LOGGING_JSONL setting.
  • Keep DYN_LOGGING_JSONL as a backward-compatible fallback when the new setting is not provided.
  • Select the stderr formatter independently from OTLP exporter initialization.
  • Consolidate readable and JSONL console setup in a shared console_layer.
  • Include the selected console format in the OpenTelemetry initialization log.
  • Add tests covering:
    • the default readable format;
    • the legacy JSONL setting;
    • precedence of the new setting;
    • readable console output while OTLP export is enabled.

Where should the reviewer start?

Start with lib/runtime/src/logging.rs, particularly:

  • setup_logging, where console formatting and telemetry initialization are separated;
  • console_layer and ConsoleEventFormatter, which select the stderr format without duplicating subscriber setup;
  • test_readable_console_with_otel_export, which covers the primary use case.

Then review lib/runtime/src/config.rs for environment-variable parsing, precedence, and legacy compatibility.

Related Issues

🚫 This PR is NOT linked to an issue:

  • Confirmed — no related issue

Open in Devin Review

Summary by CodeRabbit

  • New Features

    • Added configurable console logging formats: readable text or JSON Lines.
    • Added support for selecting the format through DYN_LOGGING_CONSOLE_FORMAT.
    • Preserved compatibility with the legacy DYN_LOGGING_JSONL setting.
    • Console format can now be selected independently of OpenTelemetry export settings.
  • Bug Fixes

    • Invalid format values now produce a warning and safely fall back to readable output.
    • Readable console logs remain readable when OpenTelemetry exporting is enabled.

@jellysnack
jellysnack requested review from a team as code owners July 30, 2026 14:12
@copy-pr-bot

copy-pr-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@jellysnack
jellysnack temporarily deployed to external_collaborator July 30, 2026 14:12 — with GitHub Actions Inactive
@jellysnack
jellysnack temporarily deployed to external_collaborator July 30, 2026 14:12 — with GitHub Actions Inactive
@github-actions github-actions Bot added the feat label Jul 30, 2026
@github-actions

github-actions Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot added the external-contribution Pull request is from an external contributor label Jul 30, 2026

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 3 potential issues.

Open in Devin Review

Comment thread lib/runtime/src/config.rs Resolved
Comment thread lib/runtime/src/logging.rs Resolved
Comment thread lib/runtime/src/logging.rs Resolved
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Changes

Console logging format

Layer / File(s) Summary
Console format configuration contract
lib/runtime/src/config.rs, lib/runtime/src/config/environment_names.rs
Adds the public console format enum and environment variable, with primary-variable precedence, legacy JSONL fallback, invalid-value handling, and unit coverage.
Console formatter and subscriber wiring
lib/runtime/src/logging.rs
Separates console formatting from OTLP export, selects trace-context behavior from OTLP or JSONL settings, and includes the selected format in OTLP initialization status logs.
OTLP and readable console validation
lib/runtime/src/logging.rs
Adds subprocess tests confirming readable console output remains non-JSON while OTLP exporting is enabled.

Estimated code review effort: 4 (Complex) | ~45 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: decoupling OTLP export from console log formatting.
Description check ✅ Passed The description follows the template with Overview, Details, reviewer start, and the required no-issue path filled in.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
lib/runtime/src/config.rs (1)

436-479: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Undocumented format aliases.

from_env_value also accepts "text" and "json" as aliases, but the doc comments (here and in environment_names.rs) only mention "readable"/"jsonl". Consider documenting the aliases so users aren't surprised either way.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/runtime/src/config.rs` around lines 436 - 479, Document the accepted
“text” and “json” aliases alongside “readable” and “jsonl” in the console log
format documentation, updating both the comments near
ConsoleLogFormat/console_log_format and the corresponding documentation in
environment_names.rs. Keep the existing parsing behavior in
ConsoleLogFormat::from_env_value unchanged.
lib/runtime/src/logging.rs (1)

2910-2919: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider adding --exact for consistency with sibling subprocess tests.

Other subprocess-dispatching tests in this file (test_otlp_export_works_without_json_logging, test_span_events) pass --exact after the test name; this new test omits it. Low risk here since the name is unlikely to collide, but adding it keeps the pattern consistent.

♻️ Proposed fix
             .args([
                 "test",
                 "-p",
                 "dynamo-runtime",
                 "test_readable_console_with_otel_export_subprocess",
                 "--",
+                "--exact",
                 "--nocapture",
             ])
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/runtime/src/logging.rs` around lines 2910 - 2919, Add the `--exact`
argument to the Cargo test command in the subprocess invocation for
`test_readable_console_with_otel_export_subprocess`, matching the argument
pattern used by the sibling subprocess tests while preserving the existing test
selection and output options.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@lib/runtime/src/config.rs`:
- Around line 436-479: Document the accepted “text” and “json” aliases alongside
“readable” and “jsonl” in the console log format documentation, updating both
the comments near ConsoleLogFormat/console_log_format and the corresponding
documentation in environment_names.rs. Keep the existing parsing behavior in
ConsoleLogFormat::from_env_value unchanged.

In `@lib/runtime/src/logging.rs`:
- Around line 2910-2919: Add the `--exact` argument to the Cargo test command in
the subprocess invocation for
`test_readable_console_with_otel_export_subprocess`, matching the argument
pattern used by the sibling subprocess tests while preserving the existing test
selection and output options.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: bb416ab6-1670-46e4-84f0-b3604d040385

📥 Commits

Reviewing files that changed from the base of the PR and between 4bf6e43 and be68a4e.

📒 Files selected for processing (3)
  • lib/runtime/src/config.rs
  • lib/runtime/src/config/environment_names.rs
  • lib/runtime/src/logging.rs

@jellysnack
jellysnack requested a review from a team as a code owner July 30, 2026 20:24
@jellysnack
jellysnack temporarily deployed to external_collaborator July 30, 2026 20:24 — with GitHub Actions Inactive
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Jul 30, 2026
@jellysnack

Copy link
Copy Markdown
Contributor Author

@rmccorm4 Could you take a look when you get a chance? Thanks!

@rmccorm4

rmccorm4 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

/ok to test af813f2

@datadog-official

datadog-official Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 46.43% (-4.75%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 05ad4da | Docs | Datadog PR Page | Give us feedback!

Comment thread lib/runtime/src/logging.rs Resolved
Signed-off-by: jellysnack <oleg.jellysnack@gmail.com>
Signed-off-by: jellysnack <oleg.jellysnack@gmail.com>
Signed-off-by: jellysnack <oleg.jellysnack@gmail.com>
@rmccorm4

rmccorm4 commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Thanks @jellysnack ! Tagged @jh-nv to help review, and @jellysnack please help fix the merge conflicts on the branch

@rmccorm4 Could you take a look when you get a chance? Thanks!

Please feel free to join the dynamo community slack to post your PRs for review and discussion with the team as well: https://ai-dynamo.org/slack

@jellysnack
jellysnack force-pushed the decouple-otel-export-console-format branch from af813f2 to 961a39e Compare August 5, 2026 19:00
@pull-request-size pull-request-size Bot added size/XL and removed size/L labels Aug 5, 2026
@jellysnack
jellysnack temporarily deployed to external_collaborator August 5, 2026 19:00 — with GitHub Actions Inactive
Signed-off-by: jellysnack <oleg.jellysnack@gmail.com>
@jellysnack
jellysnack temporarily deployed to external_collaborator August 5, 2026 19:36 — with GitHub Actions Inactive

@jh-nv jh-nv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the contribution.

@jh-nv

jh-nv commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

/ok to test 05ad4da

@jh-nv
jh-nv merged commit 027e7ad into ai-dynamo:main Aug 7, 2026
110 checks passed

This branch was previously deployed

1 inactive deployment
external_collaborator — 05ad4dab Deployed Aug 5, 2026 by jellysnack via ok-to-test #7173
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation external-contribution Pull request is from an external contributor feat size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants