mirror of
https://github.com/actions/actions-runner-controller.git
synced 2025-12-11 03:57:01 +00:00
Provide scale-set listener metrics (#2559)
Co-authored-by: Tingluo Huang <tingluohuang@github.com> Co-authored-by: Bassem Dghaidi <568794+Link-@users.noreply.github.com>
This commit is contained in:
@@ -55,14 +55,18 @@ type JobMessageType struct {
|
||||
|
||||
type JobMessageBase struct {
|
||||
JobMessageType
|
||||
RunnerRequestId int64 `json:"runnerRequestId"`
|
||||
RepositoryName string `json:"repositoryName"`
|
||||
OwnerName string `json:"ownerName"`
|
||||
JobWorkflowRef string `json:"jobWorkflowRef"`
|
||||
JobDisplayName string `json:"jobDisplayName"`
|
||||
WorkflowRunId int64 `json:"workflowRunId"`
|
||||
EventName string `json:"eventName"`
|
||||
RequestLabels []string `json:"requestLabels"`
|
||||
RunnerRequestId int64 `json:"runnerRequestId"`
|
||||
RepositoryName string `json:"repositoryName"`
|
||||
OwnerName string `json:"ownerName"`
|
||||
JobWorkflowRef string `json:"jobWorkflowRef"`
|
||||
JobDisplayName string `json:"jobDisplayName"`
|
||||
WorkflowRunId int64 `json:"workflowRunId"`
|
||||
EventName string `json:"eventName"`
|
||||
RequestLabels []string `json:"requestLabels"`
|
||||
QueueTime time.Time `json:"queueTime"`
|
||||
ScaleSetAssignTime time.Time `json:"scaleSetAssignTime"`
|
||||
RunnerAssignTime time.Time `json:"runnerAssignTime"`
|
||||
FinishTime time.Time `json:"finishTime"`
|
||||
}
|
||||
|
||||
type Label struct {
|
||||
|
||||
@@ -96,6 +96,8 @@ func (c *Config) NewClient() (*Client, error) {
|
||||
metricsTransport := metrics.Transport{Transport: loggingTransport}
|
||||
httpClient := &http.Client{Transport: metricsTransport}
|
||||
|
||||
metrics.Register()
|
||||
|
||||
var client *github.Client
|
||||
var githubBaseURL string
|
||||
var isEnterprise bool
|
||||
|
||||
@@ -7,13 +7,18 @@ package metrics
|
||||
import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
"sync"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"sigs.k8s.io/controller-runtime/pkg/metrics"
|
||||
)
|
||||
|
||||
func init() {
|
||||
metrics.Registry.MustRegister(metricRateLimit, metricRateLimitRemaining)
|
||||
var onceRegister sync.Once
|
||||
|
||||
func Register() {
|
||||
onceRegister.Do(func() {
|
||||
metrics.Registry.MustRegister(metricRateLimit, metricRateLimitRemaining)
|
||||
})
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
Reference in New Issue
Block a user