Skip to content
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

Add ability to log request ID to all output messages #3510

Merged
merged 5 commits into from
Mar 11, 2025

Conversation

leplatrem
Copy link
Contributor

@leplatrem leplatrem commented Mar 6, 2025

Unlike dictConfig(), Python fileConfig() does not load filters from ini files

Therefore we cannot do the following from our config file:

+[filters]
+keys = request_id
+
+[filter_request_id]
+class = dockerflow.logging.RequestIdLogFilter

 [handler_consoler]
 class = StreamHandler
 args = (sys.stderr,)
 level = NOTSET
 formatter = json
+filters = (request_id,)

We have to do it via code. This PR provides a default stream handler that will add the filter for us.

The config will have to be changed like this though:

 [handler_consoler]
-class = StreamHandler
+class = kinto.core.StreamHandlerWithRequestID

Ref mozilla/remote-settings#777

Note

We could have done it in mozilla/remote-settings#778 but makes more sense in kinto.core since we already have kinto.core.JSONFormatter

@leplatrem leplatrem merged commit a8eef8f into main Mar 11, 2025
17 checks passed
@leplatrem leplatrem deleted the set-request-id-dockerflow branch March 11, 2025 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants