gitlab.com/gitlab-org/labkit@v1.21.0/metrics/handler_options.go (about) 1 package metrics 2 3 type handlerConfig struct { 4 labelValues map[string]string 5 } 6 7 // HandlerOption is used to pass options to the HandlerFactory instance. 8 type HandlerOption func(*handlerConfig) 9 10 func applyHandlerOptions(opts []HandlerOption) handlerConfig { 11 config := handlerConfig{} 12 for _, v := range opts { 13 v(&config) 14 } 15 16 return config 17 } 18 19 // WithLabelValues will configure labels values to apply to this handler. 20 func WithLabelValues(labelValues map[string]string) HandlerOption { 21 return func(config *handlerConfig) { 22 config.labelValues = labelValues 23 } 24 }