Skip to content

Commit

Permalink
Explicitly forward metricVec methods Collect, Describe, Reset
Browse files Browse the repository at this point in the history
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 <beorn@grafana.com>
  • Loading branch information
beorn7 committed Feb 13, 2020
1 parent 913f67e commit aa6eadd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions prometheus/vec.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,18 @@ func (m *metricVec) Delete(labels Labels) bool {
return m.metricMap.deleteByHashWithLabels(h, labels, m.curry)
}

// Without explicit forwarding of Describe, Collect, Reset, those methods won't
// show up in GoDoc.

// Describe implements Collector.
func (m *metricVec) Describe(ch chan<- *Desc) { m.metricMap.Describe(ch) }

// Collect implements Collector.
func (m *metricVec) Collect(ch chan<- Metric) { m.metricMap.Collect(ch) }

// Reset deletes all metrics in this vector.
func (m *metricVec) Reset() { m.metricMap.Reset() }

func (m *metricVec) curryWith(labels Labels) (*metricVec, error) {
var (
newCurry []curriedLabelValue
Expand Down

0 comments on commit aa6eadd

Please sign in to comment.