Пример #1
0
        public static TracerProviderBuilder AddInMemoryExporter(this TracerProviderBuilder builder, Action <InMemoryExporterOptions> configure = null)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            var options = new InMemoryExporterOptions();

            configure?.Invoke(options);
            return(builder.AddProcessor(new SimpleExportProcessor <Activity>(new InMemoryExporter <Activity>(options))));
        }
Пример #2
0
        public static OpenTelemetryLoggerOptions AddInMemoryExporter(this OpenTelemetryLoggerOptions loggerOptions, Action <InMemoryExporterOptions> configure = null)
        {
            if (loggerOptions == null)
            {
                throw new ArgumentNullException(nameof(loggerOptions));
            }

            var options = new InMemoryExporterOptions();

            configure?.Invoke(options);

            return(loggerOptions.AddProcessor(new SimpleExportProcessor <LogRecord>(new InMemoryExporter <LogRecord>(options))));
        }
        public static MeterProviderBuilder AddInMemoryExporter(this MeterProviderBuilder builder, ICollection <MetricItem> exportedItems, Action <InMemoryExporterOptions> configure = null)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

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

            var options = new InMemoryExporterOptions();

            configure?.Invoke(options);
            return(builder.AddMetricProcessor(new PushMetricProcessor(new InMemoryExporter <MetricItem>(exportedItems), options.MetricExportIntervalMilliseconds, options.IsDelta)));
        }