Skip to content

Commit

Permalink
Revert persistence rate limit error type (#2312) (#2315)
Browse files Browse the repository at this point in the history
* Correctly handle persistence rate limit error

* revert error type change

Co-authored-by: Yimin Chen <yimin.chen@live.com>
  • Loading branch information
Ardagan and yiminc committed Dec 20, 2021
1 parent baf3b94 commit f9c1eba
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
9 changes: 2 additions & 7 deletions common/persistence/persistenceMetricClients.go
Original file line number Diff line number Diff line change
Expand Up @@ -1322,12 +1322,7 @@ func (p *metricEmitter) updateErrorMetric(scope int, err error) {
p.metricClient.IncCounter(scope, metrics.PersistenceFailures)

default:
if err == ErrPersistenceLimitExceeded {
p.metricClient.IncCounter(scope, metrics.PersistenceErrBusyCounter)
p.metricClient.IncCounter(scope, metrics.PersistenceFailures)
} else {
p.logger.Error("Operation failed with internal error.", tag.Error(err), tag.MetricScope(scope))
p.metricClient.IncCounter(scope, metrics.PersistenceFailures)
}
p.logger.Error("Operation failed with internal error.", tag.Error(err), tag.MetricScope(scope))
p.metricClient.IncCounter(scope, metrics.PersistenceFailures)
}
}
2 changes: 1 addition & 1 deletion common/persistence/persistenceRateLimitedClients.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (

var (
// ErrPersistenceLimitExceeded is the error indicating QPS limit reached.
ErrPersistenceLimitExceeded = serviceerror.NewUnavailable("Persistence Max QPS Reached.")
ErrPersistenceLimitExceeded = serviceerror.NewResourceExhausted("Persistence Max QPS Reached.")
)

type (
Expand Down
9 changes: 2 additions & 7 deletions common/persistence/visibility/visiblity_manager_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,8 @@ func (m *visibilityManagerMetrics) updateErrorMetric(scope metrics.Scope, err er
case *serviceerror.NotFound:
scope.IncCounter(metrics.VisibilityPersistenceNotFound)
default:
if err == persistence.ErrPersistenceLimitExceeded {
scope.IncCounter(metrics.VisibilityPersistenceResourceExhausted)
scope.IncCounter(metrics.VisibilityPersistenceFailures)
} else {
m.logger.Error("Operation failed with an error.", tag.Error(err))
scope.IncCounter(metrics.VisibilityPersistenceFailures)
}
m.logger.Error("Operation failed with an error.", tag.Error(err))
scope.IncCounter(metrics.VisibilityPersistenceFailures)
}

return err
Expand Down

0 comments on commit f9c1eba

Please sign in to comment.