-
Notifications
You must be signed in to change notification settings - Fork 867
/
prommetrics.go
231 lines (205 loc) · 5.84 KB
/
prommetrics.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
package metrics
import (
"github.com/argoproj/argo-rollouts/utils/version"
"github.com/prometheus/client_golang/prometheus"
)
// Follow Prometheus naming practices
// https://prometheus.io/docs/practices/naming/
var (
namespaceNameLabels = []string{"namespace", "name"}
)
// Rollout metrics
var (
MetricRolloutReconcile = prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Name: "rollout_reconcile",
Help: "Rollout reconciliation performance.",
Buckets: []float64{0.01, 0.15, .25, .5, 1},
},
namespaceNameLabels,
)
MetricRolloutReconcileError = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "rollout_reconcile_error",
Help: "Error occurring during the rollout",
},
namespaceNameLabels,
)
MetricRolloutInfo = prometheus.NewDesc(
"rollout_info",
"Information about rollout.",
append(namespaceNameLabels, "strategy", "traffic_router", "phase"),
nil,
)
MetricRolloutInfoReplicasAvailable = prometheus.NewDesc(
"rollout_info_replicas_available",
"The number of available replicas per rollout.",
namespaceNameLabels,
nil,
)
MetricRolloutInfoReplicasUnavailable = prometheus.NewDesc(
"rollout_info_replicas_unavailable",
"The number of unavailable replicas per rollout.",
namespaceNameLabels,
nil,
)
MetricRolloutInfoReplicasDesired = prometheus.NewDesc(
"rollout_info_replicas_desired",
"The number of desired replicas per rollout.",
namespaceNameLabels,
nil,
)
MetricRolloutEventsTotal = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "rollout_events_total",
Help: "Count of rollout events",
},
append(namespaceNameLabels, "type", "reason"),
)
// DEPRECATED in favor of rollout_info
MetricRolloutPhase = prometheus.NewDesc(
"rollout_phase",
"Information on the state of the rollout (DEPRECATED - use rollout_info)",
append(namespaceNameLabels, "strategy", "phase"),
nil,
)
)
// AnalysisRun metrics
var (
MetricAnalysisRunReconcile = prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Name: "analysis_run_reconcile",
Help: "Analysis Run reconciliation performance.",
Buckets: []float64{0.01, 0.15, .25, .5, 1},
},
namespaceNameLabels,
)
MetricAnalysisRunReconcileError = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "analysis_run_reconcile_error",
Help: "Error occurring during the analysis run",
},
namespaceNameLabels,
)
MetricAnalysisRunInfo = prometheus.NewDesc(
"analysis_run_info",
"Information about analysis run.",
append(namespaceNameLabels, "phase"),
nil,
)
// DEPRECATED in favor of analysis_run_info
MetricAnalysisRunPhase = prometheus.NewDesc(
"analysis_run_phase",
"Information on the state of the Analysis Run (DEPRECATED - use analysis_run_info)",
append(namespaceNameLabels, "phase"),
nil,
)
MetricAnalysisRunMetricType = prometheus.NewDesc(
"analysis_run_metric_type",
"Information on the type of a specific metric in the Analysis Runs",
append(namespaceNameLabels, "metric", "type"),
nil,
)
MetricAnalysisRunMetricPhase = prometheus.NewDesc(
"analysis_run_metric_phase",
"Information on the duration of a specific metric in the Analysis Run",
append(namespaceNameLabels, "metric", "type", "dry_run", "phase"),
nil,
)
)
// AnalysisTemplate metrics
var (
MetricAnalysisTemplateInfo = prometheus.NewDesc(
"analysis_template_info",
"Information about analysis templates.",
append(namespaceNameLabels),
nil,
)
MetricAnalysisTemplateMetricInfo = prometheus.NewDesc(
"analysis_template_metric_info",
"Information on metrics in analysis templates.",
append(namespaceNameLabels, "type", "metric"),
nil,
)
)
// Experiment metrics
var (
MetricExperimentReconcile = prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Name: "experiment_reconcile",
Help: "Experiments reconciliation performance.",
Buckets: []float64{0.01, 0.15, .25, .5, 1},
},
namespaceNameLabels,
)
MetricExperimentReconcileError = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "experiment_reconcile_error",
Help: "Error occurring during the experiment",
},
namespaceNameLabels,
)
MetricExperimentInfo = prometheus.NewDesc(
"experiment_info",
"Information about Experiment.",
append(namespaceNameLabels, "phase"),
nil,
)
// DEPRECATED in favor of experiment_info
MetricExperimentPhase = prometheus.NewDesc(
"experiment_phase",
"Information on the state of the experiment (DEPRECATED - use experiment_info)",
append(namespaceNameLabels, "phase"),
nil,
)
)
// Notification metrics
var (
MetricNotificationSuccessTotal = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "notification_send_success",
Help: "Notification send success.",
},
append(namespaceNameLabels, "type", "reason"),
)
MetricNotificationFailedTotal = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "notification_send_error",
Help: "Error sending the notification",
},
append(namespaceNameLabels, "type", "reason"),
)
MetricNotificationSend = prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Name: "notification_send",
Help: "Notification send performance.",
Buckets: []float64{0.01, 0.15, .25, .5, 1},
},
namespaceNameLabels,
)
)
// K8s Client metrics
var (
// Custom events metric
MetricK8sRequestTotal = prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: clientsetMetricsNamespace,
Name: "k8s_request_total",
Help: "Number of kubernetes requests executed during application reconciliation.",
},
[]string{"kind", "namespace", "name", "verb", "status_code"},
)
)
// MetricVersionGauge version info
var (
MetricVersionGauge = prometheus.NewGaugeFunc(
prometheus.GaugeOpts{
Name: "argo_rollouts_controller_info",
Help: "Running Argo-rollouts version",
ConstLabels: prometheus.Labels{"version": version.GetVersion().Version},
},
func() float64 {
return float64(1)
},
)
)