1 package prometheus 2 3 import ( 4 pm "github.com/prometheus/client_golang/prometheus" 5 ) 6 7 type parent interface { 8 PMCollector() pm.Collector 9 } 10 11 type collector struct { 12 p parent 13 reg *promRegistry 14 } 15 16 func (c *collector) setParent(p parent) { 17 c.p = p 18 } 19 20 func (c *collector) Describe(x chan<- *pm.Desc) { 21 c.p.PMCollector().Describe(x) 22 } 23 func (c *collector) Collect(x chan<- pm.Metric) { 24 c.p.PMCollector().Collect(x) 25 } 26