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.

context lost when tracing mongodb?

See original GitHub issue

i focked this repo at https://github.com/hafeyang/zipkin-js/tree/master/packages/zipkin-instrumentation-mongodb

    ctxImpl.letContext(ctx, () => {
      const url = 'mongodb://localhost:27017/zipkin_test';
      MongoClient.connect(url, function(err, db) {
        const col = db.collection('somecollection');
        ctxImpl.letContext(ctx, () => {
          col.deleteMany({}, {}, function() {
            ctxImpl.letContext(ctx, () => {
              col.insertMany([{a: 1}, {a: 2}, {a: 3}], function() {
                db.close();
                const annotations = record.args.map(args => args[0]);
                annotations.forEach(a => console.log(a.traceId.traceId+" "+a.traceId.spanId+" "+a.traceId.parentId));
                console.log(annotations);
                done();
              });
            });
          });
        });
      });
    });

here is my test code , annotations logged and i found traceId changed,and i got 2 traceId.

may caused by context losing

detailed err description and code pls check https://github.com/hafeyang/zipkin-js/tree/master/packages/zipkin-instrumentation-mongodb

Thanks!

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
codefromthecryptcommented, Jul 21, 2019

keep open for now as I have another topic we need to resolve which is explicit use of contexts inside instrumentation (ex tracer.record(id, annotation)) which can help guarantee less loss of events.

0reactions
jcchavezscommented, Jul 21, 2019

Worth to revisit this @adriancole ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Trace context lost after mongo call #1204 - GitHub
Hi, using latest Spring versions (2.1.2.RELEASE and Cloud Greenwich.RELEASE) it looks like after calling mongo with reactive operators trace ...
Read more >
Internal Tracing of Redis,Mongo or Outbound Http call are not ...
So somebody can please tell me where I am doing wrong or what I am missing in the code. I have followed this...
Read more >
[GODRIVER-739] Support OpenTracing - MongoDB Jira
We trace mongodb command at the client side. We trace these three info for ... func (c *client) WrapCommand(fn func(oldProcess func(context.
Read more >
java.lang.ClassNotFoundException: com.mongodb.internal ...
I'm using mongodb with spring framework and ran into a similar issue. See stack trace below. Using the dependency versions 3.2.3 and 4.2.3...
Read more >
Tracing API - OpenTelemetry
A SpanContext represents the portion of a Span which must be serialized and propagated along side of a distributed context. SpanContext s are...
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