From ff1f11d3ec8acba88f4cba10171550945f14d8d8 Mon Sep 17 00:00:00 2001 From: Kaushik Iska Date: Thu, 2 Jan 2025 12:06:00 -0600 Subject: [PATCH] Tag SSH connection failures as err:Net (#2406) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Philip Dubé --- flow/alerting/alerting.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/flow/alerting/alerting.go b/flow/alerting/alerting.go index fa1ebf21f..535f6276a 100644 --- a/flow/alerting/alerting.go +++ b/flow/alerting/alerting.go @@ -16,6 +16,7 @@ import ( "github.com/jackc/pgx/v5/pgconn" "github.com/jackc/pgx/v5/pgxpool" "go.temporal.io/sdk/log" + "golang.org/x/crypto/ssh" "github.com/PeerDB-io/peer-flow/generated/protos" "github.com/PeerDB-io/peer-flow/peerdbenv" @@ -456,6 +457,12 @@ func (a *Alerter) LogFlowError(ctx context.Context, flowName string, err error) if errors.As(err, &netErr) { tags = append(tags, string(shared.ErrTypeNet)) } + // For SSH connection errors, we currently tag them as "err:Net" + var sshErr *ssh.OpenChannelError + if errors.As(err, &sshErr) { + tags = append(tags, string(shared.ErrTypeNet)) + } + a.sendTelemetryMessage(ctx, logger, flowName, errorWithStack, telemetry.ERROR, tags...) }