Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

fix: incorrect alert description and summary for prom rules (#4190)

Srikanth Chekurifd9566d47127
diff --git a/pkg/query-service/rules/promRule.go b/pkg/query-service/rules/promRule.go
index 6d0cafa930..94ace4137b 100644
--- a/pkg/query-service/rules/promRule.go
+++ b/pkg/query-service/rules/promRule.go
@@ -3,7 +3,6 @@ package rules
import (
"context"
"fmt"
- "strconv"
"sync"
"time"
@@ -367,7 +366,10 @@ func (r *PromRule) Eval(ctx context.Context, ts time.Time, queriers *Queriers) (
l[lbl.Name] = lbl.Value
}
- tmplData := AlertTemplateData(l, valueFormatter.Format(smpl.F, r.Unit()), strconv.FormatFloat(r.targetVal(), 'f', 2, 64)+converter.UnitToName(r.ruleCondition.TargetUnit))
+ thresholdFormatter := formatter.FromUnit(r.ruleCondition.TargetUnit)
+ threshold := thresholdFormatter.Format(r.targetVal(), r.ruleCondition.TargetUnit)
+
+ tmplData := AlertTemplateData(l, valueFormatter.Format(smpl.F, r.Unit()), threshold)
// Inject some convenience variables that are easier to remember for users
// who are not used to Go's templating system.
defs := "{{$labels := .Labels}}{{$value := .Value}}{{$threshold := .Threshold}}"