// Histogram tracks statistical distribution of a metric.
// This works the same as gauge for this client.
762063
func (c *expvarStatsClient) Histogram(name string, value float64, rate float64) {
	c.Gauge(name, value, rate)
}
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
}
423229
func (gh gaugeHistogram) With(labelValues ...string) metrics.Histogram {
	return gaugeHistogram{gh.g.With(labelValues...)}
}
474192
func (xs *xstats) Gauge(stat string, value float64, tags ...string) {
	if xs.s == nil {
		return
	}
	tags = append(tags, xs.tags...)
	xs.s.Gauge(xs.prefix+stat, value, tags...)
}
783085
func NewHistogram(id, ndv, nullCount int64, version uint64, tp *types.FieldType, bucketSize int, totColSize int64) *Histogram {
	return &Histogram{
		ID:                id,
		NDV:               ndv,
		NullCount:         nullCount,
		LastUpdateVersion: version,
		Tp:                tp,
		Bounds:            chunk.NewChunkWithCapacity([]*types.FieldType{tp}, 2*bucketSize),
		Buckets:           make([]Bucket, 0, bucketSize),
		TotColSize:        totColSize,
	}
}
132068
func (s *Store) Histograms() ghistogram.Histograms {
	histogramsSnapshot := make(ghistogram.Histograms)
	histogramsSnapshot.AddAll(s.histograms)
	return histogramsSnapshot
}
1315461
func (h *SimpleHistogram) With(labelValues ...string) metrics.Histogram {
	return &SimpleHistogram{
		lvs: h.lvs.With(labelValues...),
		avg: h.avg,
		n:   h.n,
	}
}
1202454
func (c *Client) Gauge(stat string, value int, rate float64) error {
	return c.send(stat, rate, "%d|g", value)
}
1218938
func (c *Client) Histogram(name string, value int) error {
	return c.send(name, 1, "%d|ms", value)
}
785283
func NewHistogram(name, help string, cutoffs []int64) *Histogram {
	labels := make([]string, len(cutoffs)+1)
	for i, v := range cutoffs {
		labels[i] = fmt.Sprintf("%d", v)
	}
	labels[len(labels)-1] = "inf"
	return NewGenericHistogram(name, help, cutoffs, labels, "Count", "Total")
}
465196
func (s *sender) Histogram(stat string, value float64, tags ...string) {
	s.RLock()
	m, ok := s.histograms[stat]
	s.RUnlock()
	keys, values := splitTags(tags)
	if !ok {
		s.Lock()
		if m, ok = s.histograms[stat]; !ok {
			m = prometheus.NewHistogramVec(
				prometheus.HistogramOpts{Name: stat, Help: stat},
				keys)
			prometheus.MustRegister(m)
			s.histograms[stat] = m
		}
		s.Unlock()
	}
	m.WithLabelValues(values...).Observe(value)
}
440324
func (f *Factory) Histogram(options metrics.HistogramOptions) metrics.Histogram {
	histogram := &histogram{
		histograms: make([]metrics.Histogram, len(f.factories)),
	}
	for i, factory := range f.factories {
		histogram.histograms[i] = factory.Histogram(options)
	}
	return histogram
}
192423
func (g *Graphite) NewHistogram(name string, buckets int) *Histogram {
	h := NewHistogram(g.prefix+name, buckets)
	g.mtx.Lock()
	g.histograms[g.prefix+name] = h
	g.mtx.Unlock()
	return h
}
619531
func (s *sender) Gauge(stat string, value float64, tags ...string) {
	s.c <- fmt.Sprintf("%s:%f|g%s\n", stat, value, t(tags))
}
651435
func (sb *StatsdBuffer) Gauge(stat string, value int64) error {
	sb.eventChannel <- &event.Gauge{Name: stat, Value: value}
	return nil
}
1084420
func RTHistogram(fn NewRollingHistogramFn) rrOptSetter {
	return func(r *RTMetrics) error {
		r.newHist = fn
		return nil
	}
}
1084810
func (h *Histo) Export() (JSONMetric, error) {
	val, err := h.Value.GobEncode()
	if err != nil {
		return JSONMetric{}, err
	}
	return JSONMetric{
		MetricKey: MetricKey{
			Name:       h.Name,
			Type:       "histogram",
			JoinedTags: strings.Join(h.Tags, ","),
		},
		Tags:  h.Tags,
		Value: val,
	}, nil
}