Skip to content

opentelemetry-sdk: sketch of an OpAMP integration#4646

Open
xrmx wants to merge 4 commits intoopen-telemetry:mainfrom
xrmx:opamp-prototype-integration
Open

opentelemetry-sdk: sketch of an OpAMP integration#4646
xrmx wants to merge 4 commits intoopen-telemetry:mainfrom
xrmx:opamp-prototype-integration

Conversation

@xrmx
Copy link
Copy Markdown
Contributor

@xrmx xrmx commented Jun 19, 2025

Description

This is a basic integration for setting up OpAMP in the sdk configurator.

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

  • Test A

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

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 5, 2026

This PR has been automatically marked as stale because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 days of this comment.
If you're still working on this, please add a comment or push new commits.

@github-actions github-actions bot added the Stale label Mar 5, 2026
@xrmx xrmx removed the Stale label Mar 5, 2026
@github-actions
Copy link
Copy Markdown

This PR has been automatically marked as stale because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 days of this comment.
If you're still working on this, please add a comment or push new commits.

@xrmx xrmx force-pushed the opamp-prototype-integration branch from f2f49fd to 579da8c Compare March 20, 2026 11:20

# OpAMP is a system created to configure OpenTelemetry SDKs with a remote config.
# This is different than other init helpers because setting up OpAMP requires distro
# provided code as it's not strictly specified. We call OpAMP init before other code
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In my distro I initialize the OpAMP client after the sdk has been setup but can't exclude other scenarios

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we add this a SIG topic to get the execution order?

@xrmx xrmx marked this pull request as ready for review March 20, 2026 11:41
@xrmx xrmx requested a review from a team as a code owner March 20, 2026 11:41
@xrmx xrmx moved this to Reviewed PRs that need fixes in Python PR digest Mar 20, 2026
Copy link
Copy Markdown
Member

@pmcollins pmcollins left a comment

Choose a reason for hiding this comment

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

Thanks for doing this. Added a comment.

# the resource and instantiate an OpAMP agent.
# Since configuration is not specified every implementors may have its own.
# Refer to opentelemetry-opamp-client package on how to setup the OpAMP agent.
_, opamp_init_func = _import_config_components(
Copy link
Copy Markdown
Member

@pmcollins pmcollins Mar 20, 2026

Choose a reason for hiding this comment

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

Would it be better to read and handle the entry point directly here rather than use _import_config_components? (it throws an exception if there's no match).

# up the rest of the SDK.
try:
_init_opamp = _import_opamp()
_init_opamp(resource=resource)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is it possible for _init_opamp to raise a RuntimeError? If so, it could be slightly confusing as the logs would say no init function found instead of the actual error.
Also, is it possible for it to throw other types of exceptions? Would we want to catch more broadly to ensure we don't prevent the rest from initializing?

raise RuntimeError(f"{id_generator_name} is not an IdGenerator")


def _import_opamp() -> callable[[...], None]:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

callable is a builtin function, not a valid type, right?

I think this should be Callable[..., None] using collections.abc. You'll need to add it to the imports.

Suggested change
def _import_opamp() -> callable[[...], None]:
def _import_opamp() -> Callable[..., None]:


# OpAMP is a system created to configure OpenTelemetry SDKs with a remote config.
# This is different than other init helpers because setting up OpAMP requires distro
# provided code as it's not strictly specified. We call OpAMP init before other code
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we add this a SIG topic to get the execution order?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Reviewed PRs that need fixes

Development

Successfully merging this pull request may close these issues.

4 participants