From 18626a99c41d8c8b949c3b2e459ffa4c1fcc69e3 Mon Sep 17 00:00:00 2001 From: Bartlomiej Plotka Date: Fri, 29 Aug 2025 11:43:59 +0200 Subject: [PATCH] fix(rules.Manager): ensure non-nil context (#17103) Saw some panic on main due to lack of defaulting: https://github.com/prometheus/prometheus/actions/runs/17317373582/job/49162760911 Signed-off-by: bwplotka --- rules/manager.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rules/manager.go b/rules/manager.go index 2e3c6a7c45..d2fb0a7797 100644 --- a/rules/manager.go +++ b/rules/manager.go @@ -145,6 +145,10 @@ func NewManager(o *ManagerOptions) *Manager { default: panic(fmt.Errorf("unrecognized name validation scheme: %s", o.NameValidationScheme)) } + if o.Context == nil { + o.Context = context.Background() + } + if o.Metrics == nil { o.Metrics = NewGroupMetrics(o.Registerer) }