remove required from counters, gauges, histograms
This commit is contained in:
		
							parent
							
								
									3fb8d12d10
								
							
						
					
					
						commit
						f3c667c5fe
					
				|  | @ -237,9 +237,12 @@ type ProxyServerConfig struct { | ||||||
| 
 | 
 | ||||||
| // MetricsConfig holds configuration parameters for each metric type
 | // MetricsConfig holds configuration parameters for each metric type
 | ||||||
| type MetricsConfig struct { | type MetricsConfig struct { | ||||||
| 	Counters   map[string]*CounterMetric   `json:"counters"` | 	// +optional
 | ||||||
| 	Gauges     map[string]*GaugeMetric     `json:"gauges"` | 	Counters map[string]*CounterMetric `json:"counters,omitempty"` | ||||||
| 	Histograms map[string]*HistogramMetric `json:"histograms"` | 	// +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
 | // CounterMetric holds configuration of a single metric of type Counter
 | ||||||
|  |  | ||||||
|  | @ -162,10 +162,6 @@ spec: | ||||||
|                           - labels |                           - labels | ||||||
|                         type: object |                         type: object | ||||||
|                       type: object |                       type: object | ||||||
|                   required: |  | ||||||
|                     - counters |  | ||||||
|                     - gauges |  | ||||||
|                     - histograms |  | ||||||
|                   type: object |                   type: object | ||||||
|                 minRunners: |                 minRunners: | ||||||
|                   description: Required |                   description: Required | ||||||
|  |  | ||||||
|  | @ -142,10 +142,6 @@ spec: | ||||||
|                           - labels |                           - labels | ||||||
|                         type: object |                         type: object | ||||||
|                       type: object |                       type: object | ||||||
|                   required: |  | ||||||
|                     - counters |  | ||||||
|                     - gauges |  | ||||||
|                     - histograms |  | ||||||
|                   type: object |                   type: object | ||||||
|                 listenerTemplate: |                 listenerTemplate: | ||||||
|                   description: PodTemplateSpec describes the data a pod should have when created from a template |                   description: PodTemplateSpec describes the data a pod should have when created from a template | ||||||
|  |  | ||||||
|  | @ -119,148 +119,148 @@ githubConfigSecret: | ||||||
| #     - name: side-car | #     - name: side-car | ||||||
| #       image: example-sidecar | #       image: example-sidecar | ||||||
| 
 | 
 | ||||||
| listenerMetrics: | # listenerMetrics: | ||||||
|   counters: | #   counters: | ||||||
|     gha_started_jobs_total: | #     gha_started_jobs_total: | ||||||
|       labels: | #       labels: | ||||||
|         ["repository", "organization", "enterprise", "job_name", "event_name"] | #         ["repository", "organization", "enterprise", "job_name", "event_name"] | ||||||
|     gha_completed_jobs_total: | #     gha_completed_jobs_total: | ||||||
|       labels: | #       labels: | ||||||
|         [ | #         [ | ||||||
|           "repository", | #           "repository", | ||||||
|           "organization", | #           "organization", | ||||||
|           "enterprise", | #           "enterprise", | ||||||
|           "job_name", | #           "job_name", | ||||||
|           "event_name", | #           "event_name", | ||||||
|           "job_result", | #           "job_result", | ||||||
|         ] | #         ] | ||||||
|   gauges: | #   gauges: | ||||||
|     gha_assigned_jobs: | #     gha_assigned_jobs: | ||||||
|       labels: ["name", "namespace", "repository", "organization", "enterprise"] | #       labels: ["name", "namespace", "repository", "organization", "enterprise"] | ||||||
|     gha_running_jobs: | #     gha_running_jobs: | ||||||
|       labels: ["name", "namespace", "repository", "organization", "enterprise"] | #       labels: ["name", "namespace", "repository", "organization", "enterprise"] | ||||||
|     gha_registered_runners: | #     gha_registered_runners: | ||||||
|       labels: ["name", "namespace", "repository", "organization", "enterprise"] | #       labels: ["name", "namespace", "repository", "organization", "enterprise"] | ||||||
|     gha_busy_runners: | #     gha_busy_runners: | ||||||
|       labels: ["name", "namespace", "repository", "organization", "enterprise"] | #       labels: ["name", "namespace", "repository", "organization", "enterprise"] | ||||||
|     gha_min_runners: | #     gha_min_runners: | ||||||
|       labels: ["name", "namespace", "repository", "organization", "enterprise"] | #       labels: ["name", "namespace", "repository", "organization", "enterprise"] | ||||||
|     gha_max_runners: | #     gha_max_runners: | ||||||
|       labels: ["name", "namespace", "repository", "organization", "enterprise"] | #       labels: ["name", "namespace", "repository", "organization", "enterprise"] | ||||||
|     gha_desired_runners: | #     gha_desired_runners: | ||||||
|       labels: ["name", "namespace", "repository", "organization", "enterprise"] | #       labels: ["name", "namespace", "repository", "organization", "enterprise"] | ||||||
|     gha_idle_runners: | #     gha_idle_runners: | ||||||
|       labels: ["name", "namespace", "repository", "organization", "enterprise"] | #       labels: ["name", "namespace", "repository", "organization", "enterprise"] | ||||||
|   histograms: | #   histograms: | ||||||
|     gha_job_startup_duration_seconds: | #     gha_job_startup_duration_seconds: | ||||||
|       labels: | #       labels: | ||||||
|         ["repository", "organization", "enterprise", "job_name", "event_name"] | #         ["repository", "organization", "enterprise", "job_name", "event_name"] | ||||||
|       buckets: | #       buckets: | ||||||
|         [ | #         [ | ||||||
|           0.01, | #           0.01, | ||||||
|           0.05, | #           0.05, | ||||||
|           0.1, | #           0.1, | ||||||
|           0.5, | #           0.5, | ||||||
|           1.0, | #           1.0, | ||||||
|           2.0, | #           2.0, | ||||||
|           3.0, | #           3.0, | ||||||
|           4.0, | #           4.0, | ||||||
|           5.0, | #           5.0, | ||||||
|           6.0, | #           6.0, | ||||||
|           7.0, | #           7.0, | ||||||
|           8.0, | #           8.0, | ||||||
|           9.0, | #           9.0, | ||||||
|           10.0, | #           10.0, | ||||||
|           12.0, | #           12.0, | ||||||
|           15.0, | #           15.0, | ||||||
|           18.0, | #           18.0, | ||||||
|           20.0, | #           20.0, | ||||||
|           25.0, | #           25.0, | ||||||
|           30.0, | #           30.0, | ||||||
|           40.0, | #           40.0, | ||||||
|           50.0, | #           50.0, | ||||||
|           60.0, | #           60.0, | ||||||
|           70.0, | #           70.0, | ||||||
|           80.0, | #           80.0, | ||||||
|           90.0, | #           90.0, | ||||||
|           100.0, | #           100.0, | ||||||
|           110.0, | #           110.0, | ||||||
|           120.0, | #           120.0, | ||||||
|           150.0, | #           150.0, | ||||||
|           180.0, | #           180.0, | ||||||
|           210.0, | #           210.0, | ||||||
|           240.0, | #           240.0, | ||||||
|           300.0, | #           300.0, | ||||||
|           360.0, | #           360.0, | ||||||
|           420.0, | #           420.0, | ||||||
|           480.0, | #           480.0, | ||||||
|           540.0, | #           540.0, | ||||||
|           600.0, | #           600.0, | ||||||
|           900.0, | #           900.0, | ||||||
|           1200.0, | #           1200.0, | ||||||
|           1800.0, | #           1800.0, | ||||||
|           2400.0, | #           2400.0, | ||||||
|           3000.0, | #           3000.0, | ||||||
|           3600.0, | #           3600.0, | ||||||
|         ] | #         ] | ||||||
|     gha_job_execution_duration_seconds: | #     gha_job_execution_duration_seconds: | ||||||
|       labels: | #       labels: | ||||||
|         [ | #         [ | ||||||
|           "repository", | #           "repository", | ||||||
|           "organization", | #           "organization", | ||||||
|           "enterprise", | #           "enterprise", | ||||||
|           "job_name", | #           "job_name", | ||||||
|           "event_name", | #           "event_name", | ||||||
|           "job_result", | #           "job_result", | ||||||
|         ] | #         ] | ||||||
|       buckets: | #       buckets: | ||||||
|         [ | #         [ | ||||||
|           0.01, | #           0.01, | ||||||
|           0.05, | #           0.05, | ||||||
|           0.1, | #           0.1, | ||||||
|           0.5, | #           0.5, | ||||||
|           1.0, | #           1.0, | ||||||
|           2.0, | #           2.0, | ||||||
|           3.0, | #           3.0, | ||||||
|           4.0, | #           4.0, | ||||||
|           5.0, | #           5.0, | ||||||
|           6.0, | #           6.0, | ||||||
|           7.0, | #           7.0, | ||||||
|           8.0, | #           8.0, | ||||||
|           9.0, | #           9.0, | ||||||
|           10.0, | #           10.0, | ||||||
|           12.0, | #           12.0, | ||||||
|           15.0, | #           15.0, | ||||||
|           18.0, | #           18.0, | ||||||
|           20.0, | #           20.0, | ||||||
|           25.0, | #           25.0, | ||||||
|           30.0, | #           30.0, | ||||||
|           40.0, | #           40.0, | ||||||
|           50.0, | #           50.0, | ||||||
|           60.0, | #           60.0, | ||||||
|           70.0, | #           70.0, | ||||||
|           80.0, | #           80.0, | ||||||
|           90.0, | #           90.0, | ||||||
|           100.0, | #           100.0, | ||||||
|           110.0, | #           110.0, | ||||||
|           120.0, | #           120.0, | ||||||
|           150.0, | #           150.0, | ||||||
|           180.0, | #           180.0, | ||||||
|           210.0, | #           210.0, | ||||||
|           240.0, | #           240.0, | ||||||
|           300.0, | #           300.0, | ||||||
|           360.0, | #           360.0, | ||||||
|           420.0, | #           420.0, | ||||||
|           480.0, | #           480.0, | ||||||
|           540.0, | #           540.0, | ||||||
|           600.0, | #           600.0, | ||||||
|           900.0, | #           900.0, | ||||||
|           1200.0, | #           1200.0, | ||||||
|           1800.0, | #           1800.0, | ||||||
|           2400.0, | #           2400.0, | ||||||
|           3000.0, | #           3000.0, | ||||||
|           3600.0, | #           3600.0, | ||||||
|         ] | #         ] | ||||||
| 
 | 
 | ||||||
| ## template is the PodSpec for each runner Pod | ## template is the PodSpec for each runner Pod | ||||||
| ## For reference: https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#PodSpec | ## For reference: https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#PodSpec | ||||||
|  |  | ||||||
|  | @ -25,7 +25,10 @@ const ( | ||||||
| 	labelKeyJobResult               = "job_result" | 	labelKeyJobResult               = "job_result" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| const githubScaleSetSubsystem = "gha" | const ( | ||||||
|  | 	githubScaleSetSubsystem       = "gha" | ||||||
|  | 	githubScaleSetSubsystemPrefix = "gha_" | ||||||
|  | ) | ||||||
| 
 | 
 | ||||||
| // Names of all metrics available on the listener
 | // Names of all metrics available on the listener
 | ||||||
| const ( | const ( | ||||||
|  | @ -198,7 +201,7 @@ func installMetrics(config v1alpha1.MetricsConfig, reg *prometheus.Registry, log | ||||||
| 		g := prometheus.V2.NewGaugeVec(prometheus.GaugeVecOpts{ | 		g := prometheus.V2.NewGaugeVec(prometheus.GaugeVecOpts{ | ||||||
| 			GaugeOpts: prometheus.GaugeOpts{ | 			GaugeOpts: prometheus.GaugeOpts{ | ||||||
| 				Subsystem: githubScaleSetSubsystem, | 				Subsystem: githubScaleSetSubsystem, | ||||||
| 				Name:      strings.TrimPrefix(name, githubScaleSetSubsystem), | 				Name:      strings.TrimPrefix(name, githubScaleSetSubsystemPrefix), | ||||||
| 				Help:      help, | 				Help:      help, | ||||||
| 			}, | 			}, | ||||||
| 			VariableLabels: prometheus.UnconstrainedLabels(cfg.Labels), | 			VariableLabels: prometheus.UnconstrainedLabels(cfg.Labels), | ||||||
|  | @ -219,7 +222,7 @@ func installMetrics(config v1alpha1.MetricsConfig, reg *prometheus.Registry, log | ||||||
| 		c := prometheus.V2.NewCounterVec(prometheus.CounterVecOpts{ | 		c := prometheus.V2.NewCounterVec(prometheus.CounterVecOpts{ | ||||||
| 			CounterOpts: prometheus.CounterOpts{ | 			CounterOpts: prometheus.CounterOpts{ | ||||||
| 				Subsystem: githubScaleSetSubsystem, | 				Subsystem: githubScaleSetSubsystem, | ||||||
| 				Name:      strings.TrimPrefix(name, githubScaleSetSubsystem), | 				Name:      strings.TrimPrefix(name, githubScaleSetSubsystemPrefix), | ||||||
| 				Help:      help, | 				Help:      help, | ||||||
| 			}, | 			}, | ||||||
| 			VariableLabels: prometheus.UnconstrainedLabels(cfg.Labels), | 			VariableLabels: prometheus.UnconstrainedLabels(cfg.Labels), | ||||||
|  | @ -245,7 +248,7 @@ func installMetrics(config v1alpha1.MetricsConfig, reg *prometheus.Registry, log | ||||||
| 		h := prometheus.V2.NewHistogramVec(prometheus.HistogramVecOpts{ | 		h := prometheus.V2.NewHistogramVec(prometheus.HistogramVecOpts{ | ||||||
| 			HistogramOpts: prometheus.HistogramOpts{ | 			HistogramOpts: prometheus.HistogramOpts{ | ||||||
| 				Subsystem: githubScaleSetSubsystem, | 				Subsystem: githubScaleSetSubsystem, | ||||||
| 				Name:      strings.TrimPrefix(name, githubScaleSetSubsystem), | 				Name:      strings.TrimPrefix(name, githubScaleSetSubsystemPrefix), | ||||||
| 				Help:      help, | 				Help:      help, | ||||||
| 				Buckets:   buckets, | 				Buckets:   buckets, | ||||||
| 			}, | 			}, | ||||||
|  |  | ||||||
|  | @ -162,10 +162,6 @@ spec: | ||||||
|                           - labels |                           - labels | ||||||
|                         type: object |                         type: object | ||||||
|                       type: object |                       type: object | ||||||
|                   required: |  | ||||||
|                     - counters |  | ||||||
|                     - gauges |  | ||||||
|                     - histograms |  | ||||||
|                   type: object |                   type: object | ||||||
|                 minRunners: |                 minRunners: | ||||||
|                   description: Required |                   description: Required | ||||||
|  |  | ||||||
|  | @ -142,10 +142,6 @@ spec: | ||||||
|                           - labels |                           - labels | ||||||
|                         type: object |                         type: object | ||||||
|                       type: object |                       type: object | ||||||
|                   required: |  | ||||||
|                     - counters |  | ||||||
|                     - gauges |  | ||||||
|                     - histograms |  | ||||||
|                   type: object |                   type: object | ||||||
|                 listenerTemplate: |                 listenerTemplate: | ||||||
|                   description: PodTemplateSpec describes the data a pod should have when created from a template |                   description: PodTemplateSpec describes the data a pod should have when created from a template | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue