/// <summary>
        /// Enables OpenTelemetry Protocol (OTLP) exporter.
        /// </summary>
        /// <param name="builder">Trace builder to use.</param>
        /// <param name="configure">Configuration action.</param>
        /// <param name="processorConfigure">Span processor configuration action.</param>
        /// <returns>The instance of <see cref="TracerBuilder"/> to chain the calls.</returns>
        public static TracerBuilder UseOpenTelemetryProtocolExporter(
            this TracerBuilder builder, Action <ExporterOptions> configure, Action <SpanProcessorPipelineBuilder> processorConfigure)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

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

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

            var configuration = new ExporterOptions();

            configure(configuration);
            return(builder.AddProcessorPipeline(b =>
            {
                b.SetExporter(new TraceExporter(configuration));
                processorConfigure.Invoke(b);
            }));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Registers Console exporter.
        /// </summary>
        /// <param name="builder">Trace builder to use.</param>
        /// <param name="configure">Exporter configuration options.</param>
        /// <param name="processorConfigure">Span processor configuration.</param>
        /// <returns>The instance of <see cref="TracerBuilder"/> to chain the calls.</returns>
        public static TracerBuilder UseConsole(this TracerBuilder builder, Action <ConsoleExporterOptions> configure, Action <SpanProcessorPipelineBuilder> processorConfigure)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

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

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

            var options = new ConsoleExporterOptions();

            configure(options);
            return(builder.AddProcessorPipeline(b =>
            {
                b.SetExporter(new ConsoleExporter(options));
                processorConfigure.Invoke(b);
            }));
        }
Exemplo n.º 3
0
 public static TracerBuilder AddDelegateExporter(this TracerBuilder builder,
                                                 OnProcessFunc onProcess,
                                                 OnFinishFunc onShutdown = null)
 {
     return(builder.AddProcessorPipeline((cfg) =>
                                         cfg.SetExporter(new DelegateExporter(onProcess, onShutdown))
                                         .SetExportingProcessor(e => new SimpleSpanProcessor(e))));
 }
Exemplo n.º 4
0
        public static TracerBuilder UseMonitor(this TracerBuilder builder, IServiceProvider serviceProvider)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            return(builder.AddProcessorPipeline(b => b
                                                .SetExporter(serviceProvider.GetService(typeof(MonitorExporter)) as MonitorExporter)
                                                .SetExportingProcessor(e => new BatchingSpanProcessor(e))));
        }
        /// <summary>
        /// Enables OpenTelemetry Protocol (OTLP) exporter.
        /// </summary>
        /// <param name="builder">Trace builder to use.</param>
        /// <param name="configure">Configuration action.</param>
        /// <returns>The instance of <see cref="TracerBuilder"/> to chain the calls.</returns>
        public static TracerBuilder UseOpenTelemetryProtocolExporter(this TracerBuilder builder, Action <ExporterOptions> configure)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

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

            var configuration = new ExporterOptions();

            configure(configuration);
            return(builder.AddProcessorPipeline(b => b
                                                .SetExporter(new TraceExporter(configuration))
                                                .SetExportingProcessor(e => new BatchingSpanProcessor(e))));
        }
Exemplo n.º 6
0
        /// <summary>
        /// Registers a Console exporter.
        /// </summary>
        /// <param name="builder">Trace builder to use.</param>
        /// <param name="configure">Exporter configuration options.</param>
        /// <returns>The instance of <see cref="TracerBuilder"/> to chain the calls.</returns>
        public static TracerBuilder UseConsole(this TracerBuilder builder, Action <ConsoleExporterOptions> configure)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

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

            var options = new ConsoleExporterOptions();

            configure(options);
            return(builder.AddProcessorPipeline(b => b
                                                .SetExporter(new ConsoleExporter(options))
                                                .SetExportingProcessor(e => new SimpleSpanProcessor(e))));
        }
 /// <summary>
 /// Advanced Configuration the New Relic Data Exporter that is configured using an instance of TelemetryConfiguration and a Logger Factory
 /// </summary>
 /// <param name="builder"></param>
 /// <param name="config"></param>
 /// <param name="loggerFactory">Logger Factory supported by Microsoft.Extensions.Logging</param>
 /// <returns></returns>
 public static TracerBuilder UseNewRelic(this TracerBuilder builder, TelemetryConfiguration config, ILoggerFactory loggerFactory)
 {
     builder.AddProcessorPipeline(c => c.SetExporter(new NewRelicTraceExporter(config, loggerFactory))
                                  .SetExportingProcessor(e => new BatchingSpanProcessor(e)));
     return(builder);
 }
 /// <summary>
 /// Advanced Configuration the New Relic Data Exporter providing configuration provider and a logger factory
 /// factory.
 /// </summary>
 /// <param name="builder"></param>
 /// <param name="configProvider"></param>
 /// <param name="loggerFactory">Logger Factory supported by Microsoft.Extensions.Logging</param>
 /// <returns></returns>
 public static TracerBuilder UseNewRelic(this TracerBuilder builder, IConfiguration configProvider, ILoggerFactory loggerFactory)
 {
     builder.AddProcessorPipeline(c => c.SetExporter(new NewRelicTraceExporter(configProvider, loggerFactory)));
     return(builder);
 }