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 <bwplotka@gmail.com>
This commit is contained in:
parent
172cde8af1
commit
18626a99c4
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue