Skip to content

Conversation

song-william
Copy link
Contributor

@song-william song-william commented Oct 13, 2023

Add user_id and team_id as additional log facets. Clean up the log tagging to be a bit more general.

Tested CustomJSONFormatter locally and saw that request_id, user_id, and team_id are in the logger extras.

Copy link
Contributor

@ian-scale ian-scale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me after you remove the commented lines!

Copy link
Contributor

@seanshi-scale seanshi-scale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm once the commented out code is removed (if we want to remove it)

USER_ID = 'user_id'

class LoggerTagManager:
_context_vars: Dict[LoggerTagKey, contextvars.ContextVar] = {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wonder if a defaultdict works here, although I guess it's probably more effort to get the code into a form where it works with defaultdict

@song-william song-william force-pushed the wsong/add-user-facets branch from c109c42 to eaa600f Compare October 13, 2023 01:26
@song-william song-william merged commit 4367b83 into main Oct 13, 2023
@song-william song-william deleted the wsong/add-user-facets branch October 13, 2023 03:19
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.

4 participants