*: cleanup collector API 1 (#1547)

This commit is contained in:
Jan-Otto Kröpke
2024-08-05 15:50:41 +02:00
committed by GitHub
parent dffc53eff8
commit d1e3a63f93
86 changed files with 2162 additions and 1930 deletions

View File

@@ -112,7 +112,7 @@ func (coll *Prometheus) Collect(ch chan<- prometheus.Metric) {
}()
for name, c := range coll.collectors.collectors {
go func(name string, c types.Collector) {
go func(name string, c Collector) {
defer wg.Done()
outcome := coll.execute(name, c, scrapeContext, metricsBuffer)
l.Lock()
@@ -171,7 +171,7 @@ func (coll *Prometheus) Collect(ch chan<- prometheus.Metric) {
l.Unlock()
}
func (coll *Prometheus) execute(name string, c types.Collector, ctx *types.ScrapeContext, ch chan<- prometheus.Metric) collectorOutcome {
func (coll *Prometheus) execute(name string, c Collector, ctx *types.ScrapeContext, ch chan<- prometheus.Metric) collectorOutcome {
t := time.Now()
err := c.Collect(ctx, ch)
duration := time.Since(t).Seconds()