Repository navigation
feat(dd_span_tagger): emit litellm.user_email span tag for JWT-authenticated requests - #34939
Merged
yassin-berriai merged 2 commits intoSep 15, 2026
Merged
Conversation
…ticated requests Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
Greptile SummaryAdds authenticated user email tagging to active Datadog request spans.
Confidence Score: 5/5The PR appears safe to merge with no actionable defects identified. The optional authenticated email is forwarded through the existing span-tag helper only when populated, and the tests cover both branches without weakening existing coverage.
|
| Filename | Overview |
|---|---|
| litellm/proxy/dd_span_tagger.py | Adds best-effort user-email span tagging while preserving existing behavior when no email is available. |
| tests/test_litellm/proxy/test_common_request_processing.py | Adds focused mocked tests covering email-tag emission and omission. |
Reviews (1): Last reviewed commit: "feat(dd_span_tagger): emit litellm_user_..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…stency Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
yassin-berriai
approved these changes
Sep 15, 2026
Merged
3 of 5 tasks
mateo-berri
added a commit
to mayank-affirm/litellm
that referenced
this pull request
Sep 29, 2026
Rebuilds the branch on current main so the PR diff is only the Mantle overflow mapping and its test. Drops the stale litellm_internal_staging drift (BerriAI#37762, BerriAI#40993, BerriAI#34939) the branch had picked up.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR
Problem this solves:
DDSpanTagger.tag_request()only tagged key alias, key hash, modelHow it solves it:
litellm.user_emailwhen the auth object has oneuser_email_jwt_field@litellm.user_email:"user@example.com"in DatadogRelevant issues
Linear ticket
Resolves LIT-4880
Pre-Submission checklist
@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Live proxy on
localhost:4000, JWT auth enabled withuser_email_jwt_field: upn, real Anthropic calls (spend recorded, ~$0.000044 each), and ddtrace pointed at a local trace-agent stand-in on:8126that decodes the msgpack payload and prints the span tags the Datadog backend would receiveProxy launched with:
Relevant config:
Request signed by the local IdP,
upnclaim set touser@example.com:Before, at
daf22ec871(parent of the first commit; no user tag, so a JWT caller has nothing to filter APM on):After, at
819faa01c3:Type
🆕 New Feature
Changes
DDSpanTagger.tag_request()gains one tag:UserAPIKeyAuth.user_emailis already populated on the JWT path fromget_user_email(the claim named bylitellm_jwtauth.user_email_jwt_field), and on the virtual-key path from the user row, so no plumbing was needed; the tag is simply absent when the authenticated identity has no emailThe tag name is dotted to match the neighboring
litellm.key_alias/litellm.requested_modeltags; an earlier commit on this branch usedlitellm_user_emailand was renamed for consistencyFinal Attestation
Link to Devin session: https://app.devin.ai/sessions/447287f0f7514672a528545ea1508abd