Beispiel #1
0
        /// <summary>
        /// Enables the outgoing requests automatic data collection.
        /// </summary>
        /// <param name="builder">Trace builder to use.</param>
        /// <param name="configureHttpAdapterOptions">Http configuration options.</param>
        /// <param name="configureSqlAdapterOptions">Sql configuration options.</param>
        /// <returns>The instance of <see cref="TracerBuilder"/> to chain the calls.</returns>
        public static TracerBuilder AddDependencyAdapter(
            this TracerBuilder builder,
            Action <HttpClientAdapterOptions> configureHttpAdapterOptions = null,
            Action <SqlClientAdapterOptions> configureSqlAdapterOptions   = null)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            var httpOptions = new HttpClientAdapterOptions();

            configureHttpAdapterOptions?.Invoke(httpOptions);

            var sqlOptions = new SqlClientAdapterOptions();

            configureSqlAdapterOptions?.Invoke(sqlOptions);

            return(builder
                   .AddAdapter((t) => new AzureClientsAdapter(t))
                   .AddAdapter((t) => new AzurePipelineAdapter(t))
                   .AddAdapter((t) => new HttpClientAdapter(t, httpOptions))
                   .AddAdapter((t) => new HttpWebRequestAdapter(t, httpOptions))
                   .AddAdapter((t) => new SqlClientAdapter(t, sqlOptions)));
        }
Beispiel #2
0
        /// <summary>
        /// Enables the incoming requests automatic data collection.
        /// </summary>
        /// <param name="builder">Trace builder to use.</param>
        /// <returns>The instance of <see cref="TracerBuilder"/> to chain the calls.</returns>
        public static TracerBuilder AddRequestAdapter(this TracerBuilder builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            return(builder.AddAdapter(t => new AspNetAdapter(t)));
        }
Beispiel #3
0
        /// <summary>
        /// Enables the outgoing requests automatic data collection.
        /// </summary>
        /// <param name="builder">Trace builder to use.</param>
        /// <returns>The instance of <see cref="TracerBuilder"/> to chain the calls.</returns>
        public static TracerBuilder AddDependencyAdapter(this TracerBuilder builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            return(builder
                   .AddAdapter((t) => new AzureClientsAdapter(t))
                   .AddAdapter((t) => new AzurePipelineAdapter(t))
                   .AddAdapter((t) => new HttpClientAdapter(t))
                   .AddAdapter((t) => new HttpWebRequestAdapter(t))
                   .AddAdapter((t) => new SqlClientAdapter(t)));
        }
Beispiel #4
0
        /// <summary>
        /// Enables the incoming requests automatic data collection.
        /// </summary>
        /// <param name="builder">Trace builder to use.</param>
        /// <param name="configure">Configuration options.</param>
        /// <returns>The instance of <see cref="TracerBuilder"/> to chain the calls.</returns>
        public static TracerBuilder AddRequestAdapter(this TracerBuilder builder, Action <AspNetAdapterOptions> configure)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            if (configure == null)
            {
                throw new ArgumentNullException(nameof(configure));
            }

            var options = new AspNetAdapterOptions();

            configure(options);

            return(builder.AddAdapter(t => new AspNetAdapter(t, options)));
        }