Skip to content

[Exporter.OTLP] Enable IHttpClientFactory for OtlpLogExporter#7109

Open
nquandt wants to merge 8 commits intoopen-telemetry:mainfrom
nquandt:fix/otlp-log-exporter-http-client-factory
Open

[Exporter.OTLP] Enable IHttpClientFactory for OtlpLogExporter#7109
nquandt wants to merge 8 commits intoopen-telemetry:mainfrom
nquandt:fix/otlp-log-exporter-http-client-factory

Conversation

@nquandt
Copy link
Copy Markdown

@nquandt nquandt commented Apr 17, 2026

Fixes #
Design discussion issue #

Changes

Prior to .NET 8, DefaultHttpClientFactory took ILoggerFactory as a constructor argument, causing a circular dependency when used from the log export path:

ILoggerFactory -> OpenTelemetryLoggerProvider -> OtlpLogExporter
-> IHttpClientFactory -> ILoggerFactory

.NET 8 removed that constructor dependency by deferring ILoggerFactory resolution via a Lazy field (dotnet/runtime#89531).

We can just check #if NET_8_0_OR_GREATER before calling TryEnableIHttpClientFactoryIntegration, bringing OtlpLogExporter to parity with the trace and metrics exporters.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

@nquandt nquandt requested a review from a team as a code owner April 17, 2026 23:51
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Apr 17, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

@github-actions github-actions bot added the pkg:OpenTelemetry.Exporter.OpenTelemetryProtocol Issues related to OpenTelemetry.Exporter.OpenTelemetryProtocol NuGet package label Apr 17, 2026
@nquandt nquandt changed the title Enable IHttpClientFactory for OtlpLogExporter [Exporter.OTLP] Enable IHttpClientFactory for OtlpLogExporter Apr 18, 2026
@nquandt nquandt force-pushed the fix/otlp-log-exporter-http-client-factory branch from d822c52 to 72f0081 Compare April 18, 2026 17:03
Comment thread src/OpenTelemetry.Exporter.OpenTelemetryProtocol/CHANGELOG.md Outdated
Comment thread test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OtlpLogExporterTests.cs Outdated
@nquandt
Copy link
Copy Markdown
Author

nquandt commented Apr 18, 2026

Took all suggestions and resolved merge conflicts. 👍

@nquandt
Copy link
Copy Markdown
Author

nquandt commented Apr 18, 2026

Sorry looks like I had missed a lint check. Removed an extra space in the changelog.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.80%. Comparing base (f412e47) to head (c80f732).
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7109      +/-   ##
==========================================
- Coverage   88.86%   88.80%   -0.07%     
==========================================
  Files         271      271              
  Lines       12980    12981       +1     
==========================================
- Hits        11535    11528       -7     
- Misses       1445     1453       +8     
Flag Coverage Δ
unittests-Project-Experimental 88.67% <100.00%> (-0.20%) ⬇️
unittests-Project-Stable 88.78% <100.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...lemetryProtocol/OtlpLogExporterHelperExtensions.cs 93.45% <100.00%> (+0.03%) ⬆️

... and 2 files with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg:OpenTelemetry.Exporter.OpenTelemetryProtocol Issues related to OpenTelemetry.Exporter.OpenTelemetryProtocol NuGet package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants