Skip to content

feat(attributes): add attribute transformations#465

Open
constantinius wants to merge 2 commits into
mainfrom
constantinius/feat/attributes/TET-2369-transformations
Open

feat(attributes): add attribute transformations#465
constantinius wants to merge 2 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 messaging attributes by s1gr1d in #469
  • Add url.same_origin (deprecated) and http.request.same_origin (replacement) attributes by Lms24 in #456
  • Add db.response.status_code by s1gr1d in #462

Other

  • (ai) Add granular cost attributes for cache and reasoning by vgrozdanic in #461

Internal Changes 🔧

  • (ci) Stop inheriting secrets for changelog-preview by tobias-wilfert in #463

🤖 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.

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.

3 participants