public GrpcClientDiagnosticListener(ActivitySourceAdapter activitySource, GrpcClientInstrumentationOptions options)
            : base("Grpc.Net.Client")
        {
            if (activitySource == null)
            {
                throw new ArgumentNullException(nameof(activitySource));
            }

            this.options        = options;
            this.activitySource = activitySource;
        }
Пример #2
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);
        }
Пример #3
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)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            var grpcOptions = new GrpcClientInstrumentationOptions();

            configure?.Invoke(grpcOptions);

            builder.AddDiagnosticSourceInstrumentation((activitySource) => new GrpcClientInstrumentation(activitySource, grpcOptions));
            return(builder);
        }
Пример #4
0
 public GrpcClientDiagnosticListener(GrpcClientInstrumentationOptions options)
     : base("Grpc.Net.Client")
 {
     this.options = options;
 }