question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Misaligned spans with Mongodb (includes sample)

See original GitHub issue

Describe 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 service and ColorControllerTest.find
  • 2 branches; the main branch is buggy & with_sleuth_mongodb_disable branch where all unit tests pass
  • The issue can be check quickly by run the app via GET localhost:8080/… You will need mongo running locally docker 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:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jiraguhacommented, Mar 15, 2021

Never mind, we will just wait for 2020.0.2 release… Thx for your time

1reaction
marcingrzejszczakcommented, Mar 15, 2021

Cloud 2020.0.2-SNAPSHOT or Sleuth 3.0.2-SNAPSHOT

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found