From e27682e3c82adefdc094abdc9c1914630cabe38e Mon Sep 17 00:00:00 2001 From: gammazero Date: Sat, 23 Sep 2023 20:09:43 -0700 Subject: [PATCH 1/2] Decrement before increment error count when changing error type --- .github/workflows/publish-ecr.yml | 1 + telemetry.go | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish-ecr.yml b/.github/workflows/publish-ecr.yml index 645537b..dac308d 100644 --- a/.github/workflows/publish-ecr.yml +++ b/.github/workflows/publish-ecr.yml @@ -7,6 +7,7 @@ on: push: branches: - main + - fix-error-count jobs: publisher: diff --git a/telemetry.go b/telemetry.go index d62a97d..1b33586 100644 --- a/telemetry.go +++ b/telemetry.go @@ -98,15 +98,22 @@ func (tel *Telemetry) run(ctx context.Context, updates <-chan dtrack.DistanceUpd for update := range updates { if update.Err != nil { log.Infow("Error getting distance", "provider", update.ID, "err", update.Err) - if _, ok := errored[update.ID]; !ok { - tel.metrics.NotifyProviderErrored(ctx, update.Err) + if prevErr, ok := errored[update.ID]; ok { + if prevErr.Error() != update.Err.Error() { + tel.metrics.NotifyProviderErrorCleared(ctx, prevErr) + errored[update.ID] = update.Err + tel.metrics.NotifyProviderErrored(ctx, update.Err) + log.Infow("Provider error updated", "provider", update.ID, "totalErroring", len(errored)) + } + } else { errored[update.ID] = update.Err + tel.metrics.NotifyProviderErrored(ctx, update.Err) log.Infow("Provider marked as erroring", "provider", update.ID, "totalErroring", len(errored)) - _, ok := rateMap[update.ID] - if ok { - delete(rateMap, update.ID) - tel.updateIngestRates(rateMap) - } + } + prevLen := len(rateMap) + delete(rateMap, update.ID) + if len(rateMap) != prevLen { + tel.updateIngestRates(rateMap) } distSum = tel.removeProviderFromDistBucket(ctx, update.ID, distSum) } else { From 9bdb026b3f454d6ffe1831cdad1c6ae56360970e Mon Sep 17 00:00:00 2001 From: gammazero Date: Mon, 25 Sep 2023 07:52:58 -0700 Subject: [PATCH 2/2] new version --- .github/workflows/publish-ecr.yml | 1 - version.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/publish-ecr.yml b/.github/workflows/publish-ecr.yml index dac308d..645537b 100644 --- a/.github/workflows/publish-ecr.yml +++ b/.github/workflows/publish-ecr.yml @@ -7,7 +7,6 @@ on: push: branches: - main - - fix-error-count jobs: publisher: diff --git a/version.json b/version.json index 4f0adde..edc249c 100644 --- a/version.json +++ b/version.json @@ -1,3 +1,3 @@ { - "version": "v0.0.3" + "version": "v0.0.4" }