feat: add auto_instrument to bootstrap - #263
Merged
Merged
Conversation
LucasAlvesSoares
marked this pull request as ready for review
August 7, 2026 21:16
…tstrap # Conflicts: # pyproject.toml # uv.lock
NicoleMGomes
reviewed
Aug 7, 2026
NicoleMGomes
approved these changes
Aug 7, 2026
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
Integrates
auto_instrumentintobootstrapso users no longer need two separate calls to initialise the SDK.Introduces a
TelemetryConfigdataclass as the first instance of a config-object pattern that will scale to futurebootstrapfeatures (e.g.AICoreConfig). For now it exposesdisable_tracesanddisable_batch.Adds a new
RuntimeContextSpanProcessorthat reads tenant and user identity from the SDK runtime context (populated bybootstrapproviders) and stamps them on every span. This prepares for a future migration whereauto_instrumentis removed andbootstrapbecomes the sole API surface.Renames the IAS context key
TENANT_ID→APP_TENANT_IDto better reflect its source (ias.app_tid) and distinguish it fromGLOBAL_TENANT_ID(ias.sap_gtid).Before:
After:
Related Issue
Closes #
Type of Change
Breaking Changes
TENANT_IDinsap_cloud_sdk.core.runtime_contextandsap_cloud_sdk.core.runtime_context.providersis renamed toAPP_TENANT_ID.Migration:
How to Test
bootstrap(app)without settingOTEL_EXPORTER_OTLP_ENDPOINT— verify a warning is logged and no error is raised.bootstrap(app)withOTEL_TRACES_EXPORTER=consoleset — verify spans appear in stdout.bootstrap(app, telemetry=TelemetryConfig(disable_traces=True))— verify no trace initialisation occurs.bootstrap(app, telemetry=TelemetryConfig(disable_batch=True))— verifySimpleSpanProcessoris used (spans flush synchronously).auto_instrumentdirectly still work unchanged.sap.tenancy.tenant_idanduser.idattributes set from the runtime context.Checklist
Additional Notes
TelemetryConfigis intentionally minimal (disable_traces,disable_batchonly). Fields likedisable_metricsandmiddlewaresare deferred to follow-up PRs. The dataclass pattern is designed to accommodate future config domains (e.g.bootstrap(app, telemetry=..., aicore=AICoreConfig(...))) without bloating thebootstrapsignature.The
RuntimeContextSpanProcessoruses a lazy import ofruntime_contextinsideon_startto avoid circular imports and to silently no-op on spans created beforebootstrapruns.