Files
actions-runner-controller/controllers/actions.summerwind.net/metrics/runnerset.go
Nikola Jokic aa6dab5a9a Changes to folder structure to allow multigroups and changed go mod name (#2105)
* Changed folder structure to allow multi group registration

* included actions.github.com directory for resources and controllers

* updated go module to actions/actions-runner-controller

* publish arc packages under actions-runner-controller

* Update charts/actions-runner-controller/docs/UPGRADING.md

Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-12-28 09:38:34 +09:00

32 lines
647 B
Go

package metrics
import (
"github.com/actions/actions-runner-controller/apis/actions.summerwind.net/v1alpha1"
"github.com/prometheus/client_golang/prometheus"
)
const (
rsName = "runnerset"
rsNamespace = "namespace"
)
var (
runnerSetReplicas = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "runnerset_spec_replicas",
Help: "replicas of RunnerSet",
},
[]string{rsName, rsNamespace},
)
)
func SetRunnerSet(rd v1alpha1.RunnerSet) {
labels := prometheus.Labels{
rsName: rd.Name,
rsNamespace: rd.Namespace,
}
if rd.Spec.Replicas != nil {
runnerSetReplicas.With(labels).Set(float64(*rd.Spec.Replicas))
}
}