mirror of
https://github.com/block/buzz.git
synced 2026-11-11 20:01:09 +00:00
Record why relay connections close and quiet close warnings (#9245)
Since bb-public prod moved to `RUST_LOG=error,buzz_relay=info`, two connection-close warnings send about 1.9M lines a day to Datadog. This moves that information to the access log and a metric. - **`close_reason` on the access `close` line.** The first reason recorded wins. When the server has already decided to close (shutdown, a policy disconnect, or a cancellation), the reader defers to that decision, so a peer's reply to the server's Close is never logged as the cause. - Values: `auth_timeout`, `auth_failed` (an AUTH rejected and closed immediately, or a timeout after a rejected AUTH), `missed_pongs`, `client_closed`, `socket_error`, `frame_too_large`, `control_channel_full`, `shutdown`, `server_closed`, `refused` for connections refused before they were served, and `handler_dropped` for a handler dropped before normal cleanup. - A community disconnect logs its own value: `community_archived`, `community_deleted`, `auth_policy_upgraded`, `authorization_denied`, `access_revoked` or `removed`. - **The "NIP-42 auth timeout" and "3 missed pongs" warnings are now `debug!`**, with the same text and fields. - **New counter `buzz_ws_missed_pong_disconnects_total`**, next to `buzz_ws_auth_timeouts_total`. A heartbeat tick that races a close already decided is not counted. Timeouts, ping cadence, the frames sent and when connections close are unchanged. The new infra-free tests are added to the `test-unit` selection and `scripts/run-tests.sh`. --------- Signed-off-by: Will Pfleger <wpfleger@block.xyz> Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
This commit is contained in:
@@ -326,6 +326,11 @@ run_unit_tests() {
|
||||
api::bridge::postgres_tests::moderation_read_audit_query_bearing_nip98_event_verifies \
|
||||
api::bridge::postgres_tests::moderation_read_restricted_no_query_still_verifies \
|
||||
connection::tests::aborting_lifecycle_owner_is_drop_safe \
|
||||
connection::tests::missed_pongs_close_with_their_reason_and_count \
|
||||
connection::tests::client_reply_to_a_jittered_restart_closes_as_shutdown \
|
||||
connection::tests::client_close_racing_a_policy_disconnect_keeps_the_policy_reason \
|
||||
connection::tests::server_close_reason_ranks_shutdown_policy_then_cancellation \
|
||||
connection::tests::auth_timeout_after_a_rejected_auth_closes_as_auth_failed \
|
||||
connection::tests::shutdown_terminalizes_auth_stalled_on_database_before_late_success \
|
||||
connection::terminal_close_delivery_tests::upgrade_would_deny_line_without_auth_logs_absent_at_close \
|
||||
handlers::event::tests::observer_owner_cache_is_scoped_to_community \
|
||||
|
||||
Reference in New Issue
Block a user