Skip to content

Commit

Permalink
Add metric for duplicate request error (#6023)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaddoll authored May 15, 2024
1 parent 78d0141 commit f1a4bad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions common/metrics/defs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2020,6 +2020,7 @@ const (
PersistenceErrExecutionAlreadyStartedCounter
PersistenceErrDomainAlreadyExistsCounter
PersistenceErrBadRequestCounter
PersistenceErrDuplicateRequestCounter
PersistenceErrDBUnavailableCounter
PersistenceSampledCounter
PersistenceEmptyResponseCounter
Expand All @@ -2039,6 +2040,7 @@ const (
PersistenceErrExecutionAlreadyStartedCounterPerDomain
PersistenceErrDomainAlreadyExistsCounterPerDomain
PersistenceErrBadRequestCounterPerDomain
PersistenceErrDuplicateRequestCounterPerDomain
PersistenceErrDBUnavailableCounterPerDomain
PersistenceSampledCounterPerDomain
PersistenceEmptyResponseCounterPerDomain
Expand Down Expand Up @@ -2642,6 +2644,7 @@ var MetricDefs = map[ServiceIdx]map[int]metricDefinition{
PersistenceErrExecutionAlreadyStartedCounter: {metricName: "persistence_errors_execution_already_started", metricType: Counter},
PersistenceErrDomainAlreadyExistsCounter: {metricName: "persistence_errors_domain_already_exists", metricType: Counter},
PersistenceErrBadRequestCounter: {metricName: "persistence_errors_bad_request", metricType: Counter},
PersistenceErrDuplicateRequestCounter: {metricName: "persistence_errors_duplicate_request", metricType: Counter},
PersistenceErrDBUnavailableCounter: {metricName: "persistence_errors_db_unavailable", metricType: Counter},
PersistenceSampledCounter: {metricName: "persistence_sampled", metricType: Counter},
PersistenceEmptyResponseCounter: {metricName: "persistence_empty_response", metricType: Counter},
Expand All @@ -2660,6 +2663,7 @@ var MetricDefs = map[ServiceIdx]map[int]metricDefinition{
PersistenceErrExecutionAlreadyStartedCounterPerDomain: {metricName: "persistence_errors_execution_already_started_per_domain", metricRollupName: "persistence_errors_execution_already_started", metricType: Counter},
PersistenceErrDomainAlreadyExistsCounterPerDomain: {metricName: "persistence_errors_domain_already_exists_per_domain", metricRollupName: "persistence_errors_domain_already_exists", metricType: Counter},
PersistenceErrBadRequestCounterPerDomain: {metricName: "persistence_errors_bad_request_per_domain", metricRollupName: "persistence_errors_bad_request", metricType: Counter},
PersistenceErrDuplicateRequestCounterPerDomain: {metricName: "persistence_errors_duplicate_request_per_domain", metricRollupName: "persistence_errors_duplicate_request", metricType: Counter},
PersistenceErrDBUnavailableCounterPerDomain: {metricName: "persistence_errors_db_unavailable_per_domain", metricRollupName: "persistence_errors_db_unavailable", metricType: Counter},
PersistenceSampledCounterPerDomain: {metricName: "persistence_sampled_per_domain", metricRollupName: "persistence_sampled", metricType: Counter},
PersistenceEmptyResponseCounterPerDomain: {metricName: "persistence_empty_response_per_domain", metricRollupName: "persistence_empty_response", metricType: Counter},
Expand Down
4 changes: 4 additions & 0 deletions common/persistence/wrappers/metered/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ func (p *base) updateErrorMetricPerDomain(scope int, err error, scopeWithDomainT
scopeWithDomainTag.IncCounter(metrics.PersistenceErrShardOwnershipLostCounterPerDomain)
case *types.EntityNotExistsError:
scopeWithDomainTag.IncCounter(metrics.PersistenceErrEntityNotExistsCounterPerDomain)
case *persistence.DuplicateRequestError:
scopeWithDomainTag.IncCounter(metrics.PersistenceErrDuplicateRequestCounterPerDomain)
case *persistence.TimeoutError:
scopeWithDomainTag.IncCounter(metrics.PersistenceErrTimeoutCounterPerDomain)
scopeWithDomainTag.IncCounter(metrics.PersistenceFailuresPerDomain)
Expand Down Expand Up @@ -93,6 +95,8 @@ func (p *base) updateErrorMetric(scope int, err error, metricsScope metrics.Scop
metricsScope.IncCounter(metrics.PersistenceErrShardOwnershipLostCounter)
case *types.EntityNotExistsError:
metricsScope.IncCounter(metrics.PersistenceErrEntityNotExistsCounter)
case *persistence.DuplicateRequestError:
metricsScope.IncCounter(metrics.PersistenceErrDuplicateRequestCounter)
case *persistence.TimeoutError:
metricsScope.IncCounter(metrics.PersistenceErrTimeoutCounter)
metricsScope.IncCounter(metrics.PersistenceFailures)
Expand Down

0 comments on commit f1a4bad

Please sign in to comment.