Skip to content

Conversation

@asm89
Copy link
Contributor

@asm89 asm89 commented Dec 5, 2025

This fixes two issues with the OTEL HTTP exporter:

  1. Runtime panic with async reqwest client

The opentelemetry_sdk BatchLogProcessor spawns a dedicated OS thread that uses futures_executor::block_on() rather than tokio's runtime. When the async reqwest client's timeout mechanism calls tokio::time::sleep(), it panics with "there is no reactor running, must be called from the context of a Tokio 1.x runtime".

The fix is to use reqwest::blocking::Client instead, which doesn't depend on tokio for timeouts. However, the blocking client creates its own internal tokio runtime during construction, which would panic if built from within an async context. We wrap the construction in tokio::task::block_in_place() to handle this.

  1. mTLS certificate handling

The HTTP client wasn't properly configured for mTLS, matching the fixes previously done for the model provider client:

  • Added .tls_built_in_root_certs(false) when using a custom CA certificate to ensure only our CA is trusted
  • Added .https_only(true) when using client identity
  • Added rustls-tls feature to ensure rustls is used (required for Identity::from_pem() to work correctly)

This fixes two issues with the OTEL HTTP exporter:

1. **Runtime panic with async reqwest client**

The `opentelemetry_sdk` `BatchLogProcessor` spawns a dedicated OS thread
that uses `futures_executor::block_on()` rather than tokio's runtime.
When the async reqwest client's timeout mechanism calls `tokio::time::sleep()`,
it panics with "there is no reactor running, must be called from the context
of a Tokio 1.x runtime".

The fix is to use `reqwest::blocking::Client` instead, which doesn't depend
on tokio for timeouts. However, the blocking client creates its own internal
tokio runtime during construction, which would panic if built from within an
async context. We wrap the construction in `tokio::task::block_in_place()`
to handle this.

2. **mTLS certificate handling**

The HTTP client wasn't properly configured for mTLS, matching the fixes
previously done for the model provider client:

- Added `.tls_built_in_root_certs(false)` when using a custom CA certificate
to ensure only our CA is trusted
- Added `.https_only(true)` when using client identity
- Added `rustls-tls` feature to ensure rustls is used (required for
`Identity::from_pem()` to work correctly)
@github-actions
Copy link

github-actions bot commented Dec 5, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@asm89
Copy link
Contributor Author

asm89 commented Dec 5, 2025

I have read the CLA Document and I hereby sign the CLA

@etraut-openai
Copy link
Collaborator

@codex review

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. Breezy!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Collaborator

@apanasenko-oai apanasenko-oai left a comment

Choose a reason for hiding this comment

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

Thanks!

@etraut-openai etraut-openai merged commit f521d29 into openai:main Dec 6, 2025
44 of 48 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants