Skip to content

Commit aa6eadd

Browse files
committed
Explicitly forward metricVec methods Collect, Describe, Reset
Interestingly, methods implicitly forwarded from embedded types are detected by GoDoc if they are just one level deep. Embedded types in the embedded type are not recognized. This commit therefore adds explicit forwarding methods for Collect, Describe, and Reset. Signed-off-by: beorn7 <[email protected]>
1 parent 913f67e commit aa6eadd

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

prometheus/vec.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,18 @@ func (m *metricVec) Delete(labels Labels) bool {
9191
return m.metricMap.deleteByHashWithLabels(h, labels, m.curry)
9292
}
9393

94+
// Without explicit forwarding of Describe, Collect, Reset, those methods won't
95+
// show up in GoDoc.
96+
97+
// Describe implements Collector.
98+
func (m *metricVec) Describe(ch chan<- *Desc) { m.metricMap.Describe(ch) }
99+
100+
// Collect implements Collector.
101+
func (m *metricVec) Collect(ch chan<- Metric) { m.metricMap.Collect(ch) }
102+
103+
// Reset deletes all metrics in this vector.
104+
func (m *metricVec) Reset() { m.metricMap.Reset() }
105+
94106
func (m *metricVec) curryWith(labels Labels) (*metricVec, error) {
95107
var (
96108
newCurry []curriedLabelValue

0 commit comments

Comments
 (0)