Skip to content

Commit

Permalink
Improve safety of reporting diagnostic methods and adjust metric name
Browse files Browse the repository at this point in the history
  • Loading branch information
svsool committed Nov 6, 2024
1 parent 4120102 commit b565174
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/telemetry_metrics_statsd.ex
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ defmodule TelemetryMetricsStatsd do
case item do
{:udp_worker, udp_worker} ->
:telemetry.execute(
[:telemetry_metrics_statsd, :udp_worker_metrics],
[:telemetry_metrics_statsd, :udp_metrics],
%{
message_queue_len: message_queue_len(udp_worker),
},
Expand All @@ -611,6 +611,11 @@ defmodule TelemetryMetricsStatsd do
schedule_metrics_report(state.diagnostic_metrics_report_interval)

{:noreply, state}
rescue
_ ->
Logger.error("Failed to report diagnostic metrics")

{:noreply, state}
end

@impl true
Expand Down
2 changes: 1 addition & 1 deletion test/telemetry_metrics_statsd_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ defmodule TelemetryMetricsStatsdTest do
%{}, _}}

assert_receive {:telemetry_event,
{[:telemetry_metrics_statsd, :udp_worker_metrics], %{message_queue_len: 0},
{[:telemetry_metrics_statsd, :udp_metrics], %{message_queue_len: 0},
%{}, _}}
end
end
Expand Down

0 comments on commit b565174

Please sign in to comment.