zipkin-js
zipkin-js copied to clipboard
context lost when tracing mongodb?
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!
anyone can pr mongodb instrumentation ? I am confused.
Maybe do a github search to see if anyone else is making custom tracing for mongo using zipkin-js?
On 15 Apr 2017 12:03 am, "阳衡锋" [email protected] wrote:
anyone can pr mongodb instruments ? I am confused.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/openzipkin/zipkin-js/issues/101#issuecomment-294180518, or mute the thread https://github.com/notifications/unsubscribe-auth/AAD616TgJUWkWFu4UQ_e9c2uYl3LhdKcks5rv5i2gaJpZM4M8iNL .
I looked around and found almost universally people are instrumenting mongodb with a shimmer of some sort.
@adriancole
- what do you mean by a shimmer of some sort?
- do you think this project would be a good option for zipkin-mongo instrumentation? https://github.com/abesto/zipkin-mongodb
Thanks!
Worth to revisit this @adriancole ?
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.