This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
/
metrics.go
204 lines (181 loc) · 7.47 KB
/
metrics.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
// Per endpoint service Metrics.
package adminservice
import (
"github.com/lyft/flyteadmin/pkg/rpc/adminservice/util"
"github.com/lyft/flytestdlib/promutils"
"github.com/prometheus/client_golang/prometheus"
)
type executionEndpointMetrics struct {
scope promutils.Scope
create util.RequestMetrics
relaunch util.RequestMetrics
createEvent util.RequestMetrics
get util.RequestMetrics
getData util.RequestMetrics
list util.RequestMetrics
terminate util.RequestMetrics
}
type launchPlanEndpointMetrics struct {
scope promutils.Scope
create util.RequestMetrics
update util.RequestMetrics
get util.RequestMetrics
getActive util.RequestMetrics
list util.RequestMetrics
listActive util.RequestMetrics
listIds util.RequestMetrics
}
type namedEntityEndpointMetrics struct {
scope promutils.Scope
list util.RequestMetrics
update util.RequestMetrics
get util.RequestMetrics
}
type nodeExecutionEndpointMetrics struct {
scope promutils.Scope
createEvent util.RequestMetrics
get util.RequestMetrics
getData util.RequestMetrics
list util.RequestMetrics
listChildren util.RequestMetrics
}
type projectEndpointMetrics struct {
scope promutils.Scope
register util.RequestMetrics
list util.RequestMetrics
update util.RequestMetrics
}
type attributeEndpointMetrics struct {
scope promutils.Scope
update util.RequestMetrics
get util.RequestMetrics
delete util.RequestMetrics
list util.RequestMetrics
}
type taskEndpointMetrics struct {
scope promutils.Scope
create util.RequestMetrics
get util.RequestMetrics
list util.RequestMetrics
listIds util.RequestMetrics
}
type taskExecutionEndpointMetrics struct {
scope promutils.Scope
createEvent util.RequestMetrics
get util.RequestMetrics
getData util.RequestMetrics
list util.RequestMetrics
}
type workflowEndpointMetrics struct {
scope promutils.Scope
create util.RequestMetrics
get util.RequestMetrics
list util.RequestMetrics
listIds util.RequestMetrics
}
type AdminMetrics struct {
Scope promutils.Scope
PanicCounter prometheus.Counter
executionEndpointMetrics executionEndpointMetrics
launchPlanEndpointMetrics launchPlanEndpointMetrics
namedEntityEndpointMetrics namedEntityEndpointMetrics
nodeExecutionEndpointMetrics nodeExecutionEndpointMetrics
projectEndpointMetrics projectEndpointMetrics
projectAttributesEndpointMetrics attributeEndpointMetrics
projectDomainAttributesEndpointMetrics attributeEndpointMetrics
workflowAttributesEndpointMetrics attributeEndpointMetrics
matchableAttributesEndpointMetrics attributeEndpointMetrics
taskEndpointMetrics taskEndpointMetrics
taskExecutionEndpointMetrics taskExecutionEndpointMetrics
workflowEndpointMetrics workflowEndpointMetrics
}
func InitMetrics(adminScope promutils.Scope) AdminMetrics {
return AdminMetrics{
Scope: adminScope,
PanicCounter: adminScope.MustNewCounter("handler_panic",
"panics encountered while handling requests to the admin service"),
executionEndpointMetrics: executionEndpointMetrics{
scope: adminScope,
create: util.NewRequestMetrics(adminScope, "create_execution"),
relaunch: util.NewRequestMetrics(adminScope, "relaunch_execution"),
createEvent: util.NewRequestMetrics(adminScope, "create_execution_event"),
get: util.NewRequestMetrics(adminScope, "get_execution"),
getData: util.NewRequestMetrics(adminScope, "get_execution_data"),
list: util.NewRequestMetrics(adminScope, "list_execution"),
terminate: util.NewRequestMetrics(adminScope, "terminate_execution"),
},
launchPlanEndpointMetrics: launchPlanEndpointMetrics{
scope: adminScope,
create: util.NewRequestMetrics(adminScope, "create_launch_plan"),
update: util.NewRequestMetrics(adminScope, "update_launch_plan"),
get: util.NewRequestMetrics(adminScope, "get_launch_plan"),
getActive: util.NewRequestMetrics(adminScope, "get_active_launch_plan"),
list: util.NewRequestMetrics(adminScope, "list_launch_plan"),
listActive: util.NewRequestMetrics(adminScope, "list_active_launch_plans"),
listIds: util.NewRequestMetrics(adminScope, "list_launch_plan_ids"),
},
namedEntityEndpointMetrics: namedEntityEndpointMetrics{
scope: adminScope,
get: util.NewRequestMetrics(adminScope, "get_named_entity"),
list: util.NewRequestMetrics(adminScope, "list_named_entities"),
update: util.NewRequestMetrics(adminScope, "update_named_entity"),
},
nodeExecutionEndpointMetrics: nodeExecutionEndpointMetrics{
scope: adminScope,
createEvent: util.NewRequestMetrics(adminScope, "create_node_execution_event"),
get: util.NewRequestMetrics(adminScope, "get_node_execution"),
getData: util.NewRequestMetrics(adminScope, "get_node_execution_data"),
list: util.NewRequestMetrics(adminScope, "list_node_execution"),
listChildren: util.NewRequestMetrics(adminScope, "list_children_node_executions"),
},
projectEndpointMetrics: projectEndpointMetrics{
scope: adminScope,
register: util.NewRequestMetrics(adminScope, "register_project"),
list: util.NewRequestMetrics(adminScope, "list_projects"),
update: util.NewRequestMetrics(adminScope, "update_project"),
},
projectAttributesEndpointMetrics: attributeEndpointMetrics{
scope: adminScope,
update: util.NewRequestMetrics(adminScope, "update_project_attrs"),
get: util.NewRequestMetrics(adminScope, "get_project_attrs"),
delete: util.NewRequestMetrics(adminScope, "delete_project_attrs"),
},
projectDomainAttributesEndpointMetrics: attributeEndpointMetrics{
scope: adminScope,
update: util.NewRequestMetrics(adminScope, "update_project_domain_attrs"),
get: util.NewRequestMetrics(adminScope, "get_project_domain_attrs"),
delete: util.NewRequestMetrics(adminScope, "delete_project_domain_attrs"),
},
workflowAttributesEndpointMetrics: attributeEndpointMetrics{
scope: adminScope,
update: util.NewRequestMetrics(adminScope, "update_workflow_attrs"),
get: util.NewRequestMetrics(adminScope, "get_workflow_attrs"),
delete: util.NewRequestMetrics(adminScope, "delete_workflow_attrs"),
},
matchableAttributesEndpointMetrics: attributeEndpointMetrics{
scope: adminScope,
list: util.NewRequestMetrics(adminScope, "list_matchable_resource_attrs"),
},
taskEndpointMetrics: taskEndpointMetrics{
scope: adminScope,
create: util.NewRequestMetrics(adminScope, "create_task"),
get: util.NewRequestMetrics(adminScope, "get_task"),
list: util.NewRequestMetrics(adminScope, "list_task"),
listIds: util.NewRequestMetrics(adminScope, "list_task_ids"),
},
taskExecutionEndpointMetrics: taskExecutionEndpointMetrics{
scope: adminScope,
createEvent: util.NewRequestMetrics(adminScope, "create_task_execution_event"),
get: util.NewRequestMetrics(adminScope, "get_task_execution"),
getData: util.NewRequestMetrics(adminScope, "get_task_execution_data"),
list: util.NewRequestMetrics(adminScope, "list_task_execution"),
},
workflowEndpointMetrics: workflowEndpointMetrics{
scope: adminScope,
create: util.NewRequestMetrics(adminScope, "create_workflow"),
get: util.NewRequestMetrics(adminScope, "get_workflow"),
list: util.NewRequestMetrics(adminScope, "list_workflow"),
listIds: util.NewRequestMetrics(adminScope, "list_workflow_ids"),
},
}
}