Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: configure TLS with environment variables. #2465

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jvanz
Copy link

@jvanz jvanz commented Dec 23, 2024

Updates the opentelemetry-otlp crate to allow users to configure TLS using environment variables. Removing the need to crating the TLS config object and defining it with the with_tls_config method. In the same way other OTLP libraries does (e.g. go lang).

Partially fixes #774

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

@jvanz jvanz force-pushed the tls-envvars branch 3 times, most recently from 50894e9 to 5031002 Compare December 24, 2024 16:12
Copy link

codecov bot commented Dec 24, 2024

Codecov Report

Attention: Patch coverage is 5.36913% with 141 lines in your changes missing coverage. Please review.

Project coverage is 77.4%. Comparing base (68af3bb) to head (07e62dd).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
opentelemetry-otlp/src/exporter/tonic/mod.rs 0.0% 121 Missing ⚠️
opentelemetry-otlp/src/exporter/mod.rs 28.5% 20 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main   #2465     +/-   ##
=======================================
- Coverage   77.9%   77.4%   -0.5%     
=======================================
  Files        123     123             
  Lines      22944   23168    +224     
=======================================
+ Hits       17880   17948     +68     
- Misses      5064    5220    +156     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jvanz jvanz force-pushed the tls-envvars branch 3 times, most recently from 9458a03 to 093a1ce Compare December 31, 2024 14:46
@jvanz jvanz marked this pull request as ready for review December 31, 2024 14:50
@jvanz jvanz requested a review from a team as a code owner December 31, 2024 14:50
@jvanz
Copy link
Author

jvanz commented Jan 20, 2025

@TommyCpp , how can we move this forward? 😄

Updates the opentelemetry-otlp crate to allow users to configure TLS
using environment variables. Removing the need to crating the TLS config
object and defining it with the `with_tls_config` method. In the same
way other OTLP libraries does (e.g. go lang).

Signed-off-by: José Guilherme Vanz <[email protected]>
@TommyCpp
Copy link
Contributor

👀 Will take a look today

@TommyCpp TommyCpp self-assigned this Jan 20, 2025
opentelemetry-otlp/CHANGELOG.md Outdated Show resolved Hide resolved
fn with_insecure(self) -> Self;
/// Set the certificate file to validate the OTLP server connection
/// This is only available when the `tls` feature is enabled.
fn with_certificate<T: Into<String>>(self, certificate: T) -> Self;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can gate this function under #[cfg(feature = "tls")]?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@TommyCpp TommyCpp removed their assignment Jan 21, 2025
jvanz added 2 commits January 22, 2025 17:05
Fix typo in the changelog.

Signed-off-by: José Guilherme Vanz <[email protected]>
Add missing TLS configuration directives.

Signed-off-by: José Guilherme Vanz <[email protected]>
@jvanz jvanz requested a review from TommyCpp January 22, 2025 20:10
@@ -36,6 +36,20 @@ pub const OTEL_EXPORTER_OTLP_METRICS_COMPRESSION: &str = "OTEL_EXPORTER_OTLP_MET
/// Example: `k1=v1,k2=v2`
/// Note: this is only supported for HTTP.
pub const OTEL_EXPORTER_OTLP_METRICS_HEADERS: &str = "OTEL_EXPORTER_OTLP_METRICS_HEADERS";
///
/// Certificate file to validate the OTLP server connection when sending metrics
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add period at the end of the comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support all configuration of otlp exporter
3 participants