chore(appsec): remove internal _dd.appsec.usr.id and _dd.appsec.usr.login tags - #19852
chore(appsec): remove internal _dd.appsec.usr.id and _dd.appsec.usr.login tags#19852florentinl wants to merge 2 commits into
Conversation
…ogin tags
These internal tags were mandated by the Automated user lifecycle
tracking RFC for accuracy analysis of automated user ID collection
(SDK vs auto-instrumentation). Outside of anonymization mode they are
always a verbatim duplicate of usr.id (or the public
appsec.events.users.{login,signup}.*.usr.id event tags), and the
remaining SDK+auto accuracy signal can be derived from
_dd.appsec.user.collection_mode together with usr.id.
Remove the USER_LOGIN_USERID / USER_LOGIN_USERNAME constants, all
write sites, and the now-dead conditionals and local variables that
only existed to populate them. The public event tags and usr.id are
unaffected.
Codeowners resolved asResolved from the full PR diff against |
Dependency direction analysis
|
|
Circular import analysis
|
BenchmarksBenchmark execution time: 2026-08-25 14:40:57 Comparing candidate commit 1119f21 in PR branch Found 0 performance improvements and 2 performance regressions! Performance is the same for 82 metrics, 0 unstable metrics.
|
Proposes retiring the two internal write-only tags introduced by the Automated user lifecycle tracking RFC. Documents the motivation (redundancy with usr.id and the public appsec.events.* event tags in all collection modes) and the backend derivation path from collection_mode.
Description
Removes the internal
_dd.appsec.usr.idand_dd.appsec.usr.loginspan tags, along with theUSER_LOGIN_USERID/USER_LOGIN_USERNAMEconstants and the now-dead conditionals / locals that only existed to populate them.Context
These tags were introduced by the Automated user lifecycle tracking RFC for accuracy analysis of automated user ID collection — i.e. comparing the SDK-provided
usr.idagainst the auto-instrumented value. An audit of every write/read site shows:_dd.appsec.usr.idis always a verbatim duplicate ofusr.id(both derived from the sameuser_idvariable after the same_maybe_hashstep). It carries no additional information for pure-auto customers.appsec.events.users.login.{success,failure}.usr.loginandappsec.events.users.signup.usr.login.usr.id(set viaset_user) and, for login-failure / signup / SDK-success events, by the public event tagsappsec.events.users.{login,signup}.*.usr.id.usr.idis raw and_dd.appsec.usr.idis hashed) can be derived from_dd.appsec.user.collection_modetogether withusr.id.The tracer never reads these tags; they are write-only. This is a behavior change for the AppSec backend's accuracy-analysis pipeline, which is why this opens as a draft — backend sign-off is required before merging.
What is removed
ddtrace/appsec/_constants.py—USER_LOGIN_USERID/USER_LOGIN_USERNAMEconstant definitions.ddtrace/appsec/_trace_utils.py— 5 write sites + 4 collapsingif … != SDKconditionals.ddtrace/appsec/track_user_sdk.py— 3 write sites.ddtrace/appsec/_contrib/django/__init__.py— 4 write sites + the deadhash_loginlocal in the ANON auth branch.What is preserved (unchanged)
usr.id(set viaset_user).appsec.events.users.login.{success,failure}.usr.{login,id},appsec.events.users.signup.usr.{login,id}._dd.appsec.user.collection_mode,_dd.appsec.events.*.auto.mode,_dd.appsec.events.*.sdk,manual.keep, and all libddwaf addresses.Testing
python3 -m py_compileon all modified files.scripts/lint ruff-fix+scripts/lint format_checkpass on the changed files.usr.idand the public event tags remain and continue to validate the user-identity data path.TODO before merging: run the relevant AppSec test suites via the
run-testsskill (django appsec, contrib appsec login/signup events) to confirm no regressions.Risks
_dd.appsec.usr.id/_dd.appsec.usr.loginspecifically (rather thanusr.idor the public event tags) to populate user-identity fields or run accuracy comparisons. If so, removing them is a breaking change for that pipeline. Requires sign-off from the ASM Respond/Monitor backend team.usr.id,usr.login, and theappsec.events.*tags are untouched).Additional Notes
changelog/no-changelog(removal of internal_dd.*tags; no customer-facing API change).