Gatherer is the interface for the part of a registry in charge of gathering the collected metrics into a number of MetricFamilies. The Gatherer interface comes with the same general implication as described for the Registerer interface.
| 138 | // comes with the same general implication as described for the Registerer |
| 139 | // interface. |
| 140 | type Gatherer interface { |
| 141 | // Gather calls the Collect method of the registered Collectors and then |
| 142 | // gathers the collected metrics into a lexicographically sorted slice |
| 143 | // of uniquely named MetricFamily protobufs. Gather ensures that the |
| 144 | // returned slice is valid and self-consistent so that it can be used |
| 145 | // for valid exposition. As an exception to the strict consistency |
| 146 | // requirements described for metric.Desc, Gather will tolerate |
| 147 | // different sets of label names for metrics of the same metric family. |
| 148 | // |
| 149 | // Even if an error occurs, Gather attempts to gather as many metrics as |
| 150 | // possible. Hence, if a non-nil error is returned, the returned |
| 151 | // MetricFamily slice could be nil (in case of a fatal error that |
| 152 | // prevented any meaningful metric collection) or contain a number of |
| 153 | // MetricFamily protobufs, some of which might be incomplete, and some |
| 154 | // might be missing altogether. The returned error (which might be a |
| 155 | // MultiError) explains the details. Note that this is mostly useful for |
| 156 | // debugging purposes. If the gathered protobufs are to be used for |
| 157 | // exposition in actual monitoring, it is almost always better to not |
| 158 | // expose an incomplete result and instead disregard the returned |
| 159 | // MetricFamily protobufs in case the returned error is non-nil. |
| 160 | Gather() ([]*dto.MetricFamily, error) |
| 161 | } |
| 162 | |
| 163 | // Register registers the provided Collector with the DefaultRegisterer. |
| 164 | // |
no outgoing calls
no test coverage detected