Misaligned spans with Mongodb (includes sample)
See original GitHub issueDescribe the bug
Using Spring Sleuth with Mongodb integration causes issues. We use project-reactor and the issue apprears when a service call another service using flatmap. Both services use mongo:
java.lang.AssertionError: Misalignment: scoped span NoopSpan(3a27c90bb910c469/eef6aa97485a9d38) != current span null
at brave.propagation.ThreadLocalSpan.remove(ThreadLocalSpan.java:164) ~[brave-5.13.2.jar:na]
at brave.mongodb.TraceMongoCommandListener.commandSucceeded(TraceMongoCommandListener.java:103) ~[brave-instrumentation-mongodb-5.13.2.jar:na]
Maybe the issue is somewhere deeper in the relation between the reactive context and mongo… Please, find a sample below.
Sample
see mongo-misaligned-colors-example It contains:
- Unit tests that isolate the problem:
NextSpan && service calling serviceandColorControllerTest.find - 2 branches; the
mainbranch is buggy &with_sleuth_mongodb_disablebranch where all unit tests pass - The issue can be check quickly by run the app via
GET localhost:8080/… You will need mongo running locallydocker run -it -v mongodata:/data/db -p 27017:27017 --name mongodb -d mong
On the buggy branch, once the Misalignment occurs some other tests fail!
Note
It seems to be similar to #1349 or #1510
Spec
springCloud : 2020.0.1
springBoot: 2.4.3 with project-reactor
kotlin: 1.4.30
java: 15
``
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
MongoDB Aggregation with $or and $and - Stack Overflow
I have created a quick sample on mongo playground with 5 documents. The one with counter 4 & 5 is the outlier that...
Read more >span — MongoDB Atlas
The span operator finds text search matches within regions of a text field. You can use it to find strings which are near...
Read more >$sample (aggregation) — MongoDB Manual
$sample is the first stage of the pipeline. N is less than 5% of the total documents in the collection. The collection contains...
Read more >Algolia + MongoDB – Part 4: Frontend implementation and ...
In this post, I will implement the frontend that will consume the Algolia index we created in part 3 of this series. The...
Read more >Build a Basic CRUD App with ASP.NET Core 3.0 and MongoDB
The only cluster that should be in there to begin with is called Cluster0. Click on the COLLECTIONS button, then click the +...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Never mind, we will just wait for
2020.0.2release… Thx for your timeCloud
2020.0.2-SNAPSHOTor Sleuth3.0.2-SNAPSHOT