feat: instrumentation introspection - #294
Merged
Merged
Conversation
LucasAlvesSoares
marked this pull request as ready for review
August 31, 2026 14:38
jeanscherf
previously approved these changes
Aug 31, 2026
jeanscherf
left a comment
Member
There was a problem hiding this comment.
<weird-kitty-thumbs-up.jpg>
cassiofariasmachado
approved these changes
Aug 31, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Exposes two introspection functions so that modules and users can query the SDK's instrumentation state at runtime:
get_attached_adapters() -> list[Adapter]— returns the framework adapters attached viabootstrap(app)(e.g.[Adapter.STARLETTE]), exposed fromsap_cloud_sdk.core.runtime_contextget_instrumented_libraries() -> list[Library]— returns the libraries successfully patched byauto_instrument()(e.g.[Library.HTTPX, Library.SQLALCHEMY]), exposed fromsap_cloud_sdk.core.telemetryBoth return typed
StrEnummembers (Adapter,Library) so callers get autocomplete and refactor safety while plain-string comparisons still work. Both return an empty list before the corresponding setup call is made, and only include entries for things that were actually wired up (skipped libraries due to missing installs do not appear).Related Issue
Closes #<issue_number>
Type of Change
Please check the relevant option:
How to Test
bootstrap(app)then assertAdapter.STARLETTE in get_attached_adapters()auto_instrument()with an OTLP endpoint set, then assertLibrary.HTTPXand other installed libraries appear inget_instrumented_libraries()Checklist
Before submitting your PR, please review and check the following:
Additional Notes
Any future
FrameworkAdaptersubclass must implement thenameproperty returning anAdapterenum member — enforced as an abstract property on the base class. The pattern is demonstrated by_StarletteContextAdapter.get_instrumented_libraries()records only on a successful_instrument()call — import errors and missing-library skips are not recorded, so the list accurately reflects what is active at runtime. Bothrecord_attachedandrecord_instrumentedare idempotent.