Skip to content

feat(attributes): add attribute transformations - #465

Merged
constantinius merged 3 commits into
mainfrom
constantinius/feat/attributes/TET-2369-transformations
Jul 16, 2026
Merged

feat(attributes): add attribute transformations#465
constantinius merged 3 commits into
mainfrom
constantinius/feat/attributes/TET-2369-transformations

Conversation

@constantinius

@constantinius constantinius commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add attribute transformation documents for deprecated attributes whose replacement values need reshaping
  • add deprecation._status: "transform" and deprecation.transformation references
  • document how to add attribute transformations
  • expose transformation references in generated JS and Python metadata

This replaces the previous migration-based approach from #454 and #455.

Contributes to TET-2369.
Closes TET-2586.

Testing

  • yarn test

@constantinius
constantinius requested review from a team, Lms24, cleptric, mjq and nsdeschenes as code owners July 7, 2026 10:34
@linear-code

linear-code Bot commented Jul 7, 2026

Copy link
Copy Markdown

TET-2369

TET-2586

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

Attributes

  • Add attribute transformations by constantinius in #465
  • Add stable app vitals attributes by buenaflor in #493
  • Deprecate sentry.frames.* attributes by buenaflor in #500
  • Add missing AI legacy aliases from Relay SpanData by vgrozdanic in #498

Internal Changes 🔧

  • (attrs) Backport attributes and normalizations from Relay by Dav1dde in #497
  • (codeowners) Assign telemetry-experience to gen_ai/ai attributes by vgrozdanic in #506
  • (release) Show version in workflow run title by constantinius in #504

🤖 This preview updates automatically when you update the PR.

Comment thread model/attributes/gen_ai/gen_ai__request__messages.json
@alexander-alderman-webb

Copy link
Copy Markdown
Contributor

The types set for gen_ai.request.messages and gen_ai.response.text are inconsistent in the SDKs.
You yourself have added the litellm integration that sets a list of objects for gen_ai.response.text.
How should the suggested transformations be implemented if the source attribute does not have a consistent type?

@constantinius

Copy link
Copy Markdown
Contributor Author

How should the suggested transformations be implemented if the source attribute does not have a consistent type?

This is true and indeed an issue. In the frontend, we have several paths to get the input/output messages, I will match them in Relay, but I think I should also mention them here in the sentry-conventions

@@ -0,0 +1,45 @@
{
"id": "gen_ai_request_messages_to_input_messages",

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.

Is the ID also what we expect the function name to be in Relay, by convention?

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.

No, this is just the ID we link to from the attribute where we want to apply the transformation.

Introduce transformation documents for deprecated attributes whose replacement values need to be reshaped rather than copied. The attribute schema now supports a transform deprecation status with a transformation reference, and generated metadata exposes that contract for downstream consumers like Relay.
@constantinius
constantinius force-pushed the constantinius/feat/attributes/TET-2369-transformations branch from 78ef8b7 to 1019ddc Compare July 9, 2026 11:01

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1019ddc. Configure here.

Document the common gen_ai request message shapes seen in the wild, including string content, array content, and preserved response metadata.
@constantinius

Copy link
Copy Markdown
Contributor Author

@alexander-alderman-webb
This now also includes the transformation from various output formats we encounter across the SDK integrations.

@alexander-alderman-webb

Copy link
Copy Markdown
Contributor

Well, that's not true 😅.
For example, the LangChain integration sets an array of arrays as gen_ai.response.text.

@constantinius

Copy link
Copy Markdown
Contributor Author

@alexander-alderman-webb

For example, the LangChain integration sets an array of arrays as gen_ai.response.text.

I can't confirm this. In the testing framework I get for Python/JS LangChain only strings or array of strings across all tests. Do you have a working example?

Also, at some point we have to stop chasing wrong implementations.

@loewenheim loewenheim left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. The extensive specification and examples are nice.

Resolve the generated attributes conflict after updating the attribute transformations branch with latest main. Regenerated outputs so CI's clean-working-tree check passes.
@constantinius
constantinius requested a review from a team as a code owner July 16, 2026 10:49
@constantinius
constantinius enabled auto-merge (squash) July 16, 2026 10:50
@constantinius
constantinius merged commit aa03b0d into main Jul 16, 2026
16 checks passed
@constantinius
constantinius deleted the constantinius/feat/attributes/TET-2369-transformations branch July 16, 2026 10:51
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.

4 participants