Skip to content

Add credentials environment variables to let ChannelCredentials and Session be injected #4689

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

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

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

from grpc import ChannelCredentials # pylint: disable=import-error
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be an issue if the SDK is running in an environment without grpcio installed? I know the operator auto-instrumentation layer for Python pre-installs the HTTP exporters and not the grpc exporters to avoid extension issues.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that's a good point ! I don't think we should require these modules (requests, grpc) for the SDK, so we have to use try/catch blocks on the imports.. I updated the PR.. Let me know what you think

]


def _load_credential_from_envvar(
Copy link
Member

Choose a reason for hiding this comment

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

Any thoughts @lzchen @xrmx @emdneto on moving the entry point loading into the actual respective exporters to avoid the defensive import checks? I don't think we've done it anywhere else, but IMO would clean up the conditional checks here and keep the SDK and exporter impls decoupled

Copy link
Member

Choose a reason for hiding this comment

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

I think it would be better altough we are doing this kind of defensive import for psutil in SDK for resources

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.

6 participants