Metrics: set max and min runners during startup time (#3032)

This commit is contained in:
Nikola Jokic 2023-11-07 14:20:10 +01:00 committed by GitHub
parent 2646456677
commit 16815230bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -82,6 +82,7 @@ func NewService(
}
func (s *Service) Start() error {
s.metricsExporter.publishStatic(s.settings.MaxRunners, s.settings.MinRunners)
for {
s.logger.Info("waiting for message...")
select {

View File

@ -297,6 +297,12 @@ func (m *metricsExporter) withBaseLabels(base baseLabels) {
m.baseLabels = base
}
func (m *metricsExporter) publishStatic(max, min int) {
l := m.scaleSetLabels()
maxRunners.With(l).Set(float64(max))
minRunners.With(l).Set(float64(min))
}
func (m *metricsExporter) publishStatistics(stats *actions.RunnerScaleSetStatistic) {
l := m.scaleSetLabels()