Skip to content

Ai gateway observability/log token sentry - #74644

Open
alex-m-brown wants to merge 9 commits into
ai-gateway-observability/log-token-admin-pagefrom
ai-gateway-observability/log-token-sentry
Open

Ai gateway observability/log token sentry#74644
alex-m-brown wants to merge 9 commits into
ai-gateway-observability/log-token-admin-pagefrom
ai-gateway-observability/log-token-sentry

Conversation

@alex-m-brown

@alex-m-brown alex-m-brown commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

This PR sends Sentry the user log token instead of the raw user id.

A token is different for each destination, so you cannot match Sentry data against the data at another destination. A person who has the key can change a token back to a user id, but that person must use the admin page from PR #74619, and that page writes a record of each change.

dashboard/config/initializers/sentry.rb — the Warden after_fetch hook called set_user_id(user.id). The hook now gives user.id to Cdo::UserLogToken.derive, and gives only the result to set_user_token.

dashboard/engines/observability/lib/observability/sentry.rbset_user_id becomes set_user_token. If the token is nil or empty, the method does nothing. The engine does not know the key. It only moves the token.

README.md and AGENTS.md — a new section, "User identification", and two rules: do not send a user id to Sentry, and do not add a path that changes a token back to a user id.

Links

Testing story

Three new tests in sentry_test.rb cover set_user_token

Deployment notes

Cdo::UserLogToken.derive gives nil if we do not configure user_log_token_keys. set_user_token then does nothing, and the Sentry event has no user. Configure the key in each environment before the release. If the key is absent, the events stay correct, but they show no user.

Privacy and security

Sentry no longer receives user ids. This is the purpose of the change.

If the key is absent, the code sends no user. It does not send the user id instead.

Sentry can still receive an id through other paths. Sentry sends the contents of context and extra, the tags, and the OpenTelemetry attributes without a change, and there is no before_send filter on the Ruby side or the JavaScript side. This PR does not change these paths.

alex-m-brown and others added 4 commits August 13, 2026 10:41
Route Sentry's user context through UserLogToken at the single chokepoint
in the observability engine, so user ids never reach Sentry.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@alex-m-brown
alex-m-brown changed the base branch from staging to ai-gateway-observability/user-log-token-lib August 14, 2026 14:08
@alex-m-brown
alex-m-brown changed the base branch from ai-gateway-observability/user-log-token-lib to ai-gateway-observability/log-token-admin-page August 14, 2026 14:12
alex-m-brown and others added 2 commits August 14, 2026 10:13
Route Sentry's user context through UserLogToken at the single chokepoint
in the observability engine, so user ids never reach Sentry.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@alex-m-brown
alex-m-brown force-pushed the ai-gateway-observability/log-token-sentry branch from dd1aee7 to fd5b67d Compare August 14, 2026 14:13
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.

1 participant