Provisioning: Allow setting concurrent jobs settings and add metric (#111451)
This commit is contained in:
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user