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:
Nikola Jokic
2023-08-21 13:50:07 +02:00
committed by GitHub
parent 1c360d7e26
commit a0a3916c80
20 changed files with 975 additions and 427 deletions

View File

@@ -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 {

View File

@@ -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

View File

@@ -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 (