func (mf *metricFamily) getGauge(name string, labelNames []string) *prometheus.GaugeVec {
	mf.mutex.Lock()
	defer mf.mutex.Unlock()
	gauge, ok := mf.gauges[name]
	if !ok {
		gauge = prometheus.NewGaugeVec(
			prometheus.GaugeOpts{
				Name:        name,
				ConstLabels: mf.defaultLabels,
			},
			labelNames,
		)
		mf.prometheusRegistry.MustRegister(gauge)
		mf.gauges[name] = gauge
	}
	return gauge
}
getGauge either gets a gauge, or makes a new one:
package prometheus
import (
	"sync"
	"github.com/prometheus/client_golang/prometheus"
)
type metricFamily struct {
	counters           map[string]*prometheus.CounterVec
	gauges             map[string]*prometheus.GaugeVec
	timings            map[string]*prometheus.SummaryVec
	defaultLabels      prometheus.Labels
	mutex              sync.Mutex
	prometheusRegistry *prometheus.Registry
	timingObjectives   map[float64]float64
}
func (r *Reporter) newMetricFamily() metricFamily {
	timingObjectives := make(map[float64]float64)
	for _, percentile := range r.options.Percentiles {
		if quantileThreshold, ok := quantileThresholds[percentile]; ok {
			timingObjectives[percentile] = quantileThreshold
		}
	}
	return metricFamily{
		counters:           make(map[string]*prometheus.CounterVec),
		gauges:             make(map[string]*prometheus.GaugeVec),
		timings:            make(map[string]*prometheus.SummaryVec),
		defaultLabels:      r.convertTags(r.options.DefaultTags),
		prometheusRegistry: r.prometheusRegistry,
		timingObjectives:   timingObjectives,
	}
}
func (mf *metricFamily) getCounter(name string, labelNames []string) *prometheus.CounterVec {
	mf.mutex.Lock()
	defer mf.mutex.Unlock()
	counter, ok := mf.counters[name]
	if !ok {
		counter = prometheus.NewCounterVec(
			prometheus.CounterOpts{
				Name:        name,
				ConstLabels: mf.defaultLabels,
			},
			labelNames,
		)
		mf.prometheusRegistry.MustRegister(counter)
		mf.counters[name] = counter
	}
	return counter
}