/// <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); })); }
/// <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)))); }
/// <summary> /// Enables the OpenTelemetry Protocol (OTLP) exporter. /// </summary> /// <param name="builder">Open Telemetry builder to use.</param> /// <param name="configure">Exporter configuration options.</param> /// <returns>The instance of <see cref="OpenTelemetryBuilder"/> to chain the calls.</returns> public static OpenTelemetryBuilder UseOpenTelemetryProtocolActivityExporter(this OpenTelemetryBuilder builder, Action <ExporterOptions> configure) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } if (configure == null) { throw new ArgumentNullException(nameof(configure)); } return(builder.AddProcessorPipeline(pipeline => { var exporterOptions = new ExporterOptions(); configure(exporterOptions); var activityExporter = new OtlpActivityExporter(exporterOptions); pipeline.SetExporter(activityExporter); })); }
/// <summary> /// Initializes a new instance of the <see cref="TraceExporter"/> class. /// </summary> /// <param name="options">Configuration options for the exporter.</param> public TraceExporter(ExporterOptions options) { this.channel = new Channel(options.Endpoint, options.Credentials); this.traceClient = new OtlpCollector.TraceService.TraceServiceClient(this.channel); }
/// <summary> /// Initializes a new instance of the <see cref="SpanDataExporter"/> class. /// </summary> /// <param name="options">Configuration options for the exporter.</param> public SpanDataExporter(ExporterOptions options) { this.traceExporter = new TraceExporter(options); }
/// <summary> /// Initializes a new instance of the <see cref="OtlpActivityExporter"/> class. /// </summary> /// <param name="options">Configuration options for the exporter.</param> public OtlpActivityExporter(ExporterOptions options) { this.traceExporter = new TraceExporter(options); }