Skip to content

chore: stdout for span exporter#1647

Merged
nitisht merged 2 commits into
parseablehq:mainfrom
nikhilsinhaparseable:otelexport-stdout
May 19, 2026
Merged

chore: stdout for span exporter#1647
nitisht merged 2 commits into
parseablehq:mainfrom
nikhilsinhaparseable:otelexport-stdout

Conversation

@nikhilsinhaparseable
Copy link
Copy Markdown
Contributor

@nikhilsinhaparseable nikhilsinhaparseable commented May 18, 2026

if env OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_TRACES_ENDPOINT set to stdout
export the traces to stdout

Summary by CodeRabbit

  • New Features

    • Added support for exporting application traces to stdout in JSON format via the OTEL_EXPORTER_OTLP_ENDPOINT environment variable; environment-variable behavior and header handling for stdout are clarified.
    • Simplified tracing enablement so a single endpoint lookup determines whether tracing is active.
  • Chores

    • Added a dependency to enable stdout-based OpenTelemetry export.

Review Change Stack

if env OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_TRACES_ENDPOINT set to `stdout`
export the traces to stdout
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2089e386-732b-479b-aea7-0042b6121f61

📥 Commits

Reviewing files that changed from the base of the PR and between ce280fd and 6e472d4.

📒 Files selected for processing (1)
  • src/telemetry.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/telemetry.rs

Walkthrough

This PR adds opentelemetry-stdout and updates init_tracing to treat OTEL_EXPORTER_OTLP_ENDPOINT=stdout (case-insensitive) as a sentinel that builds a stdout JSON span exporter wrapped in a BatchSpanProcessor; non-stdout endpoints continue to build protocol-specific OTLP exporters inside the match with warnings/None on errors or unknown protocols.

Changes

OpenTelemetry Stdout Exporter Support

Layer / File(s) Summary
Dependency and documentation
Cargo.toml, src/telemetry.rs (lines 36–37)
Adds opentelemetry-stdout = "0.31.0" dependency and documents that OTEL_EXPORTER_OTLP_ENDPOINT=stdout writes spans as JSON to stdout, clarifying header behavior in that mode.
Stdout exporter routing in init_tracing
src/telemetry.rs (lines 48–135)
Refactors endpoint resolution to check for stdout sentinel first and build a BatchSpanProcessor-wrapped stdout exporter; non-stdout endpoints trigger protocol-specific exporter construction inside the match, with logging on build failure and None return for unknown protocols.

🎯 3 (Moderate) | ⏱️ ~20 minutes

"I hopped into the tracer queue,
and painted spans in JSON blue,
stdout hums a merry tune,
while collectors wait in moonlit June,
a rabbit's trace, light and true." 🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description is minimal but conveys the core intent. However, it lacks the structured format from the template and omits the testing/documentation checklist. Consider using the repository's PR template structure with sections for Description, key changes, and the testing/documentation checklist to improve clarity and consistency.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding stdout as a span exporter option when OTEL environment variables are set to 'stdout'.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

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

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

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

Copy link
Copy Markdown
Contributor

@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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/telemetry.rs`:
- Around line 56-62: The current logic sets use_stdout by comparing only the
resolved endpoint string (variable endpoint) to "stdout", missing cases where
the traces-specific env var is "stdout"; update the logic to independently read
OTEL_EXPORTER_OTLP_ENDPOINT and OTEL_EXPORTER_OTLP_TRACES_ENDPOINT (using the
same env::var calls or constants used now), and set use_stdout = true if either
value exists and equals "stdout" (case-insensitive), while keeping the existing
endpoint resolution behavior for non-"stdout" values; adjust references to the
variables endpoint and use_stdout in telemetry setup accordingly.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 47bbef2e-9ab0-4da2-9ef5-6807bf0e853e

📥 Commits

Reviewing files that changed from the base of the PR and between 64928ab and ce280fd.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • Cargo.toml
  • src/telemetry.rs

Comment thread src/telemetry.rs Outdated
@nitisht nitisht merged commit 1452b4a into parseablehq:main May 19, 2026
12 checks passed
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.

3 participants