ignore more startup errors
This commit is contained in:
parent
3495767b8d
commit
0056d35e9b
1 changed files with 21 additions and 10 deletions
|
|
@ -2,13 +2,13 @@ defmodule Towerops.HoneybadgerFilter do
|
|||
@moduledoc """
|
||||
Custom Honeybadger filter to exclude noisy errors during deployments.
|
||||
|
||||
Filters out os_mon supervisor errors (memsup, cpu_sup) that occur
|
||||
during normal node shutdown/restart.
|
||||
Filters out OTP supervisor/gen_server errors that occur during normal
|
||||
node shutdown/restart.
|
||||
"""
|
||||
|
||||
use Honeybadger.Filter.Mixin
|
||||
|
||||
# Supervisors/processes that generate errors during normal shutdown
|
||||
# Named supervisors/processes that generate errors during normal shutdown
|
||||
@ignored_registered_names [
|
||||
"memsup",
|
||||
"cpu_sup",
|
||||
|
|
@ -17,14 +17,25 @@ defmodule Towerops.HoneybadgerFilter do
|
|||
|
||||
@impl Honeybadger.Filter
|
||||
def filter_context(context) do
|
||||
# Check if this is an os_mon supervisor error
|
||||
registered_name = get_in(context, [:registered_name])
|
||||
cond do
|
||||
# Named process in our ignore list
|
||||
get_in(context, [:registered_name]) in @ignored_registered_names ->
|
||||
nil
|
||||
|
||||
if registered_name in @ignored_registered_names do
|
||||
# Return nil to filter out this error
|
||||
nil
|
||||
else
|
||||
super(context)
|
||||
# Anonymous gen_server shutdown errors (OTP domain, gen_server error_info)
|
||||
otp_gen_server_shutdown?(context) ->
|
||||
nil
|
||||
|
||||
true ->
|
||||
super(context)
|
||||
end
|
||||
end
|
||||
|
||||
# Detect anonymous gen_server termination during shutdown
|
||||
defp otp_gen_server_shutdown?(context) do
|
||||
domain = get_in(context, [:domain])
|
||||
mfa = get_in(context, [:mfa])
|
||||
|
||||
domain == ["otp"] and match?(["gen_server", "error_info", _], mfa)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue