// FillPrometheusMetric fills the appropriate metric fields. func (h *Histogram) FillPrometheusMetric(promMetric *prometheusgo.MetricFamily) { // TODO(mjibson): change to a Histogram once bucket counts are reasonable sum := &prometheusgo.Summary{} h.mu.Lock() maybeTick(h) merged := h.windowed.Merge() for _, b := range merged.CumulativeDistribution() { sum.Quantile = append(sum.Quantile, &prometheusgo.Quantile{ Quantile: proto.Float64(b.Quantile), Value: proto.Float64(float64(b.ValueAt)), }) } sum.SampleCount = proto.Uint64(uint64(merged.TotalCount())) h.mu.Unlock() promMetric.Type = prometheusgo.MetricType_SUMMARY.Enum() promMetric.Metric = []*prometheusgo.Metric{ {Summary: sum}, } }
// FillPrometheusMetric fills the appropriate metric fields. func (g *GaugeFloat64) FillPrometheusMetric(promMetric *prometheusgo.MetricFamily) { promMetric.Type = prometheusgo.MetricType_GAUGE.Enum() promMetric.Metric = []*prometheusgo.Metric{ {Gauge: &prometheusgo.Gauge{Value: proto.Float64(g.GaugeFloat64.Value())}}, } }
// FillPrometheusMetric fills the appropriate metric fields. func (c *Counter) FillPrometheusMetric(promMetric *prometheusgo.MetricFamily) { promMetric.Type = prometheusgo.MetricType_COUNTER.Enum() promMetric.Metric = []*prometheusgo.Metric{ {Counter: &prometheusgo.Counter{Value: proto.Float64(float64(c.Counter.Count()))}}, } }