Esempio n. 1
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
            builder.AddLegacySource(HttpInListener.ActivityNameByHttpInListener); // for the sibling activities created by the instrumentation library
            return(builder.AddInstrumentation(() => instrumentation));
        }
Esempio n. 2
0
        /// <summary>
        /// Enables the Quartz.NET Job automatic data collection for Quartz.NET.
        /// </summary>
        /// <param name="builder"><see cref="TraceProviderBuilderExtensions"/> being configured.</param>
        /// <param name="configureQuartzInstrumentationOptions">Quartz configuration options.</param>
        /// <returns>The instance of <see cref="TraceProviderBuilderExtensions"/> to chain the calls.</returns>
        public static TracerProviderBuilder AddQuartzInstrumentation(
            this TracerProviderBuilder builder,
            Action <QuartzInstrumentationOptions> configureQuartzInstrumentationOptions = null)
        {
            var options = new QuartzInstrumentationOptions();

            configureQuartzInstrumentationOptions?.Invoke(options);

            builder.AddInstrumentation(() => new QuartzJobInstrumentation(options));
            builder.AddSource(QuartzDiagnosticListener.ActivitySourceName);

            builder.AddLegacySource(OperationName.Job.Execute);
            builder.AddLegacySource(OperationName.Job.Veto);

            return(builder);
        }
 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);
 }
Esempio n. 4
0
 internal static TracerProviderBuilder AddHttpClientInstrumentation(
     this TracerProviderBuilder builder,
     HttpClientInstrumentation instrumentation)
 {
     builder.AddSource(HttpHandlerDiagnosticListener.ActivitySourceName);
     builder.AddLegacySource("System.Net.Http.HttpRequestOut");
     return(builder.AddInstrumentation(() => instrumentation));
 }
Esempio n. 5
0
        /// <summary>
        /// Enables the incoming requests automatic data collection for ASP.NET Core.
        /// </summary>
        /// <param name="builder"><see cref="TracerProviderBuilder"/> being configured.</param>
        /// <param name="configureAspNetCoreInstrumentationOptions">ASP.NET Core Request configuration options.</param>
        /// <returns>The instance of <see cref="TracerProviderBuilder"/> to chain the calls.</returns>
        public static TracerProviderBuilder AddAspNetCoreInstrumentation(
            this TracerProviderBuilder builder,
            Action <AspNetCoreInstrumentationOptions> configureAspNetCoreInstrumentationOptions = null)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            var aspnetCoreOptions = new AspNetCoreInstrumentationOptions();

            configureAspNetCoreInstrumentationOptions?.Invoke(aspnetCoreOptions);
            builder.AddInstrumentation(() => new AspNetCoreInstrumentation(aspnetCoreOptions));
            builder.AddSource(HttpInListener.ActivitySourceName);
            builder.AddLegacySource(HttpInListener.ActivityOperationName);        // for the activities created by AspNetCore
            builder.AddLegacySource(HttpInListener.ActivityNameByHttpInListener); // for the sibling activities created by the instrumentation library

            return(builder);
        }
Esempio n. 6
0
        /// <summary>
        /// Enables the outgoing requests automatic data collection for MassTransit.
        /// </summary>
        /// <param name="builder"><see cref="TracerProviderBuilderExtensions"/> being configured.</param>
        /// <param name="configureMassTransitInstrumentationOptions">MassTransit configuration options.</param>
        /// <returns>The instance of <see cref="TracerProviderBuilderExtensions"/> to chain the calls.</returns>
        public static TracerProviderBuilder AddMassTransitInstrumentation(
            this TracerProviderBuilder builder,
            Action <MassTransitInstrumentationOptions> configureMassTransitInstrumentationOptions = null)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            var options = new MassTransitInstrumentationOptions();

            configureMassTransitInstrumentationOptions?.Invoke(options);

            builder.AddInstrumentation(() => new MassTransitInstrumentation(options));
            builder.AddSource(MassTransitDiagnosticListener.ActivitySourceName);

            builder.AddLegacySource(OperationName.Consumer.Consume);
            builder.AddLegacySource(OperationName.Consumer.Handle);
            builder.AddLegacySource(OperationName.Transport.Send);
            builder.AddLegacySource(OperationName.Transport.Receive);

            return(builder);
        }
Esempio n. 7
0
        /// <summary>
        /// Enables HttpClient instrumentation.
        /// </summary>
        /// <param name="builder"><see cref="TracerProviderBuilder"/> being configured.</param>
        /// <param name="configureHttpClientInstrumentationOptions">HttpClient configuration options.</param>
        /// <returns>The instance of <see cref="TracerProviderBuilder"/> to chain the calls.</returns>
        public static TracerProviderBuilder AddHttpClientInstrumentation(
            this TracerProviderBuilder builder,
            Action <HttpClientInstrumentationOptions> configureHttpClientInstrumentationOptions = null)
        {
            Guard.ThrowIfNull(builder, nameof(builder));

            var httpClientOptions = new HttpClientInstrumentationOptions();

            configureHttpClientInstrumentationOptions?.Invoke(httpClientOptions);

            builder.AddInstrumentation(() => new HttpClientInstrumentation(httpClientOptions));
            builder.AddSource(HttpHandlerDiagnosticListener.ActivitySourceName);
            builder.AddLegacySource("System.Net.Http.HttpRequestOut");

            return(builder);
        }
Esempio n. 8
0
        /// <summary>
        /// Enables gRPClient Instrumentation.
        /// </summary>
        /// <param name="builder"><see cref="TracerProviderBuilder"/> being configured.</param>
        /// <param name="configure">GrpcClient configuration options.</param>
        /// <returns>The instance of <see cref="TracerProviderBuilder"/> to chain the calls.</returns>
        public static TracerProviderBuilder AddGrpcClientInstrumentation(
            this TracerProviderBuilder builder,
            Action <GrpcClientInstrumentationOptions> configure = null)
        {
            Guard.Null(builder, nameof(builder));

            var grpcOptions = new GrpcClientInstrumentationOptions();

            configure?.Invoke(grpcOptions);

            builder.AddInstrumentation(() => new GrpcClientInstrumentation(grpcOptions));
            builder.AddSource(GrpcClientDiagnosticListener.ActivitySourceName);
            builder.AddLegacySource("Grpc.Net.Client.GrpcOut");

            return(builder);
        }
        /// <summary>
        /// Enables Elasticsearch client Instrumentation.
        /// </summary>
        /// <param name="builder"><see cref="TracerProviderBuilder"/> being configured.</param>
        /// <param name="configure">Elasticsearch client configuration options.</param>
        /// <returns>The instance of <see cref="TracerProviderBuilder"/> to chain the calls.</returns>
        public static TracerProviderBuilder AddElasticsearchClientInstrumentation(
            this TracerProviderBuilder builder,
            Action <ElasticsearchClientInstrumentationOptions> configure = null)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            var elasticsearchClientOptions = new ElasticsearchClientInstrumentationOptions();

            configure?.Invoke(elasticsearchClientOptions);

            builder.AddInstrumentation(() => new ElasticsearchClientInstrumentation(elasticsearchClientOptions));
            builder.AddSource(ElasticsearchRequestPipelineDiagnosticListener.ActivitySourceName);
            builder.AddLegacySource("CallElasticsearch");

            return(builder);
        }
        /// <summary>
        /// Enables HttpClient instrumentation.
        /// </summary>
        /// <param name="builder"><see cref="TracerProviderBuilder"/> being configured.</param>
        /// <param name="configureHttpClientInstrumentationOptions">HttpClient configuration options.</param>
        /// <returns>The instance of <see cref="TracerProviderBuilder"/> to chain the calls.</returns>
        public static TracerProviderBuilder AddHttpClientInstrumentation(
            this TracerProviderBuilder builder,
            Action <HttpClientInstrumentationOptions> configureHttpClientInstrumentationOptions = null)
#endif
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            var httpClientOptions = new HttpClientInstrumentationOptions();

            configureHttpClientInstrumentationOptions?.Invoke(httpClientOptions);

            builder.AddInstrumentation(() => new HttpClientInstrumentation(httpClientOptions));
            builder.AddSource(HttpHandlerDiagnosticListener.ActivitySourceName);
            builder.AddLegacySource("System.Net.Http.HttpRequestOut");

#if NETFRAMEWORK
            builder.AddHttpWebRequestInstrumentation(configureHttpWebRequestInstrumentationOptions);
#endif
            return(builder);
        }