Observability/metrics update (#1962)

* Removing logging from the NOOP implementatino

* Simplifying the percentiles option

* Simple logging implementation

Co-authored-by: chris <chris@Profanity.local>
This commit is contained in:
Prawn
2020-08-21 20:57:10 +12:00
committed by GitHub
parent 1ae825032c
commit f9f61d29de
7 changed files with 142 additions and 20 deletions

View File

@@ -19,13 +19,22 @@ type metricFamily struct {
// newMetricFamily returns a new metricFamily (useful in case we want to change the structure later):
func (r *Reporter) newMetricFamily() metricFamily {
// Take quantile thresholds from our pre-defined list:
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: r.options.TimingObjectives,
timingObjectives: timingObjectives,
}
}