Skip to content

Commit

Permalink
Improve OTLP Exporter doc - provide recommendation on custom AuthN
Browse files Browse the repository at this point in the history
  • Loading branch information
reyang committed Feb 22, 2024
1 parent 09dd46f commit 4c4e981
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,13 @@ services.AddOpenTelemetry()
}));
```

> [!NOTE]
> `DefaultRequestHeaders` can be used for [HTTP Basic Access
Authentication](https://en.wikipedia.org/wiki/Basic_access_authentication), for
more complex authentication requirement, `DelegatingHandler` can be used to
handle token refresh, as explained
[here](https://stackoverflow.com/questions/56204350/how-to-refresh-a-token-using-ihttpclientfactory).

For users using
[IHttpClientFactory](https://docs.microsoft.com/dotnet/architecture/microservices/implement-resilient-applications/use-httpclientfactory-to-implement-resilient-http-requests)
you may also customize the named "OtlpTraceExporter" and/or "OtlpMetricExporter"
Expand All @@ -362,8 +369,9 @@ services.AddHttpClient(
client.DefaultRequestHeaders.Add("X-MyCustomHeader", "value"));
```

Note: The single instance returned by `HttpClientFactory` is reused by all
export requests.
> [!NOTE]
> The single instance returned by `HttpClientFactory` is reused by all export
requests.

## Troubleshooting

Expand Down

0 comments on commit 4c4e981

Please sign in to comment.