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

Spring Boot 3.2.1 misbehave with micrometer-tracing-bridge-brave:1.2.1 #504

Closed
surmabck opened this issue Dec 29, 2023 · 5 comments
Closed
Labels
Milestone

Comments

@surmabck
Copy link

surmabck commented Dec 29, 2023

The issue

Some MDC data are missing after upgrading Spring Boot to 3.2.1

Context

After bumping my project to Spring Boot 3.2.1 which introduces the newest micrometer-tracing deps, my tests started to fail because of the lack of some attributes in the MDC. I was able to track the issue down to micrometer-tracing-bridge-brave:1.2.1. Downgrading this particular dependency to 1.2.0 solves the problem. (Uncomment build.gradle.kts:47 in the reproducer to downgrade micrometer-tracing-bridge-brave to 1.2.0)

Reproducer

I've created minimal reproducer in here: https://github.com/surmabck/spring-boot-3xx-micrometer-issues/tree/micrometer-1.2.1-springboottests-misbehave

Worth to notice

  • Reproducer contains 2 tests.
    • If you run them separately, they work:

image
image

  • if you run them together, they fail:
    image
  • Reproducer contains ContextEnhancingWebFilter filter, which does two things:
    • add given string as a baggage via Tracer -> ContextEnhancingWebFilter:40
    • add given string in in Reactor's reactive context -> ContextEnhancingWebFilter: 48 Commenting out this line, fixes MDC
  • Reproducer contains two instances of ContextEnhancingWebFilter in the Srping Context which adds different strings into the context. See ContextEnhancingConfiguration. Having just one such filter does not reproduce the issue
  • Reproducer tests if given string is being logged correctly (in the MDC context and in the plain, by extracting the string from reactive context)

Expected behaviour

Running tests together, either via IDE or gradle should work.

@marcingrzejszczak
Copy link
Contributor

If you rewrite this to plain Java do you see the same problem? There are so many moving parts here, Kotlin + Reactor + Context Propagation, let's try one thing at a time.

@marcingrzejszczak
Copy link
Contributor

cc @sdeleuze in case anything obvious comes to your mind

@surmabck
Copy link
Author

The reproducer is now rewritten to Java. The issue is still there.

@sdeleuze
Copy link

sdeleuze commented Jan 2, 2024

cc @sdeleuze in case anything obvious comes to your mind

Nothing specific, and looks like it also happens in Java, so I will let you have a deeper look.

@marcingrzejszczak
Copy link
Contributor

With the quite bug changes from this PR. The provided sample works well after adding the ObservationAwareBaggageThreadLocalAccessor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants