mozilla / fx-private-relay

Keep your email safe from hackers and trackers. Make an email alias with 1 click, and keep your address to yourself.
https://relay.firefox.com
Other
1.44k stars 166 forks source link

Update tests for `STATSD_DEBUG=True` #4762

Closed jwhitlock closed 4 weeks ago

jwhitlock commented 4 weeks ago

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.