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

Feature quiet unimportant errors #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion lib/telemetry_metrics_statsd.ex
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ defmodule TelemetryMetricsStatsd do
old_entry = {:udp, old_udp}

if Enum.find(udps, fn entry -> entry == old_entry end) do
Logger.error("Failed to publish metrics over UDP: #{inspect(reason)}")
maybe_log_failure(reason)
UDP.close(old_udp)
:ets.delete_object(pool_id, old_entry)

Expand Down Expand Up @@ -525,6 +525,15 @@ defmodule TelemetryMetricsStatsd do
:ok
end

# These functions are being added to quiet unimportant errors that we do not actually care about
# These errors are drawn from the Posix Error system and we need to refer to
# https://www.man7.org/linux/man-pages/man3/errno.3.html
#
# EAGAIN just means that the resource we tried to send to was unavailable temporarily. There's no action needed to
# resolve this and it makes up the vast majority of our error logs from this module
defp maybe_log_failure(:eagain), do: :ok
defp maybe_log_failure(reason), do: Logger.error("Failed to publish metrics over UDP: #{inspect(reason)}")

defp update_host(state, new_address) do
%{pool_id: pool_id, udp_config: %{port: port} = udp_config} = state
update_pool(pool_id, new_address, port)
Expand Down