Skip to content

tracing user #170

Answered by maxcountryman
nicolasauler asked this question in Q&A
Jan 24, 2024 · 1 comments · 9 replies
Discussion options

You must be logged in to vote

You can take the AuthSession off the request and check if there's a user and then log the request if you like

Or you can use the fact that the user ID is now attached to the span of the axum-login middleware itself to see which user IDs are associated with which requests.

Which you choose will depend on what exactly you intend to do with those logs.

For instance, in the case of the latter you'll only "see" the user ID when there's something for trace to log; i.e. you've sent an info, etc event: at this point you should see the user ID as a field of the call span.

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@maxcountryman
Comment options

@maxcountryman
Comment options

@nicolasauler
Comment options

@maxcountryman
Comment options

Answer selected by nicolasauler
@nicolasauler
Comment options

@maxcountryman
Comment options

@nicolasauler
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants