fix: properly disable Plug.Telemetry logging for health checks

Set conn.private.log to false to prevent Plug.Telemetry from logging
health check requests in addition to phoenix_log and plug_skip_telemetry.
This commit is contained in:
Graham McIntire 2026-03-08 16:39:26 -05:00
parent 5a63adacef
commit fc63a4faaf
No known key found for this signature in database

View file

@ -19,9 +19,11 @@ defmodule ToweropsWeb.Plugs.FilterNoisyLogs do
def call(conn, _opts) do
if should_filter?(conn) do
# Setting phoenix_log to false prevents Phoenix.Logger from logging this request
# Also disable telemetry logging
# Setting log to false prevents Plug.Telemetry from logging
# Setting plug_skip_telemetry skips telemetry events entirely
conn
|> put_private(:phoenix_log, false)
|> put_private(:log, false)
|> put_private(:plug_skip_telemetry, true)
else
conn