feat: add gen_ai.input.messages original length attribute#241
feat: add gen_ai.input.messages original length attribute#241obostjancic wants to merge 9 commits intomainfrom
Conversation
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Attributes
Other
Bug Fixes 🐛Attributes
Other
Internal Changes 🔧Attributes
Deps Dev
Repo
Other
Other
🤖 This preview updates automatically when you update the PR. |
Co-authored-by: Simon Hellmayr <shellmayr@users.noreply.github.com>
Co-authored-by: Simon Hellmayr <shellmayr@users.noreply.github.com>
| @@ -0,0 +1,10 @@ | |||
| { | |||
| "key": "sentry.sdk_meta.gen_ai.input.messages.original_length", | |||
There was a problem hiding this comment.
(Feel free to disregard, I basically just came across this and wanted to share a thought)
I don't wanna stir up too much bike shedding here but did we settle on this name yet?
As in: is sentry.sdk_meta the "namespace" we want to use for (I guess) annotating other, non-sentry, attributes? I'd like us to just take a moment here and think this through because this name is very long and nested. I don't have enough context around AI monitoring to popose a well thought through alternative but at least a bit shorter and less nested:
sentry.meta.gen_ai_input_messages.original_length
My primary concern here is the product showing nested keys in nested levels. So maybe we remove the . from the original attribute name to also indicate that this attribute describes the very attribute in its name?
(Nesting example)
There was a problem hiding this comment.
There was a problem hiding this comment.
I think ideally we/SDKs secure a namesapce for such information and possibly their own format/spec, then we hide the entire namespace in the UI by default and render it nicely.
| "brief": "The original length of gen_ai.input.messages before any truncation or modification. This refers to the amount of messages in the array, not the length of the message string(s).", | ||
| "type": "integer", | ||
| "pii": { | ||
| "key": "false" |
There was a problem hiding this comment.
Based on #228, I believe this should be pii: 'maybe', correct?

Adds sdk_meta attribute that is used to indicate how many messages sdk discarded before sending the span.
More context: https://www.notion.so/sentry/Gen-AI-Limits-SDK-changes-2ee8b10e4b5d80ebbefcfe70de7399da?source=copy_link#2ee8b10e4b5d80ed941ec2cec60fdb67