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

Enable reqwest and reqwest-blocking client creation with custom timeout #2584

Merged
merged 11 commits into from
Feb 3, 2025

Conversation

lalitb
Copy link
Member

@lalitb lalitb commented Feb 2, 2025

Fix: towards #2576

Changes

This PR defers the creation of http_client until the configured timeout is accessible. Previously, http_client was initialized within HttpConfig::default(), where the timeout value was unavailable.

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)

@lalitb lalitb requested a review from a team as a code owner February 2, 2025 08:23
Copy link

codecov bot commented Feb 2, 2025

Codecov Report

Attention: Patch coverage is 0% with 46 lines in your changes missing coverage. Please review.

Project coverage is 79.3%. Comparing base (7c9447f) to head (ed14fff).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
opentelemetry-otlp/src/exporter/http/mod.rs 0.0% 46 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main   #2584     +/-   ##
=======================================
- Coverage   79.5%   79.3%   -0.2%     
=======================================
  Files        118     118             
  Lines      22476   22487     +11     
=======================================
- Hits       17874   17844     -30     
- Misses      4602    4643     +41     

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

- `OTEL_EXPORTER_OTLP_TIMEOUT` env variable.
- `with_http().with_timeout()` API method of
`LogExporterBuilder` and `SpanExporterBuilder` and `MetricsExporterBuilder`.
- The default interval of 30sec is used if none is configured.
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch. It's indeed 10sec. Have update the changelog accordingly.

pub const OTEL_EXPORTER_OTLP_TIMEOUT_DEFAULT: u64 = 10;

.take()
.ok_or(crate::Error::NoHttpClient)?;

#[allow(unused_mut)] // TODO - clippy thinks mut is not needed, but it is
Copy link
Member

Choose a reason for hiding this comment

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

there is another issue about parsing env variables for timeout, I opened #2591 to track it separate from this PR

Copy link
Member

@cijothomas cijothomas left a comment

Choose a reason for hiding this comment

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

LGTM. For metrics we'd need a follow up as we need to use a per-request timeout override, to account for the the time taken for observable callbacks.

Also need to fix the changelog to state its 10 secs default, not 30.

@cijothomas cijothomas merged commit a81ad24 into open-telemetry:main Feb 3, 2025
20 of 21 checks passed
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.

2 participants