Exemple #1
0
        /// <summary>
        /// Registers a Zipkin exporter that will receive <see cref="System.Diagnostics.Activity"/> instances.
        /// </summary>
        /// <param name="builder"><see cref="TracerProviderBuilder"/> builder to use.</param>
        /// <param name="configure">Exporter configuration options.</param>
        /// <param name="processorConfigure">Activity processor configuration.</param>
        /// <returns>The instance of <see cref="TracerProviderBuilder"/> to chain the calls.</returns>
        public static TracerProviderBuilder UseZipkinExporter(this TracerProviderBuilder builder, Action <ZipkinExporterOptions> configure = null, Action <ActivityProcessorPipelineBuilder> processorConfigure = null)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            return(builder.AddProcessorPipeline(pipeline =>
            {
                var options = new ZipkinExporterOptions();
                configure?.Invoke(options);

                var exporter = new ZipkinExporter(options);
                processorConfigure?.Invoke(pipeline);
                pipeline.SetExporter(exporter);
            }));
        }