remove required from counters, gauges, histograms

This commit is contained in:
Nikola Jokic 2025-03-24 12:47:25 +01:00
parent 3fb8d12d10
commit f3c667c5fe
No known key found for this signature in database
GPG Key ID: E4104494F9B8DDF6
7 changed files with 155 additions and 165 deletions

View File

@ -237,9 +237,12 @@ type ProxyServerConfig struct {
// MetricsConfig holds configuration parameters for each metric type
type MetricsConfig struct {
Counters map[string]*CounterMetric `json:"counters"`
Gauges map[string]*GaugeMetric `json:"gauges"`
Histograms map[string]*HistogramMetric `json:"histograms"`
// +optional
Counters map[string]*CounterMetric `json:"counters,omitempty"`
// +optional
Gauges map[string]*GaugeMetric `json:"gauges,omitempty"`
// +optional
Histograms map[string]*HistogramMetric `json:"histograms,omitempty"`
}
// CounterMetric holds configuration of a single metric of type Counter

View File

@ -162,10 +162,6 @@ spec:
- labels
type: object
type: object
required:
- counters
- gauges
- histograms
type: object
minRunners:
description: Required

View File

@ -142,10 +142,6 @@ spec:
- labels
type: object
type: object
required:
- counters
- gauges
- histograms
type: object
listenerTemplate:
description: PodTemplateSpec describes the data a pod should have when created from a template

View File

@ -119,148 +119,148 @@ githubConfigSecret:
# - name: side-car
# image: example-sidecar
listenerMetrics:
counters:
gha_started_jobs_total:
labels:
["repository", "organization", "enterprise", "job_name", "event_name"]
gha_completed_jobs_total:
labels:
[
"repository",
"organization",
"enterprise",
"job_name",
"event_name",
"job_result",
]
gauges:
gha_assigned_jobs:
labels: ["name", "namespace", "repository", "organization", "enterprise"]
gha_running_jobs:
labels: ["name", "namespace", "repository", "organization", "enterprise"]
gha_registered_runners:
labels: ["name", "namespace", "repository", "organization", "enterprise"]
gha_busy_runners:
labels: ["name", "namespace", "repository", "organization", "enterprise"]
gha_min_runners:
labels: ["name", "namespace", "repository", "organization", "enterprise"]
gha_max_runners:
labels: ["name", "namespace", "repository", "organization", "enterprise"]
gha_desired_runners:
labels: ["name", "namespace", "repository", "organization", "enterprise"]
gha_idle_runners:
labels: ["name", "namespace", "repository", "organization", "enterprise"]
histograms:
gha_job_startup_duration_seconds:
labels:
["repository", "organization", "enterprise", "job_name", "event_name"]
buckets:
[
0.01,
0.05,
0.1,
0.5,
1.0,
2.0,
3.0,
4.0,
5.0,
6.0,
7.0,
8.0,
9.0,
10.0,
12.0,
15.0,
18.0,
20.0,
25.0,
30.0,
40.0,
50.0,
60.0,
70.0,
80.0,
90.0,
100.0,
110.0,
120.0,
150.0,
180.0,
210.0,
240.0,
300.0,
360.0,
420.0,
480.0,
540.0,
600.0,
900.0,
1200.0,
1800.0,
2400.0,
3000.0,
3600.0,
]
gha_job_execution_duration_seconds:
labels:
[
"repository",
"organization",
"enterprise",
"job_name",
"event_name",
"job_result",
]
buckets:
[
0.01,
0.05,
0.1,
0.5,
1.0,
2.0,
3.0,
4.0,
5.0,
6.0,
7.0,
8.0,
9.0,
10.0,
12.0,
15.0,
18.0,
20.0,
25.0,
30.0,
40.0,
50.0,
60.0,
70.0,
80.0,
90.0,
100.0,
110.0,
120.0,
150.0,
180.0,
210.0,
240.0,
300.0,
360.0,
420.0,
480.0,
540.0,
600.0,
900.0,
1200.0,
1800.0,
2400.0,
3000.0,
3600.0,
]
# listenerMetrics:
# counters:
# gha_started_jobs_total:
# labels:
# ["repository", "organization", "enterprise", "job_name", "event_name"]
# gha_completed_jobs_total:
# labels:
# [
# "repository",
# "organization",
# "enterprise",
# "job_name",
# "event_name",
# "job_result",
# ]
# gauges:
# gha_assigned_jobs:
# labels: ["name", "namespace", "repository", "organization", "enterprise"]
# gha_running_jobs:
# labels: ["name", "namespace", "repository", "organization", "enterprise"]
# gha_registered_runners:
# labels: ["name", "namespace", "repository", "organization", "enterprise"]
# gha_busy_runners:
# labels: ["name", "namespace", "repository", "organization", "enterprise"]
# gha_min_runners:
# labels: ["name", "namespace", "repository", "organization", "enterprise"]
# gha_max_runners:
# labels: ["name", "namespace", "repository", "organization", "enterprise"]
# gha_desired_runners:
# labels: ["name", "namespace", "repository", "organization", "enterprise"]
# gha_idle_runners:
# labels: ["name", "namespace", "repository", "organization", "enterprise"]
# histograms:
# gha_job_startup_duration_seconds:
# labels:
# ["repository", "organization", "enterprise", "job_name", "event_name"]
# buckets:
# [
# 0.01,
# 0.05,
# 0.1,
# 0.5,
# 1.0,
# 2.0,
# 3.0,
# 4.0,
# 5.0,
# 6.0,
# 7.0,
# 8.0,
# 9.0,
# 10.0,
# 12.0,
# 15.0,
# 18.0,
# 20.0,
# 25.0,
# 30.0,
# 40.0,
# 50.0,
# 60.0,
# 70.0,
# 80.0,
# 90.0,
# 100.0,
# 110.0,
# 120.0,
# 150.0,
# 180.0,
# 210.0,
# 240.0,
# 300.0,
# 360.0,
# 420.0,
# 480.0,
# 540.0,
# 600.0,
# 900.0,
# 1200.0,
# 1800.0,
# 2400.0,
# 3000.0,
# 3600.0,
# ]
# gha_job_execution_duration_seconds:
# labels:
# [
# "repository",
# "organization",
# "enterprise",
# "job_name",
# "event_name",
# "job_result",
# ]
# buckets:
# [
# 0.01,
# 0.05,
# 0.1,
# 0.5,
# 1.0,
# 2.0,
# 3.0,
# 4.0,
# 5.0,
# 6.0,
# 7.0,
# 8.0,
# 9.0,
# 10.0,
# 12.0,
# 15.0,
# 18.0,
# 20.0,
# 25.0,
# 30.0,
# 40.0,
# 50.0,
# 60.0,
# 70.0,
# 80.0,
# 90.0,
# 100.0,
# 110.0,
# 120.0,
# 150.0,
# 180.0,
# 210.0,
# 240.0,
# 300.0,
# 360.0,
# 420.0,
# 480.0,
# 540.0,
# 600.0,
# 900.0,
# 1200.0,
# 1800.0,
# 2400.0,
# 3000.0,
# 3600.0,
# ]
## template is the PodSpec for each runner Pod
## For reference: https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#PodSpec

View File

@ -25,7 +25,10 @@ const (
labelKeyJobResult = "job_result"
)
const githubScaleSetSubsystem = "gha"
const (
githubScaleSetSubsystem = "gha"
githubScaleSetSubsystemPrefix = "gha_"
)
// Names of all metrics available on the listener
const (
@ -198,7 +201,7 @@ func installMetrics(config v1alpha1.MetricsConfig, reg *prometheus.Registry, log
g := prometheus.V2.NewGaugeVec(prometheus.GaugeVecOpts{
GaugeOpts: prometheus.GaugeOpts{
Subsystem: githubScaleSetSubsystem,
Name: strings.TrimPrefix(name, githubScaleSetSubsystem),
Name: strings.TrimPrefix(name, githubScaleSetSubsystemPrefix),
Help: help,
},
VariableLabels: prometheus.UnconstrainedLabels(cfg.Labels),
@ -219,7 +222,7 @@ func installMetrics(config v1alpha1.MetricsConfig, reg *prometheus.Registry, log
c := prometheus.V2.NewCounterVec(prometheus.CounterVecOpts{
CounterOpts: prometheus.CounterOpts{
Subsystem: githubScaleSetSubsystem,
Name: strings.TrimPrefix(name, githubScaleSetSubsystem),
Name: strings.TrimPrefix(name, githubScaleSetSubsystemPrefix),
Help: help,
},
VariableLabels: prometheus.UnconstrainedLabels(cfg.Labels),
@ -245,7 +248,7 @@ func installMetrics(config v1alpha1.MetricsConfig, reg *prometheus.Registry, log
h := prometheus.V2.NewHistogramVec(prometheus.HistogramVecOpts{
HistogramOpts: prometheus.HistogramOpts{
Subsystem: githubScaleSetSubsystem,
Name: strings.TrimPrefix(name, githubScaleSetSubsystem),
Name: strings.TrimPrefix(name, githubScaleSetSubsystemPrefix),
Help: help,
Buckets: buckets,
},

View File

@ -162,10 +162,6 @@ spec:
- labels
type: object
type: object
required:
- counters
- gauges
- histograms
type: object
minRunners:
description: Required

View File

@ -142,10 +142,6 @@ spec:
- labels
type: object
type: object
required:
- counters
- gauges
- histograms
type: object
listenerTemplate:
description: PodTemplateSpec describes the data a pod should have when created from a template