diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md index 8dd42301e23..763c2d54deb 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md @@ -6,6 +6,26 @@ [The OTLP (OpenTelemetry Protocol) exporter](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md) implementation. + +
+Table of Contents + +* [Installation](#installation) +* [Enable Log Exporter](#enable-log-exporter) +* [Enable Metric Exporter](#enable-metric-exporter) +* [Enable Trace Exporter](#enable-trace-exporter) +* [Configuration](#configuration) + * [OtlpExporterOptions](#otlpexporteroptions) + * [LogRecordExportProcessorOptions](#logrecordexportprocessoroptions) + * [MetricReaderOptions](#metricreaderoptions) + * [Environment Variables](#environment-variables) + * [Experimental Features](#environment-variables-for-experimental-features) + * [Configure HttpClient](#configure-httpclient) +* [Troubleshooting](#troubleshooting) + +
+ + ## Prerequisite * An endpoint capable of accepting OTLP, like [OpenTelemetry @@ -17,45 +37,6 @@ implementation. dotnet add package OpenTelemetry.Exporter.OpenTelemetryProtocol ``` -## Enable Trace Exporter - -This exporter provides `AddOtlpExporter()` extension method on `TracerProviderBuilder` -to enable exporting of traces. The following snippet adds the Exporter with default -[configuration](#configuration). - -```csharp -var tracerProvider = Sdk.CreateTracerProviderBuilder() - // rest of config not shown here. - .AddOtlpExporter() - .Build(); -``` - -See the [`TestOtlpExporter.cs`](../../examples/Console/TestOtlpExporter.cs) for -runnable example. - -## Enable Metric Exporter - -This exporter provides `AddOtlpExporter()` extension method on `MeterProviderBuilder` -to enable exporting of metrics. The following snippet adds the Exporter with default -[configuration](#configuration). - -```csharp -var meterProvider = Sdk.CreateMeterProviderBuilder() - // rest of config not shown here. - .AddOtlpExporter() - .Build(); -``` - -By default, `AddOtlpExporter()` pairs the OTLP MetricExporter with a -[PeriodicExportingMetricReader](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#periodic-exporting-metricreader) -with metric export interval of 60 secs and -[Temporality](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/data-model.md#temporality) -set as `Cumulative`. See -[`TestMetrics.cs`](../../examples/Console/TestMetrics.cs) for example on how to -customize the `MetricReaderOptions` or see the [Environment -Variables](#environment-variables) section below on how to customize using -environment variables. - ## Enable Log Exporter ```csharp @@ -89,6 +70,45 @@ setting on `OpenTelemetryLoggerOptions`. > Scope attributes with key set as empty string or `{OriginalFormat}` are ignored by exporter. Duplicate keys are exported as is. +## Enable Metric Exporter + +This exporter provides `AddOtlpExporter()` extension method on `MeterProviderBuilder` +to enable exporting of metrics. The following snippet adds the Exporter with default +[configuration](#configuration). + +```csharp +var meterProvider = Sdk.CreateMeterProviderBuilder() + // rest of config not shown here. + .AddOtlpExporter() + .Build(); +``` + +By default, `AddOtlpExporter()` pairs the OTLP MetricExporter with a +[PeriodicExportingMetricReader](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#periodic-exporting-metricreader) +with metric export interval of 60 secs and +[Temporality](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/data-model.md#temporality) +set as `Cumulative`. See +[`TestMetrics.cs`](../../examples/Console/TestMetrics.cs) for example on how to +customize the `MetricReaderOptions` or see the [Environment +Variables](#environment-variables) section below on how to customize using +environment variables. + +## Enable Trace Exporter + +This exporter provides `AddOtlpExporter()` extension method on `TracerProviderBuilder` +to enable exporting of traces. The following snippet adds the Exporter with default +[configuration](#configuration). + +```csharp +var tracerProvider = Sdk.CreateTracerProviderBuilder() + // rest of config not shown here. + .AddOtlpExporter() + .Build(); +``` + +See the [`TestOtlpExporter.cs`](../../examples/Console/TestOtlpExporter.cs) for +runnable example. + ## Configuration You can configure the `OtlpExporter` through `OtlpExporterOptions` @@ -169,6 +189,11 @@ appBuilder.Services.AddOptions() `OtlpExportProtocol.Grpc` and "localhost:4318" for `OtlpExportProtocol.HttpProtobuf`. +> [!NOTE] +> When using `OtlpExportProtocol.HttpProtobuf`, the full URL MUST be +> provided, including the signal-specific path v1/{signal}. For example, for +> traces, the full URL will look like `http://your-custom-endpoint/v1/traces`. + * `Headers`: Optional headers for the connection. * `HttpClientFactory`: A factory function called to create the `HttpClient`