mirror of
https://github.com/actions/actions-runner-controller.git
synced 2025-12-10 11:41:27 +00:00
* 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>
32 lines
647 B
Go
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))
|
|
}
|
|
}
|