github.com/thanos-io/thanos@v0.32.5/pkg/extprom/extprom.go (about) 1 // Copyright (c) The Thanos Authors. 2 // Licensed under the Apache License 2.0. 3 4 package extprom 5 6 import "github.com/prometheus/client_golang/prometheus" 7 8 // WrapRegistererWithPrefix is like prometheus.WrapRegistererWithPrefix but it passes nil straight through 9 // which allows nil check. 10 func WrapRegistererWithPrefix(prefix string, reg prometheus.Registerer) prometheus.Registerer { 11 if reg == nil { 12 return nil 13 } 14 return prometheus.WrapRegistererWithPrefix(prefix, reg) 15 } 16 17 // WrapRegistererWith is like prometheus.WrapRegistererWith but it passes nil straight through 18 // which allows nil check. 19 func WrapRegistererWith(labels prometheus.Labels, reg prometheus.Registerer) prometheus.Registerer { 20 if reg == nil { 21 return nil 22 } 23 return prometheus.WrapRegistererWith(labels, reg) 24 }