internal static TracerProviderBuilder AddAspNetCoreInstrumentation(
     this TracerProviderBuilder builder,
     AspNetCoreInstrumentation instrumentation)
 {
     builder.AddSource(HttpInListener.ActivitySourceName);
     builder.AddLegacySource(HttpInListener.ActivityOperationName); // for the activities created by AspNetCore
     return builder.AddInstrumentation(() => instrumentation);
 }
Beispiel #2
0
        private static TracerProviderBuilder AddAspNetCoreInstrumentation(TracerProviderBuilder builder, AspNetCoreInstrumentationOptions options, Action <AspNetCoreInstrumentationOptions> configure = null)
        {
            configure?.Invoke(options);
            var instrumentation = new AspNetCoreInstrumentation(options);

            builder.AddSource(HttpInListener.ActivitySourceName);
            builder.AddLegacySource(HttpInListener.ActivityOperationName); // for the activities created by AspNetCore
            return(builder.AddInstrumentation(() => instrumentation));
        }
Beispiel #3
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddOpenTelemetry(() =>
            {
                var tracerFactory = new LoggingTracerFactory();
                var tracer        = tracerFactory.GetTracer("ServerApp", "semver:1.0.0");

                var dependenciesInstrumentation = new DependenciesInstrumentation(tracerFactory);
                var aspNetCoreInstrumentation   = new AspNetCoreInstrumentation(tracer);

                return(tracerFactory);
            });
        }