-
Notifications
You must be signed in to change notification settings - Fork 979
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
Scoping issue using Spring Cloud Stream and Micrometer 1.10.9 #4002
Comments
I have a similar problem with version 1.0.9 described in spring-projects/spring-boot#36652. I wonder why these kinds of breaking changes are made without changing the minor version number. |
If I understand this correctly, this is not a breaking change in the source or on the API level but seems to be a bug/regression, right?
|
I tried out your reproducer with the latest snapshot of |
As a workaround, I was able to make this work by forcing context propagation by creating a new Observation for the <dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core-micrometer</artifactId>
</dependency> .tap(Micrometer.observation(observationRegistry))
.doOnSuccess(...) /cc @chemicL |
I think we might have an ordering issue (might be the instrumentation), if I add
This is a problem, not being in a But if I
This seems right, the scope should be closed after the user-provided function finished its job. |
@olegz Were there any changes in Spring Cloud Stream that could prevent the user provided function being in the scope of the |
With Micrometer 1.10.8:
The scope is closed after the user provided function finishes its job but by then the |
According to @garyrussell:
I think this means that this works as expected and the previous behavior was a bug (see the |
I have a similar problem with version 1.10.9 described in spring-projects/spring-boot#36652 without using any reactive stack. I don't understand "the previous behaviour was a bug" - for you maybe it is a bug but for me it works and now it doesn't. Unfortunately, it is common that updating the micrometer libraries brings problems that do not know why they appear. The functionality works, I update the library which supposedly introduces a small change (the last digit in the version number) and stops working. |
I would say if you are not using any reactive workload or any async handoff, it is not similar, please open a new issue for it with a minimal reproducer.
The scope closing mechanism had an issue and the scope was open when it should not, i.e.: Spring Cloud Stream closed the scope but because of a bug that scope was open. Right now that issue is fixed and the scope is closed when Spring Cloud Stream closes it.
Instrumenting Reactor is very tricky so we needed some time to figure it out. I also feel you misunderstood semver. Semantic Versioning says that it is allowed to make backward compatible bug fixes (no incompatible API changes) in
If we would follow your logic, we would not be able to make any fixes in Micrometer since it can change the behavior that somebody depends on (even if it is a bug). We are trying to do our best and not break source, binary and behavioral compatibility but we must change the behavior if it is a bug. In this case, see the
This indicates that a scope was never closed. This is a bug we fixed and now you actually see the intentional behavior of Spring Cloud Stream which is not including the user-provided function in the scope of their Observation. |
@jonatan-ivanov thanks for your explanation. |
Describe the bug
I've been advised in spring-projects/spring-boot#36592 to raise this issue here. In a nutshell I have upgraded micrometer from 1.10.8 to 1.10.9 and found trace info has disappeared when using a kafka consumer and a reactor thread pool
To Reproduce
https://github.com/davidmelia/spring-boot-kafka-consumer-tracing/tree/boot_3.0.9_trace_issue illustrates this issue (you will need Kafka and a topic called 'test')
Using <micrometer.version>1.10.8</micrometer.version> and running http://localhost:8080/sendMessage you get
which is great.
Remove <micrometer.version>1.10.8</micrometer.version> (the default is 1.10.9) then the final tid disappears. tracing is lost.
the consumer is quite simple
note removing delayElement from the kafka consumer everything is fine.
Expected behavior
log context behaviour is preserved
Additional context
N.B upgrading to <spring-cloud.version>2022.0.3</spring-cloud.version> also breaks this
The text was updated successfully, but these errors were encountered: