Example #1
0
        /// <summary>
        /// Enables the outgoing requests automatic data collection for all supported activity sources.
        /// </summary>
        /// <param name="builder"><see cref="OpenTelemetryBuilder"/> being configured.</param>
        /// <returns>The instance of <see cref="OpenTelemetryBuilder"/> to chain the calls.</returns>
        public static OpenTelemetryBuilder AddDependencyInstrumentation(this OpenTelemetryBuilder builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            builder.AddHttpClientDependencyInstrumentation();
            builder.AddSqlClientDependencyInstrumentation();
#if NETFRAMEWORK
            builder.AddHttpWebRequestDependencyInstrumentation();
#endif
            return(builder);
        }
Example #2
0
        /// <summary>
        /// Enables the outgoing requests automatic data collection for all supported activity sources.
        /// </summary>
        /// <param name="builder"><see cref="OpenTelemetryBuilder"/> being configured.</param>
        /// <param name="configureHttpClientInstrumentationOptions">HttpClient configuration options.</param>
        /// <param name="configureSqlClientInstrumentationOptions">SqlClient configuration options.</param>
        /// <returns>The instance of <see cref="OpenTelemetryBuilder"/> to chain the calls.</returns>
        public static OpenTelemetryBuilder AddDependencyInstrumentation(
            this OpenTelemetryBuilder builder,
            Action <HttpClientInstrumentationOptions> configureHttpClientInstrumentationOptions = null,
            Action <SqlClientInstrumentationOptions> configureSqlClientInstrumentationOptions   = null)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            builder.AddHttpClientDependencyInstrumentation(configureHttpClientInstrumentationOptions);
            builder.AddSqlClientDependencyInstrumentation(configureSqlClientInstrumentationOptions);
            builder.AddGrpcClientDependencyInstrumentation();
#if NETFRAMEWORK
            builder.AddHttpWebRequestDependencyInstrumentation();
#endif
            return(builder);
        }
Example #3
0
 /// <summary>
 /// Enables the outgoing requests automatic data collection for HttpClient.
 /// </summary>
 /// <param name="builder"><see cref="OpenTelemetryBuilder"/> being configured.</param>
 /// <returns>The instance of <see cref="OpenTelemetryBuilder"/> to chain the calls.</returns>
 public static OpenTelemetryBuilder AddHttpClientDependencyInstrumentation(
     this OpenTelemetryBuilder builder)
 {
     return(builder.AddHttpClientDependencyInstrumentation(null));
 }