Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skip warning if propagator is baggage #4866

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ class TextMapPropagator {
spanContext = this._extractB3MultiContext(carrier)
break
default:
Copy link
Member

Choose a reason for hiding this comment

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

Since you're already in a switch statement based on the extractor value you could make this a lot cleaner by doing this:

        case 'baggage':
          break
        default:
          log.warn(`Unknown propagation style: ${extractor}`)

Copy link
Collaborator Author

@ida613 ida613 Nov 8, 2024

Choose a reason for hiding this comment

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

It's kind of awkward having baggage as a propagator, if we go with this cleaner solution (which also makes more sense to me), in the case we have this._config.tracePropagationStyle.extract = ['baggage', 'datadog'], we would end up with spanContext without traceId or parentId which the datadog propagation style clearly requires. Having baggage as a propagator simply means we are propagating baggage, but it should not override other propagation styles.

log.warn(`Unknown propagation style: ${extractor}`)
if (extractor !== 'baggage') log.warn(`Unknown propagation style: ${extractor}`)
}

if (this._config.tracePropagationStyle.extract.includes('baggage') && carrier.baggage) {
Expand Down
Loading