jbogard / MongoDB.Driver.Core.Extensions.DiagnosticSources

Apache License 2.0
46 stars 18 forks source link

Support DiagnosticSource based instrumentations by sending Activity start and stop events to DiagnosticSource #11

Closed bocharovf closed 2 years ago

bocharovf commented 3 years ago

We use OpenTracing and opentracing-contrib package for instrumentation of asp.net core application that uses MongoDB.

Opentracing-contrib docs says:

It will create a span for every Activity

It provides code to process any arbitary Activity but in fact it uses DiagnosticSource to subscribe and handle events. As far as I understand Activity does not send start and stop events to DiagnosticSource automatically. It requires DiagnosticSource.StartActivity(Activity, object) to be called.

We could make to packages works together if send start and stop Activity events to DiagnosticSource by StartActivity and StopActivity methods.

Drawback is that we will still need dummy ActivityListener for MongoDB.Driver.Core.Extensions.DiagnosticSources source.