Skip to content

feat(ai): Add support for AI token span data - #3250

Merged
colin-sentry merged 8 commits into
masterfrom
tokens
Mar 26, 2024
Merged

feat(ai): Add support for AI token span data#3250
colin-sentry merged 8 commits into
masterfrom
tokens

Conversation

@colin-sentry

@colin-sentrycolin-sentry commented Mar 11, 2024

Copy link
Copy Markdown
Contributor

Upstream in SDKs (getsentry/sentry-python#2791) we added strings like "ai.prompt_tokens.used"

This adds them as known data fields, otherwise they are removed as PII since most configurations consider any superstring of "token" to be a password.

Comment threadrelay-pii/src/regexes.rs Outdated

@olksdrolksdr 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.

Also, please, add tests for expected behaviour.

@iker-barriocanaliker-barriocanal 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.

As a side note, could you reword the PR description to align with Sentry's commit message guidelines? Thanks beforehand!

@olksdr

Copy link
Copy Markdown
Contributor

@colin-sentry are there any plans to follow up on this ?

@colin-sentrycolin-sentry changed the title Do not consider the word "tokens" as a passwordfeat(ai): Do not consider the word "tokens" as a passwordMar 25, 2024
@colin-sentry
colin-sentryforce-pushed the tokens branch 2 times, most recently from 2bcb443 to 5be051dCompareMarch 25, 2024 17:07
@colin-sentry

Copy link
Copy Markdown
ContributorAuthor

@olksdr I'm having a bit of trouble writing a test for this - the test included in this PR still passes if you revert the regex change.

@phacops

Copy link
Copy Markdown
Contributor

Do we need all the new fields on span data?

@colin-sentrycolin-sentry changed the title feat(ai): Do not consider the word "tokens" as a passwordfeat(ai): Add support for AI token metricsMar 26, 2024
@colin-sentrycolin-sentry changed the title feat(ai): Add support for AI token metricsfeat(ai): Add support for AI token span dataMar 26, 2024
@colin-sentry

Copy link
Copy Markdown
ContributorAuthor

Do we need all the new fields on span data?

Discussed, by adding them to span data we can avoid them being removed as PII

@colin-sentry
colin-sentry enabled auto-merge (squash) March 26, 2024 15:31
@colin-sentry
colin-sentry merged commit f924c15 into masterMar 26, 2024
@colin-sentry
colin-sentry deleted the tokens branch March 26, 2024 16:03
Sign up for freeto 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.

6 participants

@colin-sentry@olksdr@phacops@Dav1dde@jjbayer@iker-barriocanal