// Gauge implements metrics.Factory interface
331876
func (f *Factory) Gauge(options metrics.Options) metrics.Gauge {
	gauge := &gauge{
		gauges: make([]metrics.Gauge, len(f.factories)),
	}
	for i, factory := range f.factories {
		gauge.gauges[i] = factory.Gauge(options)
	}
	return gauge
}
1219378
func (g *Gauge) Metric() (*metricpb.Metric, error) {
	return &metricpb.Metric{
		Name:  g.Name,
		Tags:  g.Tags,
		Type:  metricpb.Type_Gauge,
		Value: &metricpb.Metric_Gauge{&metricpb.GaugeValue{Value: g.value}},
	}, nil
}
626965
func (p *prometheusProvider) NewGauge(name string) metrics.Gauge {
	return prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
		Namespace: p.namespace,
		Subsystem: p.subsystem,
		Name:      name,
		Help:      name,
	}, []string{})
}
160906
func (ms *MetricSystem) RegisterGaugeFunc(name string, f func() float64) {
	ms.gaugeFuncsMu.Lock()
	ms.gaugeFuncs[name] = f
	ms.gaugeFuncsMu.Unlock()
}
662210
func Gauge(metricName string, dimensions map[string]string, val int64) *datapoint.Datapoint {
	return datapoint.New(metricName, dimensions, datapoint.NewIntValue(val), datapoint.Gauge, time.Time{})
}
253445
func NewGaugeFunc(opts prometheus.GaugeOpts, function func() float64) prometheus.GaugeFunc {
	g := prometheus.NewGaugeFunc(opts, function)
	prometheus.MustRegister(g)
	return g
}
547997
func (f *LogFile) Measurement(name []byte) MeasurementElem {
	f.mu.RLock()
	defer f.mu.RUnlock()

	mm, ok := f.mms[string(name)]
	if !ok {
		return nil
	}

	return mm
}
1018900
func GetOrRegisterGauge(name string, r Registry) Gauge {
	if nil == r {
		r = DefaultRegistry
	}
	return r.GetOrRegister(name, NewGauge).(Gauge)
}
1001552
func (g *Gauge) Add(delta float64) {
	g.add(g.name, g.lvs, delta)
}
1249254
func (hg histogramGauge) With(labelValues ...string) metrics.Gauge {
	return histogramGauge{hg.h.With(labelValues...)}
}
973147
func (s *server) GetGauge(ctx context.Context, in *metricspb.GaugeRequest) (*metricspb.GaugeResponse, error) {
	s.mutex.RLock()
	defer s.mutex.RUnlock()

	if g, ok := s.gauges[in.Name]; ok {
		return &metricspb.GaugeResponse{Name: in.Name, Value: &metricspb.GaugeResponse_LongValue{LongValue: g.get()}}, nil
	}
	return nil, status.Errorf(codes.InvalidArgument, "gauge with name %s not found", in.Name)
}
790653
func (g *Gauge) Update(value int64) {
	g.gauge.Update(float64(value))
}
604704
func (m *MockClient) Gauge(name string, value float64, tags []string, rate float64) error {
	ret := m.ctrl.Call(m, "Gauge", name, value, tags, rate)
	ret0, _ := ret[0].(error)
	return ret0
}
393638
func (v *Gauge) Add(delta int64) {
	v.Counter.i.Add(delta)
}
580915
func (g *Gauge) Export() (JSONMetric, error) {
	var buf bytes.Buffer

	err := binary.Write(&buf, binary.LittleEndian, g.value)
	if err != nil {
		return JSONMetric{}, err
	}

	return JSONMetric{
		MetricKey: MetricKey{
			Name:       g.Name,
			Type:       "gauge",
			JoinedTags: strings.Join(g.Tags, ","),
		},
		Tags:  g.Tags,
		Value: buf.Bytes(),
	}, nil
}
572208
func (s *server) GetAllGauges(in *metricspb.EmptyMessage, stream metricspb.MetricsService_GetAllGaugesServer) error {
	s.mutex.RLock()
	defer s.mutex.RUnlock()

	for name, gauge := range s.gauges {
		if err := stream.Send(&metricspb.GaugeResponse{Name: name, Value: &metricspb.GaugeResponse_LongValue{LongValue: gauge.get()}}); err != nil {
			return err
		}
	}
	return nil
}
29099
func (g *Gauge) With(labelValues ...string) metrics.Gauge {
	return &Gauge{
		gv:  g.gv,
		lvs: g.lvs.With(labelValues...),
	}
}