gitlab.com/gitlab-org/labkit@v1.21.0/metrics/http_round_tripper/options.go (about)

     1  package http_round_tripper
     2  
     3  type Config struct {
     4  	labelValues map[string]string
     5  }
     6  
     7  // Option is used to pass options to the Factory instance.
     8  type Option func(*Config)
     9  
    10  func applyOptions(opts []Option) Config {
    11  	config := Config{}
    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 round tripper.
    20  func WithLabelValues(labelValues map[string]string) Option {
    21  	return func(config *Config) {
    22  		config.labelValues = labelValues
    23  	}
    24  }