Example #1
0
        internal static TracerProviderBuilder AddHttpWebRequestInstrumentation(
            this TracerProviderBuilder builder,
            Action <HttpWebRequestInstrumentationOptions> configureOptions = null)
        {
            HttpWebRequestInstrumentationOptions options = new HttpWebRequestInstrumentationOptions();

            configureOptions?.Invoke(options);

            HttpWebRequestActivitySource.Options = options;

            builder.AddActivitySource(HttpWebRequestActivitySource.ActivitySourceName);

            return(builder);
        }
Example #2
0
        /// <summary>
        /// Enables SqlClient instrumentation.
        /// </summary>
        /// <param name="builder"><see cref="TracerProviderBuilder"/> being configured.</param>
        /// <param name="configureSqlClientInstrumentationOptions">SqlClient configuration options.</param>
        /// <returns>The instance of <see cref="TracerProviderBuilder"/> to chain the calls.</returns>
        public static TracerProviderBuilder AddSqlClientInstrumentation(
            this TracerProviderBuilder builder,
            Action <SqlClientInstrumentationOptions> configureSqlClientInstrumentationOptions = null)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            var sqlOptions = new SqlClientInstrumentationOptions();

            configureSqlClientInstrumentationOptions?.Invoke(sqlOptions);

            builder.AddInstrumentation((activitySource) => new SqlClientInstrumentation(sqlOptions));
            builder.AddActivitySource(SqlClientDiagnosticListener.ActivitySourceName);

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

            HttpWebRequestInstrumentationOptions options = new HttpWebRequestInstrumentationOptions();

            configureOptions?.Invoke(options);

            HttpWebRequestActivitySource.Options = options;

            builder.AddActivitySource(HttpWebRequestActivitySource.ActivitySourceName);

            return(builder);
        }