Skip to content

Conversation

sandy2008
Copy link
Contributor

@sandy2008 sandy2008 commented Jun 20, 2025

Fixes #2009
Design discussion issue #5918

Changes

This PR adds support for mutual TLS (mTLS) configuration to the OTLP exporter on .NET 8 and later. This allows users to specify certificate paths, enable validation, and inject custom server certificate validation logic.

Key changes include:

  • OtlpMtlsOptions class with properties like ClientCertificatePath, ClientKeyPath, CaCertificatePath, EnableFilePermissionChecks, etc.
  • OtlpMtlsHttpClientFactory for creating HttpClient instances configured for mTLS.
  • OtlpMtlsCertificateManager for certificate loading, validation, and file permission checks.
  • Extended event logging via OpenTelemetryProtocolExporterEventSource for mTLS events.
  • Unit tests for configuration handling and certificate behavior.
  • Initial integration and performance test stubs added.

mTLS support is only enabled for builds targeting NET8_0_OR_GREATER.

Merge requirement checklist

@sandy2008 sandy2008 requested a review from a team as a code owner June 20, 2025 07:13
@github-actions github-actions bot added the pkg:OpenTelemetry.Exporter.OpenTelemetryProtocol Issues related to OpenTelemetry.Exporter.OpenTelemetryProtocol NuGet package label Jun 20, 2025
@sandy2008 sandy2008 force-pushed the main branch 2 times, most recently from bebeff9 to 4b2dc0b Compare June 20, 2025 08:04
Copy link

codecov bot commented Jun 20, 2025

Codecov Report

❌ Patch coverage is 58.54701% with 97 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.12%. Comparing base (d2f8e54) to head (cabc172).
⚠️ Report is 30 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...tocol/Implementation/OtlpMtlsCertificateManager.cs 47.28% 68 Missing ⚠️
...otocol/Implementation/OtlpMtlsHttpClientFactory.cs 55.93% 26 Missing ⚠️
...tation/OpenTelemetryProtocolExporterEventSource.cs 62.50% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6343      +/-   ##
==========================================
- Coverage   86.67%   86.12%   -0.56%     
==========================================
  Files         258      261       +3     
  Lines       11873    12099     +226     
==========================================
+ Hits        10291    10420     +129     
- Misses       1582     1679      +97     
Flag Coverage Δ
unittests-Project-Experimental 86.02% <58.54%> (-0.50%) ⬇️
unittests-Project-Stable 85.91% <58.54%> (-0.36%) ⬇️

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

Files with missing lines Coverage Δ
...orter.OpenTelemetryProtocol/OtlpExporterOptions.cs 99.25% <100.00%> (+0.16%) ⬆️
....Exporter.OpenTelemetryProtocol/OtlpMtlsOptions.cs 100.00% <100.00%> (ø)
...tation/OpenTelemetryProtocolExporterEventSource.cs 86.04% <62.50%> (+0.14%) ⬆️
...otocol/Implementation/OtlpMtlsHttpClientFactory.cs 55.93% <55.93%> (ø)
...tocol/Implementation/OtlpMtlsCertificateManager.cs 47.28% <47.28%> (ø)

... and 2 files with indirect coverage changes

@sandy2008 sandy2008 requested a review from martincostello June 23, 2025 11:51
@sandy2008 sandy2008 force-pushed the main branch 2 times, most recently from 5799324 to 642f23b Compare July 4, 2025 15:51
@sandy2008 sandy2008 changed the title [otlp] Add mTLS Support for OTLP Exporter [OTLP] Add mTLS Support for OTLP Exporter Jul 12, 2025
Copy link
Contributor

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.

@github-actions github-actions bot added the Stale Issues and pull requests which have been flagged for closing due to inactivity label Jul 20, 2025
@sandy2008
Copy link
Contributor Author

@rajkumar-rangaraj Hi :) Do you have time to review this PR?

@rajkumar-rangaraj
Copy link
Contributor

@rajkumar-rangaraj Hi :) Do you have time to review this PR?

I'm on vacation and will be back only after a month.

@github-actions github-actions bot removed the Stale Issues and pull requests which have been flagged for closing due to inactivity label Jul 21, 2025
Copy link
Contributor

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.

@github-actions github-actions bot added the Stale Issues and pull requests which have been flagged for closing due to inactivity label Jul 28, 2025
@sandy2008
Copy link
Contributor Author

@rajkumar-rangaraj Hi :) Do you have time to review this PR?

I'm on vacation and will be back only after a month.

Got it, thank you! @rajkumar-rangaraj

@Kielek Kielek removed the Stale Issues and pull requests which have been flagged for closing due to inactivity label Jul 28, 2025
Copy link
Contributor

github-actions bot commented Aug 5, 2025

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.

@github-actions github-actions bot added the Stale Issues and pull requests which have been flagged for closing due to inactivity label Aug 5, 2025
@alanwest alanwest removed the Stale Issues and pull requests which have been flagged for closing due to inactivity label Aug 5, 2025
@sandy2008
Copy link
Contributor Author

@alanwest Could you help change the requested change to approve~? Tyvm!

Copy link
Contributor

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.

@github-actions github-actions bot added the Stale Issues and pull requests which have been flagged for closing due to inactivity label Aug 14, 2025
@Kielek Kielek removed the Stale Issues and pull requests which have been flagged for closing due to inactivity label Aug 18, 2025
@sandy2008
Copy link
Contributor Author

@rajkumar-rangaraj Hi! Any updates?

Copy link
Contributor

github-actions bot commented Sep 1, 2025

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.

@github-actions github-actions bot added the Stale Issues and pull requests which have been flagged for closing due to inactivity label Sep 1, 2025
@Kielek Kielek removed the Stale Issues and pull requests which have been flagged for closing due to inactivity label Sep 2, 2025
Copy link
Contributor

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.

@github-actions github-actions bot added the Stale Issues and pull requests which have been flagged for closing due to inactivity label Sep 10, 2025
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 Stale Issues and pull requests which have been flagged for closing due to inactivity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add OTLP Exporter TLS/mTLS configuration options
5 participants