-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
google cloud structured logging with task context #22
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! 👍
@@ -0,0 +1,161 @@ | |||
import copy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to have a shared repo for logging. This file is already in 3 repos
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that does hurt a bit
we have this of course, would it make sense to add there?
https://github.com/Volumental/virga-python-client
see discussion https://volumental.slack.com/archives/C039C8G2924/p1679065996263339 about repo contents and name if you missed or forgot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think, we could use this repo. To me, it feels like the logger fits well there
the naming is so confusing 🫠
django_leek/cloud_logging.py
Outdated
|
||
|
||
@contextmanager | ||
def append_logger_context_namespace(logger: logging.Logger, namespace: str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, not here (but in fitapi)
I couldn't really decide between just copying this, or removing as much as possible (like all of the namespace stuff)
what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I could also argue for both. Let's keep it as is with the plan of moving logging to the repo you posted above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - looks nice 👌
django_leek/cloud_logging.py
Outdated
super(ImportContextFilter, self).__init__() | ||
self.import_logging_context_handler = import_logging_context_handler | ||
|
||
def filter(self, record): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the functions are typed. Would be nice to add it to the few ones missing it now as well.
use same logger as fitapi which logs as json with tenant name etc attached to each message
file is copied from here https://github.com/Volumental/fit-api/blob/master/backend/shoes/cloud_logging.py with very minor simplification
looks something like this when running locally
and gcp: