Skip to content

Conversation

DylanRussell
Copy link
Contributor

Description

Add environment variables to allow ChannelCredentials and Session to be injected into OTLP exporters for auto instrumentation. See #4459 for more details..

Fixes # 4459

Type of change

Please delete options that are not relevant.

  • [x ] New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Unit tests

Does This PR Require a Contrib Repo Change?

  • Yes. - Link to PR:
  • [x ] No.

Checklist:

  • [ x] Followed the style guidelines of this project
  • Changelogs have been updated
  • [ x] Unit tests have been added
  • Documentation has been updated

@DylanRussell DylanRussell requested a review from a team as a code owner July 17, 2025 20:55
@xrmx xrmx moved this to Ready for review in @xrmx's Python PR digest Aug 18, 2025
@DylanRussell
Copy link
Contributor Author

DylanRussell commented Aug 25, 2025

I'm realizing there's 3 ways to do this in the exporters:

  1. Have HTTP AND GRPC specific env vars for metrics/logs/traces.
  2. Just one set of env vars for metrics/logs/traces that encompasses HTTP / GRPC, and we pass "HTTP" or "GRPC" to the entry point as an argument...
  3. Just one set of env vars, and the entry point provider has 2 entry points (one for HTTP one for GRPC), and the user must set the right entry point name in the env var depending on if they want HTTP or GRPC..

I'm going forward with #2 since that's simplest for both the user and the entry point provider. So the function signature that gets associated w/ the entry point should look like:

def credential_provider(otlp_exporter_type: Literal["HTTP", "GRPC"]) -> Union[requests.Session, grpc.ChannelCredentials]

Copy link
Contributor

@xrmx xrmx left a comment

Choose a reason for hiding this comment

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

Confused by the tox.ini changes but lgtm

@DylanRussell
Copy link
Contributor Author

Yeah I'm having issues w/ pytest in the venv created by tox..

It is supposedly installed by the test, but I get the following error Exception running subprocess [Errno 2] No such file or directory: 'pytest'

If I then run uv pip install pytest I then get failed with pytest is not allowed, use allowlist_externals to allow it.. If I then add pytest to allowlist_externals I can run the test..

@aabmass
Copy link
Member

aabmass commented Sep 9, 2025

Does it pass CI on Github if you just revert those files back to main?

@DylanRussell
Copy link
Contributor Author

yeah it works. reverted the change

@aabmass aabmass merged commit d6c0441 into open-telemetry:main Sep 9, 2025
468 of 469 checks passed
@github-project-automation github-project-automation bot moved this from Ready for review to Done in @xrmx's Python PR digest Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

7 participants