2.3 KiB
2.3 KiB
OTLP Exporter for OpenTelemetry .NET
The OTLP (OpenTelemetry Protocol) exporter communicates to an OpenTelemetry Collector through a gRPC protocol.
Prerequisite
Installation
dotnet add package OpenTelemetry.Exporter.OpenTelemetryProtocol
Configuration
You can configure the OtlpExporter through OtlpExporterOptions properties:
Endpoint: Target to which the exporter is going to send traces or metrics. The endpoint must be a valid Uri with scheme (http or https) and host, and MAY contain a port and path.Headers: Optional headers for the connection.TimeoutMilliseconds: Max waiting time for the backend to process a batch.ExportProcessorType: Whether the exporter should use Batch or Simple exporting processor .BatchExportProcessorOptions: Configuration options for the batch exporter. Only used if ExportProcessorType is set to Batch.
See the TestOtlpExporter.cs for
an example of how to use the exporter.
Special case when using insecure channel
If your application is .NET Standard
2.1 or above, and you
are using an insecure (http) endpoint, the following switch must be set before
adding OtlpExporter.
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport",
true);
See this for more information.