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 11 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
@@ -202,12 +245,43 @@ def _get_exporter_names(
]


def _init_exporter(
signal_type: Literal["traces", "metrics", "logs"],
exporter_args_map: Mapping[str, Any],
Copy link
Contributor

@xrmx xrmx Jul 21, 2025

Choose a reason for hiding this comment

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

exporter_args_map has been used consistently with the type ExporterArgsMap, I'll just call this exporter_args since this is already for a specific exporter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack good point, switched it out for ExporterArgsMap // exporter_args

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I meant to only change the name. The type was fine.

@@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Overwrite logging.config.fileConfig and logging.config.dictConfig to ensure
the OTLP `LogHandler` remains attached to the root logger. Fix a bug that
can cause a deadlock to occur over `logging._lock` in some cases ([#4636](https://github.com/open-telemetry/opentelemetry-python/pull/4636)).
- Add new environment variables to the SDK `OTEL_PYTHON_EXPORTER_OTLP_{METRICS/TRACES/LOGS}_CREDENTIAL_PROVIDER` that can be used to
inject a `requests.Session` or `grpc.ChannelCredentials` object into OTLP exporters created during auto instrumentation.
Copy link
Contributor

Choose a reason for hiding this comment

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

Just need to link this PR

Suggested change
inject a `requests.Session` or `grpc.ChannelCredentials` object into OTLP exporters created during auto instrumentation.
inject a `requests.Session` or `grpc.ChannelCredentials` object into OTLP exporters created during auto instrumentation ([#4689](https://github.com/open-telemetry/opentelemetry-python/pull/4689)).


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.

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.

4 participants