chore: Remove registry based perfdata collector (#1742)

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Jan-Otto Kröpke
2024-11-17 21:51:12 +01:00
committed by GitHub
parent 6206b695c6
commit e6a15d4ec4
213 changed files with 8079 additions and 12405 deletions

View File

@@ -92,21 +92,12 @@ func (p *Prometheus) Describe(_ chan<- *prometheus.Desc) {}
func (p *Prometheus) Collect(ch chan<- prometheus.Metric) {
t := time.Now()
// Scrape Performance Counters for all collectors
scrapeContext, err := p.metricCollectors.PrepareScrapeContext()
ch <- prometheus.MustNewConstMetric(
p.snapshotDuration,
prometheus.GaugeValue,
time.Since(t).Seconds(),
)
if err != nil {
ch <- prometheus.NewInvalidMetric(p.collectorScrapeSuccessDesc, fmt.Errorf("failed to prepare scrape: %w", err))
return
}
// WaitGroup to wait for all collectors to finish
wg := sync.WaitGroup{}
wg.Add(len(p.metricCollectors.Collectors))
@@ -123,7 +114,7 @@ func (p *Prometheus) Collect(ch chan<- prometheus.Metric) {
collectorStatusCh <- collectorStatus{
name: name,
statusCode: p.execute(name, metricsCollector, scrapeContext, ch),
statusCode: p.execute(name, metricsCollector, ch),
}
}(name, metricsCollector)
}
@@ -166,7 +157,7 @@ func (p *Prometheus) Collect(ch chan<- prometheus.Metric) {
)
}
func (p *Prometheus) execute(name string, c Collector, scrapeCtx *types.ScrapeContext, ch chan<- prometheus.Metric) collectorStatusCode {
func (p *Prometheus) execute(name string, c Collector, ch chan<- prometheus.Metric) collectorStatusCode {
var (
err error
numMetrics int
@@ -194,7 +185,7 @@ func (p *Prometheus) execute(name string, c Collector, scrapeCtx *types.ScrapeCo
close(bufCh)
}()
errCh <- c.Collect(scrapeCtx, p.logger, bufCh)
errCh <- c.Collect(bufCh)
}()
wg := sync.WaitGroup{}