Exemplo n.º 1
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);
            }));
        }
        public ConsoleExporter(ConsoleExporterOptions options)
        {
            this.serializerOptions = new JsonSerializerOptions
            {
                WriteIndented = options.Pretty,
            };

            this.serializerOptions.Converters.Add(new JsonStringEnumConverter());
        }
        public ConsoleExporter(ConsoleExporterOptions options)
        {
            this.serializerOptions = new JsonSerializerOptions()
            {
                WriteIndented = true,
            };

            this.displayAsJson = options.DisplayAsJson;

            this.serializerOptions.Converters.Add(new JsonStringEnumConverter());
            this.serializerOptions.Converters.Add(new ActivitySpanIdConverter());
            this.serializerOptions.Converters.Add(new ActivityTraceIdConverter());
        }
Exemplo n.º 4
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))));
        }
Exemplo n.º 5
0
 public ConsoleLogRecordExporter(ConsoleExporterOptions options)
     : base(options)
 {
 }
Exemplo n.º 6
0
 public ConsoleActivityExporter(ConsoleExporterOptions options)
     : base(options)
 {
 }