|
84 | 84 | // of those four metric types can be found in the Prometheus docs:
|
85 | 85 | // https://prometheus.io/docs/concepts/metric_types/
|
86 | 86 | //
|
87 |
| -// A fifth "type" of metric is Untyped. It behaves like a Gauge, but signals the |
88 |
| -// Prometheus server not to assume anything about its type. |
89 |
| -// |
90 |
| -// In addition to the fundamental metric types Gauge, Counter, Summary, |
91 |
| -// Histogram, and Untyped, a very important part of the Prometheus data model is |
92 |
| -// the partitioning of samples along dimensions called labels, which results in |
| 87 | +// In addition to the fundamental metric types Gauge, Counter, Summary, and |
| 88 | +// Histogram, a very important part of the Prometheus data model is the |
| 89 | +// partitioning of samples along dimensions called labels, which results in |
93 | 90 | // metric vectors. The fundamental types are GaugeVec, CounterVec, SummaryVec,
|
94 |
| -// HistogramVec, and UntypedVec. |
| 91 | +// and HistogramVec. |
95 | 92 | //
|
96 | 93 | // While only the fundamental metric types implement the Metric interface, both
|
97 | 94 | // the metrics and their vector versions implement the Collector interface. A
|
98 | 95 | // Collector manages the collection of a number of Metrics, but for convenience,
|
99 |
| -// a Metric can also “collect itself”. Note that Gauge, Counter, Summary, |
100 |
| -// Histogram, and Untyped are interfaces themselves while GaugeVec, CounterVec, |
101 |
| -// SummaryVec, HistogramVec, and UntypedVec are not. |
| 96 | +// a Metric can also “collect itself”. Note that Gauge, Counter, Summary, and |
| 97 | +// Histogram are interfaces themselves while GaugeVec, CounterVec, SummaryVec, |
| 98 | +// and HistogramVec are not. |
102 | 99 | //
|
103 | 100 | // To create instances of Metrics and their vector versions, you need a suitable
|
104 |
| -// …Opts struct, i.e. GaugeOpts, CounterOpts, SummaryOpts, HistogramOpts, or |
105 |
| -// UntypedOpts. |
| 101 | +// …Opts struct, i.e. GaugeOpts, CounterOpts, SummaryOpts, or HistogramOpts. |
106 | 102 | //
|
107 | 103 | // Custom Collectors and constant Metrics
|
108 | 104 | //
|
|
118 | 114 | // existing numbers into Prometheus Metrics during collection. An own
|
119 | 115 | // implementation of the Collector interface is perfect for that. You can create
|
120 | 116 | // Metric instances “on the fly” using NewConstMetric, NewConstHistogram, and
|
121 |
| -// NewConstSummary (and their respective Must… versions). That will happen in |
122 |
| -// the Collect method. The Describe method has to return separate Desc |
123 |
| -// instances, representative of the “throw-away” metrics to be created later. |
124 |
| -// NewDesc comes in handy to create those Desc instances. Alternatively, you |
125 |
| -// could return no Desc at all, which will mark the Collector “unchecked”. No |
126 |
| -// checks are performed at registration time, but metric consistency will still |
127 |
| -// be ensured at scrape time, i.e. any inconsistencies will lead to scrape |
| 117 | +// NewConstSummary (and their respective Must… versions). NewConstMetric is used |
| 118 | +// for all metric types with just a float64 as their value: Counter, Gauge, and |
| 119 | +// a special “type” called Untyped. Use the latter if you are not sure if the |
| 120 | +// mirrored metric is a Counter or a Gauge. Creation of the Metric instance |
| 121 | +// happens in the Collect method. The Describe method has to return separate |
| 122 | +// Desc instances, representative of the “throw-away” metrics to be created |
| 123 | +// later. NewDesc comes in handy to create those Desc instances. Alternatively, |
| 124 | +// you could return no Desc at all, which will mark the Collector “unchecked”. |
| 125 | +// No checks are performed at registration time, but metric consistency will |
| 126 | +// still be ensured at scrape time, i.e. any inconsistencies will lead to scrape |
128 | 127 | // errors. Thus, with unchecked Collectors, the responsibility to not collect
|
129 | 128 | // metrics that lead to inconsistencies in the total scrape result lies with the
|
130 | 129 | // implementer of the Collector. While this is not a desirable state, it is
|
|
0 commit comments