mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-17 15:36:48 +00:00
fix: do not crash service on panic during rule eval (#7514)
This commit is contained in:
parent
8df77c9221
commit
b40ca4baf3
@ -315,6 +315,13 @@ func (g *PromRuleTask) CopyState(fromTask Task) error {
|
|||||||
|
|
||||||
// Eval runs a single evaluation cycle in which all rules are evaluated sequentially.
|
// Eval runs a single evaluation cycle in which all rules are evaluated sequentially.
|
||||||
func (g *PromRuleTask) Eval(ctx context.Context, ts time.Time) {
|
func (g *PromRuleTask) Eval(ctx context.Context, ts time.Time) {
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
zap.L().Error("panic during promql rule evaluation", zap.Any("panic", r))
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
zap.L().Info("promql rule task", zap.String("name", g.name), zap.Time("eval started at", ts))
|
zap.L().Info("promql rule task", zap.String("name", g.name), zap.Time("eval started at", ts))
|
||||||
|
|
||||||
maintenance, err := g.ruleDB.GetAllPlannedMaintenance(ctx)
|
maintenance, err := g.ruleDB.GetAllPlannedMaintenance(ctx)
|
||||||
|
|||||||
@ -297,6 +297,12 @@ func (g *RuleTask) CopyState(fromTask Task) error {
|
|||||||
// Eval runs a single evaluation cycle in which all rules are evaluated sequentially.
|
// Eval runs a single evaluation cycle in which all rules are evaluated sequentially.
|
||||||
func (g *RuleTask) Eval(ctx context.Context, ts time.Time) {
|
func (g *RuleTask) Eval(ctx context.Context, ts time.Time) {
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
zap.L().Error("panic during threshold rule evaluation", zap.Any("panic", r))
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
zap.L().Debug("rule task eval started", zap.String("name", g.name), zap.Time("start time", ts))
|
zap.L().Debug("rule task eval started", zap.String("name", g.name), zap.Time("start time", ts))
|
||||||
|
|
||||||
maintenance, err := g.ruleDB.GetAllPlannedMaintenance(ctx)
|
maintenance, err := g.ruleDB.GetAllPlannedMaintenance(ctx)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user