census-instrumentation / opencensus-csharp

Distributed tracing and stats collecting framework
https://opencensus.io
Apache License 2.0
139 stars 32 forks source link

Make list of support generic diagnostc listeners configurable #131

Closed lmolkova closed 5 years ago

lmolkova commented 5 years ago

DependencyCollector now has a hardcoded list of supported dependencies (http only for now):

namespace OpenCensus.Collector.Dependencies{
       // ...
       public DependenciesCollector(DependenciesCollectorOptions options, ITracer tracer, ISampler sampler, IPropagationComponent propagationComponent)
        {
            this.diagnosticSourceSubscriber = new DiagnosticSourceSubscriber(
                new Dictionary<string, Func<ITracer, Func<HttpRequestMessage, ISampler>, ListenerHandler>>()
                {
                    { "HttpHandlerDiagnosticListener", (t, s) => new HttpHandlerDiagnosticListener(t, s, propagationComponent) } ,
                   // e.g. how do I add { "Microsoft.Azure.Sdk", (t, s) => new AzureSdkListener(t, sampler) }
                },
                tracer,
                x =>  {... });
            this.diagnosticSourceSubscriber.Subscribe();
        }

We should allow configuring generic sources by name and allowing to provide custom handlers. This could be done via DependenciesCollectorOptions.

This is also useful when users need to remove default collectors.

SergeyKanzhelev commented 5 years ago

Moved to OpenTelemetry