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

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
* 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

View File

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

View File

@ -25,6 +25,9 @@ defmodule HAHandler.DRBD.Watcher do
@impl true
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 = %{
backend: nil,
last_reconnect: nil,
@ -46,7 +49,7 @@ defmodule HAHandler.DRBD.Watcher do
case connect(hostname, password) do
{:ok, pid} ->
{:noreply, %{state | backend: pid}}
{:error, err} ->
{:error, _err} ->
# Nothing to do, as the next request will trigger the reconnect logic
# (see :execute call).

View File

@ -8,6 +8,9 @@ defmodule HAHandler.PGSQL.Watcher do
@impl true
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
# successful.
# TODO: set dbconnections backoff and connect hooks