50. package prometheus
// Collector is the interface implemented by anything that can be used by
// Prometheus to collect metrics. A Collector has to be registered for
// collection. See Registerer.Register.
type Collector interface {
// Describe sends the super-set of all possible descriptors of metrics
// collected by this Collector to the provided channel and returns once
// the last descriptor has been sent.
Describe(chan<- *Desc)
// Collect is called by the Prometheus registry when collecting
// metrics. The implementation sends each collected metric via the
// provided
Collect(chan<- Metric)
}
77. func (s *server) initalizeMetrics() {
s.metrics = metricsConfig{
attemptedConvergeChassis:
s.metricsNode.Gauge("attempted_converge_chassis", "number of
chassis converger attempting to converge"),
failedConvergeChassis:
s.metricsNode.Gauge("failed_converge_chassis", "number of
chassis that failed to converge"),
}
}
100. workC := make(chan request, Workers)
for i := 0; i < Workers; i++ {
go func() {
defer workWG.Done()
for r := range workC {
s.serve(r.buf, r.from)
}
}()
}