-
Notifications
You must be signed in to change notification settings - Fork 40.8k
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
Tracing only supports a single context propagation type #35611
Tracing only supports a single context propagation type #35611
Conversation
...main/java/org/springframework/boot/actuate/autoconfigure/tracing/BraveAutoConfiguration.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/TracingProperties.java
Outdated
Show resolved
Hide resolved
...main/java/org/springframework/boot/actuate/autoconfigure/tracing/BraveAutoConfiguration.java
Outdated
Show resolved
Hide resolved
...main/java/org/springframework/boot/actuate/autoconfigure/tracing/BraveAutoConfiguration.java
Outdated
Show resolved
Hide resolved
...main/java/org/springframework/boot/actuate/autoconfigure/tracing/BraveAutoConfiguration.java
Outdated
Show resolved
Hide resolved
c5ef27d
to
7070de0
Compare
da15179
to
4dd3d42
Compare
It works for both Brave and Otel now, build is green too. |
.../src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/TracingProperties.java
Outdated
Show resolved
Hide resolved
a3da5b1
to
532227d
Compare
When merging into 3.1.x, the test Stream.concat(injectorFactories.stream(), extractorFactories.stream()).allMatch(Factory::supportsJoin); Is that just an unfortunate consequence because we now apply all extractors, or is the span joining feature just for injecting and the @jonatan-ivanov As you implemented the test / feature, maybe you have an idea? If that's an unfortunate consequence and can't be changed, do we need a way to opt out of extracting all known formats? With that, users could configure B3 only for injecting and extracting, and span joining works again. Maybe by adding a property |
Yeah, if we consume all formats by default |
a0e5e2a
to
a2796f1
Compare
No worries Jonatan. I've now added properties to control which formats we produce, which we accept and the
With that in place, we should have enough flexibility in our tracing setup. And users still have one property |
Alternative names for these properties to consider:
|
I've settled on |
And it's a merge! Thank you all for providing input! |
This change adds support for multiple context propagation types (e.g. B3 and W3C). It also adds support for a new propagation type,
B3_MULTI
(which is B3 with multiple headers instead of the singleb3
header).There are now two new properties:
management.tracing.propagation.consume
which controls which trace formats the application will understand on incoming requests. It defaults to all known trace formats (W3C, B3 single, B3 multi).management.tracing.propagation.produce
which controls which trace formats the application will add to outgoing requests. It defaults to W3C.The
management.tracing.propagation.type
has been changed fromPropagationType
toList<PropagationType>
and the default has been removed. If set, this will override bothmanagement.tracing.propagation.consume
andmanagement.tracing.propagation.produce
.The formats have an ordering, meaning that if one of the extractors matches, the one after it are no longer considered. The default ordering is:
The
CompositePropagationFactory
is the main piece of code for Brave which knows how to extract and inject multiple formats. It's a copy from Sleuth, somewhat refactored.The
CompositeTextMapPropagator
is the main piece of code for OTel. It's somewhat more complicated than the Brave pendant as we need to support theBaggageTextMapPropagator
which must run always even if one of the extractors before it has already extracted the context.I also removed a
@ConditionalOnMissingBean
for typeB3Propagator
andW3CTraceContextPropagator
. This should be fine as it's not consistent anyway. In thebagagge = true
case those@ConditionalOnMissingBean
are not effective but the extractors are added unconditionally inw3cTextMapPropagatorWithBaggage
andb3BaggageTextMapPropagator
.Property examples
To only use B3 single, set
management.tracing.propagation.type
toB3
To only use B3 multi, set
management.tracing.propagation.type
toB3_MULTI
To only use W3C multi, set
management.tracing.propagation.type
toW3C
To produce B3 single and W3C and accept W3C, B3 single and multi, set
management.tracing.propagation.produce
toB3,W3C
andmanagement.tracing.propagation.consume
toB3,B3_MULTI,W3C
See gh-35096