Update OtlpLogExporterHelperExtensions configuration actions to accept IServiceProvider
Changes
This extends the extensions methods in OtlpLogExporterHelperExtensions to accept an additional IServiceProvider parameter.
This allows for accessing services during configuration of the Log exporter.
Specifically we want to be able to access the IServiceProvider when configuring Func<HttpClient> HttpClientFactory
Merge requirement checklist
- [ ] CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
- [ ] Unit tests added/updated
- [ ] Appropriate
CHANGELOG.mdfiles updated for non-trivial changes - [ ] Changes in public API reviewed (if applicable)
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: brnn8r / name: Steve (728fe9d3cc72e3973127083fbc1ce45922b11d6d, 37629412ff92731d1941357355d102b65c43a4a6, cec6c047b9ff12cab68349e576a780c6d0f70301, 6414abd923461147bc37627802ed0ec3d4f012de)
@brnn8r
Could you just do this instead?
services
.AddOptions<OtlpExporterOptions>()
.Configure<IServiceProvider>((o, sp) =>
{
o.HttpClientFactory = () => sp.GetRequiredService<IHttpClientFactory>().CreateClient("MyOtlpClient");
});
@brnn8r
Could you just do this instead?
services .AddOptions<OtlpExporterOptions>() .Configure<IServiceProvider>((o, sp) => { o.HttpClientFactory = () => sp.GetRequiredService<IHttpClientFactory>().CreateClient("MyOtlpClient"); });
Will give that a go. Thanks!
This PR was marked stale due to lack of activity and will be closed in 7 days. Commenting or Pushing will instruct the bot to automatically remove the label. This bot runs once per day.
Closed as inactive. Feel free to reopen if this PR is still being worked on.