From 273f3c2509c949434120cc8b33a400a1a11d07d9 Mon Sep 17 00:00:00 2001 From: Kaushik Iska Date: Thu, 2 Jan 2025 11:10:23 -0600 Subject: [PATCH 1/4] Tag SSH connection failures as err:Net --- flow/alerting/alerting.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/flow/alerting/alerting.go b/flow/alerting/alerting.go index fa1ebf21f..2bb0e83d7 100644 --- a/flow/alerting/alerting.go +++ b/flow/alerting/alerting.go @@ -456,6 +456,11 @@ 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" + if strings.Contains(errorWithStack, "ssh: rejected") || strings.Contains(errorWithStack, "dial error") { + tags = append(tags, "err:Net") + } + a.sendTelemetryMessage(ctx, logger, flowName, errorWithStack, telemetry.ERROR, tags...) } From 06e7bbea88085b329d2c3ca6d6b282958c1fb45f Mon Sep 17 00:00:00 2001 From: Kaushik Iska Date: Thu, 2 Jan 2025 11:56:27 -0600 Subject: [PATCH 2/4] Update flow/alerting/alerting.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Philip Dubé --- flow/alerting/alerting.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/flow/alerting/alerting.go b/flow/alerting/alerting.go index 2bb0e83d7..5e49574dd 100644 --- a/flow/alerting/alerting.go +++ b/flow/alerting/alerting.go @@ -457,7 +457,8 @@ func (a *Alerter) LogFlowError(ctx context.Context, flowName string, err error) tags = append(tags, string(shared.ErrTypeNet)) } // For SSH connection errors, we currently tag them as "err:Net" - if strings.Contains(errorWithStack, "ssh: rejected") || strings.Contains(errorWithStack, "dial error") { + var sshErr *ssh.OpenChannelError + if errors.Is(err, sshErr) { tags = append(tags, "err:Net") } From e42d8b2d2b267807dd74f8d005197fb39b5c3830 Mon Sep 17 00:00:00 2001 From: Kaushik Iska Date: Thu, 2 Jan 2025 11:57:00 -0600 Subject: [PATCH 3/4] fix issues --- flow/alerting/alerting.go | 1 + 1 file changed, 1 insertion(+) diff --git a/flow/alerting/alerting.go b/flow/alerting/alerting.go index 5e49574dd..18ac4c598 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" From fc8fc3763255171c46553fe3e571b216d70fa8fc Mon Sep 17 00:00:00 2001 From: Kaushik Iska Date: Thu, 2 Jan 2025 11:57:44 -0600 Subject: [PATCH 4/4] fix --- flow/alerting/alerting.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flow/alerting/alerting.go b/flow/alerting/alerting.go index 18ac4c598..535f6276a 100644 --- a/flow/alerting/alerting.go +++ b/flow/alerting/alerting.go @@ -459,8 +459,8 @@ func (a *Alerter) LogFlowError(ctx context.Context, flowName string, err error) } // For SSH connection errors, we currently tag them as "err:Net" var sshErr *ssh.OpenChannelError - if errors.Is(err, sshErr) { - tags = append(tags, "err:Net") + if errors.As(err, &sshErr) { + tags = append(tags, string(shared.ErrTypeNet)) } a.sendTelemetryMessage(ctx, logger, flowName, errorWithStack, telemetry.ERROR, tags...)