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

Update tests for STATSD_DEBUG=True #4762

Merged
merged 1 commit into from
Jun 5, 2024
Merged

Update tests for STATSD_DEBUG=True #4762

merged 1 commit into from
Jun 5, 2024

Conversation

jwhitlock
Copy link
Member

When DJANGO_STATSD_ENABLED=True and STATSD_DEBUG=True, log messages like these are emitted:

{"Timestamp": 1717537908384410880, "Type": "markus", "Logger": "fx-private-relay", "Hostname": "jwhitlock-MB-M2.lan", "EnvVersion": "2.0", "Severity": 6, "Pid": 66599, "Fields": {"rid": null, "msg": "METRICS|2024-06-04 21:51:48|timing|fx.private.relay.response|55.711984634399414|#status:200,view:<static_file>,method:GET"}}
{"Timestamp": 1717537908517943040, "Type": "markus", "Logger": "fx-private-relay", "Hostname": "jwhitlock-MB-M2.lan", "EnvVersion": "2.0", "Severity": 6, "Pid": 66599, "Fields": {"rid": null, "msg": "METRICS|2024-06-04 21:51:48|timing|fx.private.relay.response|82.79109001159668|#status:200,view:<static_file>,method:GET"}}

The second message has details about the response timing metric:

METRICS|2024-06-04 21:51:48|timing|fx.private.relay.response|82.79109001159668|#status:200,view:<static_file>,method:GET

This can be useful for local debugging or understanding metrics. It can also be very noisy, and break tests that do not expect them. This PR updates the some tests to filter out the metrics logs.

Add omit_markus_logs helper to filter out markus records when
STATSD_DEBUG=True.
Copy link
Member Author

@jwhitlock jwhitlock left a comment

Choose a reason for hiding this comment

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

No production code, so self-reviewing.

@jwhitlock jwhitlock merged commit dfdf3cd into main Jun 5, 2024
29 checks passed
@jwhitlock jwhitlock deleted the allow-statsd-debug branch June 5, 2024 18:43
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.

1 participant