Skip to content

fix: don't log a warning if span is disabled#338

Closed
flokli wants to merge 2 commits into
davidB:mainfrom
flokli:no-warning-on-span-disabled
Closed

fix: don't log a warning if span is disabled#338
flokli wants to merge 2 commits into
davidB:mainfrom
flokli:no-warning-on-span-disabled

Conversation

@flokli

@flokli flokli commented May 11, 2026

Copy link
Copy Markdown

This has been logging lots of unactionable warnings, don't log in that
case.

See #310 (comment)

Also fixes a typo.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request fixes documentation typos and refines error handling when setting parent spans in Axum and Tonic middleware. By matching on SetParentError, the code now avoids logging warnings when a span is disabled. However, a bug was identified in trace_extractor.rs where a redundant warning log was retained outside the new match block, which results in duplicate logs and incorrect behavior for disabled spans.

Comment thread axum-tracing-opentelemetry/src/middleware/trace_extractor.rs Outdated
@flokli flokli force-pushed the no-warning-on-span-disabled branch from ba67354 to 37a9133 Compare May 11, 2026 10:49
flokli added 2 commits May 11, 2026 13:52
This has been logging lots of unactionable warnings, don't log in that
case.

See davidB#310 (comment)
@flokli flokli force-pushed the no-warning-on-span-disabled branch from 37a9133 to 2185c6c Compare May 11, 2026 10:52
@flokli

flokli commented May 11, 2026

Copy link
Copy Markdown
Author

I think this probably works as intended, but could maybe be documented better (or the default features changed). See #310 (comment).

@flokli flokli closed this May 11, 2026
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