Skip to content

opentelemetry-sdk: pass exporter args from sdk configuration #4659

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

Merged

Conversation

xrmx
Copy link
Contributor

@xrmx xrmx commented Jun 26, 2025

Description

This permits to pass exporter specific arguments when initialized by the sdk passing a map using the exporter class as key and a map of arguments as value.
While at it also enable typechecking in the sdk.configuration module.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • tox -e py310-test-opentelemetry-sdk

Does This PR Require a Contrib Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

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

This permits to pass exporter specific arguments when initialized by
the sdk passing a map using the exporter class as key and a map of
arguments as value.
@xrmx xrmx requested a review from a team as a code owner June 26, 2025 14:16
@xrmx xrmx added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Jun 26, 2025
@jeremydvoss
Copy link
Contributor

I think this design seems to make sense with the existing code! The previous changes I made allow for Provider-level configuration like Samplers and ID Generators. But until now the only way to configure exporters in autoinstrumentation has been env vars. This would allow Distros (or rather, configurators) to override the configure method to pass args to exporters, which would be a huge improvement. I don't think this would cause any issues. However, as with all autoinstrumentation changes, I would love some time to test it before release.

@xrmx
Copy link
Contributor Author

xrmx commented Jun 30, 2025

I think this design seems to make sense with the existing code! The previous changes I made allow for Provider-level configuration like Samplers and ID Generators. But until now the only way to configure exporters in autoinstrumentation has been env vars. This would allow Distros (or rather, configurators) to override the configure method to pass args to exporters, which would be a huge improvement. I don't think this would cause any issues. However, as with all autoinstrumentation changes, I would love some time to test it before release.

The behavior is not changed by default, an empty dict will be passed to exporters as we're currently doing so I don't expect any breakage. The content of the options passed to exporters has been made per exporter class to be as narrow as possible and avoid unexpected params.

@xrmx xrmx requested a review from jeremydvoss July 9, 2025 07:24
Copy link
Contributor

@jeremydvoss jeremydvoss left a comment

Choose a reason for hiding this comment

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

Greatly expands distro customizability.

@xrmx xrmx enabled auto-merge (squash) July 10, 2025 07:09
@xrmx xrmx merged commit 53e61c8 into open-telemetry:main Jul 10, 2025
375 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants