From 5bdde2ef2db38a65ade8d0f515fd1f969f2e4856 Mon Sep 17 00:00:00 2001 From: Vishwesh Bankwar Date: Fri, 23 Feb 2024 09:05:52 -0800 Subject: [PATCH 1/5] organize readme and clarify endpoint confusion --- .../OtlpExporterOptions.cs | 4 +++ .../README.md | 25 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpExporterOptions.cs b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpExporterOptions.cs index e4c820cf58a..09d13d69284 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpExporterOptions.cs +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpExporterOptions.cs @@ -97,6 +97,10 @@ internal OtlpExporterOptions( /// * http://localhost:4317 for /// * http://localhost:4318 for . /// + /// + /// When using , the full URL needs to 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. + /// public Uri Endpoint { get diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md index 8dd42301e23..aa1b719c494 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 Trace Exporter](#enable-trace-exporter) + * [Enable Metric Exporter](#enable-metric-exporter) + * [Enable Log Exporter](#enable-log-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 @@ -169,6 +189,11 @@ appBuilder.Services.AddOptions() `OtlpExportProtocol.Grpc` and "localhost:4318" for `OtlpExportProtocol.HttpProtobuf`. +> [!NOTE] +> When using `OtlpExportProtocol.HttpProtobuf`, the full URL needs to be +> provided, including the signal-specific path v1/{signal}. For example, for +> traces, the full URL will look like . + * `Headers`: Optional headers for the connection. * `HttpClientFactory`: A factory function called to create the `HttpClient` From 5a24f74cfdc356d54d04df474a11e251a5152647 Mon Sep 17 00:00:00 2001 From: Vishwesh Bankwar Date: Fri, 23 Feb 2024 09:10:35 -0800 Subject: [PATCH 2/5] reword --- .../OtlpExporterOptions.cs | 2 +- src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpExporterOptions.cs b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpExporterOptions.cs index 09d13d69284..e0a685a9873 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpExporterOptions.cs +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpExporterOptions.cs @@ -98,7 +98,7 @@ internal OtlpExporterOptions( /// * http://localhost:4318 for . /// /// - /// When using , the full URL needs to be provided, including the signal-specific path v1/{signal}. + /// When using , 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. /// public Uri Endpoint diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md index aa1b719c494..b9b86bf9f99 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md @@ -190,7 +190,7 @@ appBuilder.Services.AddOptions() `OtlpExportProtocol.HttpProtobuf`. > [!NOTE] -> When using `OtlpExportProtocol.HttpProtobuf`, the full URL needs to be +> 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 . From ab30bcbfcfa96ed830350fcc12aeb26c8e4f56c9 Mon Sep 17 00:00:00 2001 From: Vishwesh Bankwar Date: Fri, 23 Feb 2024 09:14:08 -0800 Subject: [PATCH 3/5] indent --- src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md index b9b86bf9f99..afae06ef7d5 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md @@ -11,9 +11,9 @@ implementation. Table of Contents * [Installation](#installation) - * [Enable Trace Exporter](#enable-trace-exporter) - * [Enable Metric Exporter](#enable-metric-exporter) - * [Enable Log Exporter](#enable-log-exporter) +* [Enable Trace Exporter](#enable-trace-exporter) +* [Enable Metric Exporter](#enable-metric-exporter) +* [Enable Log Exporter](#enable-log-exporter) * [Configuration](#configuration) * [OtlpExporterOptions](#otlpexporteroptions) * [LogRecordExportProcessorOptions](#logrecordexportprocessoroptions) From b12e3e200cc5c5d4b574b19ce7434464bb6fef24 Mon Sep 17 00:00:00 2001 From: Vishwesh Bankwar Date: Fri, 23 Feb 2024 09:38:39 -0800 Subject: [PATCH 4/5] fix link --- src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md index afae06ef7d5..a6367f34a0f 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md @@ -192,7 +192,7 @@ appBuilder.Services.AddOptions() > [!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 . +> traces, the full URL will look like `http://your-custom-endpoint/v1/traces`. * `Headers`: Optional headers for the connection. From c0a67a860fe3769d5701c61e574d2556c65ecdf0 Mon Sep 17 00:00:00 2001 From: Vishwesh Bankwar Date: Fri, 23 Feb 2024 09:46:07 -0800 Subject: [PATCH 5/5] re-arrange sequence --- .../README.md | 82 +++++++++---------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md index a6367f34a0f..763c2d54deb 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md @@ -11,9 +11,9 @@ implementation. Table of Contents * [Installation](#installation) -* [Enable Trace Exporter](#enable-trace-exporter) -* [Enable Metric Exporter](#enable-metric-exporter) * [Enable Log Exporter](#enable-log-exporter) +* [Enable Metric Exporter](#enable-metric-exporter) +* [Enable Trace Exporter](#enable-trace-exporter) * [Configuration](#configuration) * [OtlpExporterOptions](#otlpexporteroptions) * [LogRecordExportProcessorOptions](#logrecordexportprocessoroptions) @@ -37,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 @@ -109,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`