From 3be7c67c2437de8da7512c214521463c4be2f709 Mon Sep 17 00:00:00 2001 From: Don Browne Date: Mon, 15 Jul 2024 11:38:49 +0100 Subject: [PATCH] Fix remediation/alert counter (#3892) The code was counting them against the eval status counter --- internal/engine/metrics.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/engine/metrics.go b/internal/engine/metrics.go index f26d65b82f..2e850807cc 100644 --- a/internal/engine/metrics.go +++ b/internal/engine/metrics.go @@ -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 { @@ -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)), )) } @@ -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)), )) }