Skip to content

feat: is_authenticated request logging + cleanup#7893

Merged
rjsparks merged 8 commits intoietf-tools:mainfrom
jennifer-richards:logging
Sep 3, 2024
Merged

feat: is_authenticated request logging + cleanup#7893
rjsparks merged 8 commits intoietf-tools:mainfrom
jennifer-richards:logging

Conversation

@jennifer-richards
Copy link
Member

The main goal here is adding the is_authenticated field to gunicorn logs for the datatracker. This is done by adding an X-Datatracker-Is-Authenticated header to the response. This is used by the gunicorn logs, then stripped out by nginx.

On dev systems, this header will be reported. We could strip it out there as well, but it seems harmless to me.

Also does a little logging cleanup

  • drops the X-Real-IP header and logging, which we're not using and is unlikely to be useful
  • changes the log label duration_ms to duration_s and logs seconds, both for nginx and gunicorn. Before this, nginx was logging seconds with an incorrect label. Gunicorn was logging ms correctly, but for simplicity this keeps them in the same units. (Both are fractional, so either 1.234 or 1.234000, will show up in the logs)

@rjsparks rjsparks merged commit b6f8ede into ietf-tools:main Sep 3, 2024
@codecov
Copy link

codecov bot commented Sep 3, 2024

Codecov Report

Attention: Patch coverage is 57.14286% with 6 lines in your changes missing coverage. Please review.

Project coverage is 88.77%. Comparing base (c7f6bde) to head (b1b8358).
Report is 56 commits behind head on main.

Files with missing lines Patch % Lines
ietf/middleware.py 66.66% 4 Missing ⚠️
ietf/utils/jsonlogger.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7893      +/-   ##
==========================================
- Coverage   88.78%   88.77%   -0.02%     
==========================================
  Files         296      304       +8     
  Lines       41320    41460     +140     
==========================================
+ Hits        36687    36807     +120     
- Misses       4633     4653      +20     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jennifer-richards jennifer-richards deleted the logging branch September 3, 2024 23:24
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants