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 authored Feb 22, 2024
1 parent 09dd46f commit 88b6b0e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,14 @@ services.AddOpenTelemetry()
}));
```

> [!NOTE]
> `DefaultRequestHeaders` can be used for [HTTP Basic Access
Authentication](https://en.wikipedia.org/wiki/Basic_access_authentication). For
more complex authentication requirements,
[`System.Net.Http.DelegatingHandler`](https://learn.microsoft.com/dotnet/api/system.net.http.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 +370,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 88b6b0e

Please sign in to comment.