/// <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); }
/// <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); }
/// <summary> /// Enables the outgoing requests automatic data collection for SqlClient. /// </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 AddSqlClientDependencyInstrumentation( this OpenTelemetryBuilder builder) { return(builder.AddSqlClientDependencyInstrumentation(null)); }