Add ErrorTrackerIgnorer to drop port_died, write_failed, epipe, and broken pipe errors that occur during K8s pod shutdown. Same patterns already filtered by HoneybadgerFilter and LoggerFilters.
24 lines
694 B
Elixir
24 lines
694 B
Elixir
defmodule Towerops.ErrorTrackerIgnorer do
|
|
@moduledoc """
|
|
Drops benign errors from ErrorTracker that occur during K8s pod shutdown.
|
|
|
|
Matches the same patterns as `Towerops.HoneybadgerFilter` and
|
|
`Towerops.LoggerFilters.drop_shutdown_errors/2`.
|
|
"""
|
|
|
|
@behaviour ErrorTracker.Ignorer
|
|
|
|
@impl true
|
|
def ignore?(%ErrorTracker.Error{reason: reason}, _context) do
|
|
shutdown_error?(reason)
|
|
end
|
|
|
|
defp shutdown_error?(reason) when is_binary(reason) do
|
|
String.contains?(reason, "port_died") or
|
|
String.contains?(reason, "write_failed") or
|
|
String.contains?(reason, "epipe") or
|
|
String.contains?(reason, "broken pipe")
|
|
end
|
|
|
|
defp shutdown_error?(_), do: false
|
|
end
|