private static TracerProviderBuilder AddRedisInstrumentation(
            TracerProviderBuilder builder,
            IConnectionMultiplexer connection,
            StackExchangeRedisCallsInstrumentationOptions options,
            Action <StackExchangeRedisCallsInstrumentationOptions> configure = null)
        {
            configure?.Invoke(options);

            return(builder
                   .AddInstrumentation(() => new StackExchangeRedisCallsInstrumentation(connection, options))
                   .AddSource(StackExchangeRedisCallsInstrumentation.ActivitySourceName));
        }
        /// <summary>
        /// Enables the outgoing requests automatic data collection for Redis.
        /// </summary>
        /// <param name="builder"><see cref="TracerProviderBuilder"/> being configured.</param>
        /// <param name="connection"><see cref="ConnectionMultiplexer"/> to instrument.</param>
        /// <param name="configureOptions">Redis configuration options.</param>
        /// <returns>The instance of <see cref="TracerProviderBuilder"/> to chain the calls.</returns>
        public static TracerProviderBuilder AddRedisInstrumentation(
            this TracerProviderBuilder builder,
            ConnectionMultiplexer connection,
            Action <StackExchangeRedisCallsInstrumentationOptions> configureOptions = null)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            StackExchangeRedisCallsInstrumentationOptions options = new StackExchangeRedisCallsInstrumentationOptions();

            configureOptions?.Invoke(options);

            return(builder
                   .AddInstrumentation((activitySourceAdapter) => new StackExchangeRedisCallsInstrumentation(connection, options))
                   .AddSource(StackExchangeRedisCallsInstrumentation.ActivitySourceName));
        }