Provisioning: Allow setting concurrent jobs settings and add metric (#111451)

This commit is contained in:
Stephanie Hingtgen
2025-09-22 20:07:22 +00:00
committed by GitHub
parent b02d2762f5
commit a2d09490ae
3 changed files with 30 additions and 8 deletions
@@ -21,7 +21,6 @@ type ConcurrentJobDriver struct {
repoGetter RepoGetter
historicJobs HistoryWriter
workers []Worker
registry prometheus.Registerer
notifications chan struct{}
}
@@ -58,6 +57,8 @@ func NewConcurrentJobDriver(
cleanupInterval = 5 * time.Minute // Maximum cleanup interval
}
recordConcurrentDriverMetric(registry, numDrivers)
return &ConcurrentJobDriver{
numDrivers: numDrivers,
jobTimeout: jobTimeout,
@@ -69,7 +70,6 @@ func NewConcurrentJobDriver(
historicJobs: historicJobs,
workers: workers,
notifications: notifications,
registry: registry,
}, nil
}
@@ -110,3 +110,15 @@ func getResourceCountBucket(count int) string {
return "1000+"
}
}
func recordConcurrentDriverMetric(registry prometheus.Registerer, numDrivers int) {
concurrentDriver := prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "grafana_provisioning_jobs_concurrent_driver_num_drivers",
Help: "Number of concurrent job drivers",
},
[]string{},
)
registry.MustRegister(concurrentDriver)
concurrentDriver.WithLabelValues().Set(float64(numDrivers))
}