Skip to content

Commit

Permalink
Fix remediation/alert counter (#3892)
Browse files Browse the repository at this point in the history
The code was counting them against the eval status counter
  • Loading branch information
dmjb authored Jul 15, 2024
1 parent 23df4b3 commit 3be7c67
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/engine/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ func NewExecutorMetrics(meterFactory meters.MeterFactory) (*ExecutorMetrics, err
return nil, fmt.Errorf("failed to create alert counter: %w", err)
}

profileDuration, err := meter.Int64Histogram("eval.entity-eval-duration",
profileDuration, err := meter.Int64Histogram("eval.entity.duration",
metric.WithDescription("Time taken to evaluate all profiles against an entity"),
metric.WithUnit("milliseconds"))
if err != nil {
return nil, fmt.Errorf("failed to create profile histogram: %w", err)
}

entityDuration, err := meter.Int64Histogram("eval.profile-eval-duration",
entityDuration, err := meter.Int64Histogram("eval.profile.duration",
metric.WithDescription("Time taken to evaluate a single profile against an entity"),
metric.WithUnit("milliseconds"))
if err != nil {
Expand Down Expand Up @@ -99,7 +99,7 @@ func (e *ExecutorMetrics) CountRemediationStatus(
ctx context.Context,
status db.RemediationStatusTypes,
) {
e.evalCounter.Add(ctx, 1, metric.WithAttributes(
e.remediationCounter.Add(ctx, 1, metric.WithAttributes(
attribute.String("remediation_status_type", string(status)),
))
}
Expand All @@ -109,7 +109,7 @@ func (e *ExecutorMetrics) CountAlertStatus(
ctx context.Context,
status db.AlertStatusTypes,
) {
e.evalCounter.Add(ctx, 1, metric.WithAttributes(
e.alertCounter.Add(ctx, 1, metric.WithAttributes(
attribute.String("alert_status_type", string(status)),
))
}
Expand Down

0 comments on commit 3be7c67

Please sign in to comment.