Appsignal: ignore backend errors.
Some checks reported errors
continuous-integration/drone/push Build encountered an error

This commit is contained in:
Timothée Floure 2022-07-04 12:36:34 +02:00
parent 992ff7f5ef
commit b4eb4f524d
Signed by: tfloure
GPG key ID: 4502C902C00A1E12
4 changed files with 10 additions and 1 deletions

View file

@ -1,6 +1,8 @@
# 2022-07-?? - v0.4.2 # 2022-07-?? - v0.4.2
* Fix eventual crash on failed DRBD backend. * Fix eventual crash on failed DRBD backend.
* Appsignal: ignore errors on backends (failed PSQL backend currently generate
errors, and floods appsignal).
# 2022-06-13 - v0.4.1 # 2022-06-13 - v0.4.1

View file

@ -46,4 +46,5 @@ config :appsignal, :config,
otp_app: :ha_handler, otp_app: :ha_handler,
name: "ha-handler", name: "ha-handler",
push_api_key: "secret", push_api_key: "secret",
ignore_namespaces: ["pgsql", "drbd"],
env: config_env() env: config_env()

View file

@ -25,6 +25,9 @@ defmodule HAHandler.DRBD.Watcher do
@impl true @impl true
def init(opts) do def init(opts) do
# Configures this worker's jobs to report in the "drbd" namespace
Appsignal.Span.set_namespace(Appsignal.Tracer.root_span(), "drbd")
state = %{ state = %{
backend: nil, backend: nil,
last_reconnect: nil, last_reconnect: nil,
@ -46,7 +49,7 @@ defmodule HAHandler.DRBD.Watcher do
case connect(hostname, password) do case connect(hostname, password) do
{:ok, pid} -> {:ok, pid} ->
{:noreply, %{state | backend: pid}} {:noreply, %{state | backend: pid}}
{:error, err} -> {:error, _err} ->
# Nothing to do, as the next request will trigger the reconnect logic # Nothing to do, as the next request will trigger the reconnect logic
# (see :execute call). # (see :execute call).

View file

@ -8,6 +8,9 @@ defmodule HAHandler.PGSQL.Watcher do
@impl true @impl true
def init(opts) do def init(opts) do
# Configures this worker's jobs to report in the "pgsql" namespace
Appsignal.Span.set_namespace(Appsignal.Tracer.root_span(), "pgsql")
# Starts a Postgrex child but does not means the connection was # Starts a Postgrex child but does not means the connection was
# successful. # successful.
# TODO: set dbconnections backoff and connect hooks # TODO: set dbconnections backoff and connect hooks