Skip to content

feature: add telemetry attribution module for SDK usage provenance#5661

Open
ryantanaka wants to merge 1 commit intoaws:masterfrom
ryantanaka:feat/telemetry-attribution
Open

feature: add telemetry attribution module for SDK usage provenance#5661
ryantanaka wants to merge 1 commit intoaws:masterfrom
ryantanaka:feat/telemetry-attribution

Conversation

@ryantanaka
Copy link

Issue #, if available:
N/A

Description of changes:

Adds a new telemetry/attribution.py module to sagemaker-core that provides a structured way to
attribute SDK usage to external integrations such as agent plugins.

Changes:

  • Added sagemaker/core/telemetry/attribution.py with an Attribution enum and set_attribution()
    function. Calling set_attribution(Attribution.SAGEMAKER_AGENT_PLUGIN) sets the SAGEMAKER_PYSDK_ CREATED_BY environment variable, which is picked up by the telemetry emitter and appended as x- createdBy in the telemetry request URL.
  • Updated telemetry_logging.py to import _CREATED_BY_ENV_VAR from attribution.py as the single
    source of truth for the environment variable name.
  • Re-exported Attribution and set_attribution from sagemaker.core for a clean public import path.
  • Added unit tests for the new module in tests/unit/telemetry/test_attribution.py.
  • Fixed a pre-existing test bug in test_telemetry_logging.py where feature codes [1, 2] were stale
    and should have been [11, 12] following the update in fix: Update telemetry constants to include MLOPS as well #5438.

Example Usage:

# other imports
from sagemaker.core import set_attribution, Attribution

set_attribution(Attribution.SAGEMAKER_AGENT_PLUGIN)

# subsequent PySDK code

@ryantanaka ryantanaka deployed to manual-approval March 20, 2026 23:40 — with GitHub Actions Active
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.

1 participant