-
Notifications
You must be signed in to change notification settings - Fork 6
/
runtime_metric_mappings.go
380 lines (370 loc) · 11.6 KB
/
runtime_metric_mappings.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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
package metrics
// runtimeMetricPrefixLanguageMap defines the runtime metric prefixes and which languages they map to
var runtimeMetricPrefixLanguageMap = map[string]string{
"process.runtime.go": "go",
"process.runtime.dotnet": "dotnet",
"process.runtime.jvm": "jvm",
"jvm": "jvm",
}
// runtimeMetricMapping defines the fields needed to map OTel runtime metrics to their equivalent
// Datadog runtime metrics
type runtimeMetricMapping struct {
mappedName string // the Datadog runtime metric name
attributes []runtimeMetricAttribute // the attribute(s) this metric originates from
}
// runtimeMetricAttribute defines the structure for an attribute in regard to mapping runtime metrics.
// The presence of a runtimeMetricAttribute means that a metric must be mapped from a data point
// with the given attribute(s).
type runtimeMetricAttribute struct {
key string // the attribute name
values []string // the attribute value, or multiple values if there is more than one value for the same mapping
}
// runtimeMetricMappingList defines the structure for a list of runtime metric mappings where the key
// represents the OTel metric name and the runtimeMetricMapping contains the Datadog metric name
type runtimeMetricMappingList map[string][]runtimeMetricMapping
var goRuntimeMetricsMappings = runtimeMetricMappingList{
"process.runtime.go.goroutines": {{mappedName: "runtime.go.num_goroutine"}},
"process.runtime.go.cgo.calls": {{mappedName: "runtime.go.num_cgo_call"}},
"process.runtime.go.lookups": {{mappedName: "runtime.go.mem_stats.lookups"}},
"process.runtime.go.mem.heap_alloc": {{mappedName: "runtime.go.mem_stats.heap_alloc"}},
"process.runtime.go.mem.heap_sys": {{mappedName: "runtime.go.mem_stats.heap_sys"}},
"process.runtime.go.mem.heap_idle": {{mappedName: "runtime.go.mem_stats.heap_idle"}},
"process.runtime.go.mem.heap_inuse": {{mappedName: "runtime.go.mem_stats.heap_inuse"}},
"process.runtime.go.mem.heap_released": {{mappedName: "runtime.go.mem_stats.heap_released"}},
"process.runtime.go.mem.heap_objects": {{mappedName: "runtime.go.mem_stats.heap_objects"}},
"process.runtime.go.gc.pause_total_ns": {{mappedName: "runtime.go.mem_stats.pause_total_ns"}},
"process.runtime.go.gc.count": {{mappedName: "runtime.go.mem_stats.num_gc"}},
}
var dotnetRuntimeMetricsMappings = runtimeMetricMappingList{
"process.runtime.dotnet.monitor.lock_contention.count": {{mappedName: "runtime.dotnet.threads.contention_count"}},
"process.runtime.dotnet.exceptions.count": {{mappedName: "runtime.dotnet.exceptions.count"}},
"process.runtime.dotnet.gc.heap.size": {{
mappedName: "runtime.dotnet.gc.size.gen0",
attributes: []runtimeMetricAttribute{{
key: "generation",
values: []string{"gen0"},
}},
}, {
mappedName: "runtime.dotnet.gc.size.gen1",
attributes: []runtimeMetricAttribute{{
key: "generation",
values: []string{"gen1"},
}},
}, {
mappedName: "runtime.dotnet.gc.size.gen2",
attributes: []runtimeMetricAttribute{{
key: "generation",
values: []string{"gen2"},
}},
}, {
mappedName: "runtime.dotnet.gc.size.loh",
attributes: []runtimeMetricAttribute{{
key: "generation",
values: []string{"loh"},
}},
}},
"process.runtime.dotnet.gc.collections.count": {{
mappedName: "runtime.dotnet.gc.count.gen0",
attributes: []runtimeMetricAttribute{{
key: "generation",
values: []string{"gen0"},
}},
}, {
mappedName: "runtime.dotnet.gc.count.gen1",
attributes: []runtimeMetricAttribute{{
key: "generation",
values: []string{"gen1"},
}},
}, {
mappedName: "runtime.dotnet.gc.count.gen2",
attributes: []runtimeMetricAttribute{{
key: "generation",
values: []string{"gen2"},
}},
}},
}
var stableJavaRuntimeMetricsMappings = runtimeMetricMappingList{
"jvm.thread.count": {{mappedName: "jvm.thread_count"}},
"jvm.class.count": {{mappedName: "jvm.loaded_classes"}},
"jvm.system.cpu.utilization": {{mappedName: "jvm.cpu_load.system"}},
"jvm.cpu.recent_utilization": {{mappedName: "jvm.cpu_load.process"}},
"jvm.memory.used": {{
mappedName: "jvm.heap_memory",
attributes: []runtimeMetricAttribute{{
key: "jvm.memory.type",
values: []string{"heap"},
}},
}, {
mappedName: "jvm.non_heap_memory",
attributes: []runtimeMetricAttribute{{
key: "jvm.memory.type",
values: []string{"non_heap"},
}},
}, {
mappedName: "jvm.gc.old_gen_size",
attributes: []runtimeMetricAttribute{{
key: "jvm.memory.pool.name",
values: []string{"G1 Old Gen", "Tenured Gen", "PS Old Gen"},
}, {
key: "jvm.memory.type",
values: []string{"heap"},
}},
}, {
mappedName: "jvm.gc.eden_size",
attributes: []runtimeMetricAttribute{{
key: "jvm.memory.pool.name",
values: []string{"G1 Eden Space", "Eden Space", "Par Eden Space", "PS Eden Space"},
}, {
key: "jvm.memory.type",
values: []string{"heap"},
}},
}, {
mappedName: "jvm.gc.survivor_size",
attributes: []runtimeMetricAttribute{{
key: "jvm.memory.pool.name",
values: []string{"G1 Survivor Space", "Survivor Space", "Par Survivor Space", "PS Survivor Space"},
}, {
key: "jvm.memory.type",
values: []string{"heap"},
}},
}, {
mappedName: "jvm.gc.metaspace_size",
attributes: []runtimeMetricAttribute{{
key: "jvm.memory.pool.name",
values: []string{"Metaspace"},
}, {
key: "jvm.memory.type",
values: []string{"non_heap"},
}},
}},
"jvm.memory.committed": {{
mappedName: "jvm.heap_memory_committed",
attributes: []runtimeMetricAttribute{{
key: "jvm.memory.type",
values: []string{"heap"},
}},
}, {
mappedName: "jvm.non_heap_memory_committed",
attributes: []runtimeMetricAttribute{{
key: "jvm.memory.type",
values: []string{"non_heap"},
}},
}},
"jvm.memory.init": {{
mappedName: "jvm.heap_memory_init",
attributes: []runtimeMetricAttribute{{
key: "jvm.memory.type",
values: []string{"heap"},
}},
}, {
mappedName: "jvm.non_heap_memory_init",
attributes: []runtimeMetricAttribute{{
key: "jvm.memory.type",
values: []string{"non_heap"},
}},
}},
"jvm.memory.limit": {{
mappedName: "jvm.heap_memory_max",
attributes: []runtimeMetricAttribute{{
key: "jvm.memory.type",
values: []string{"heap"},
}},
}, {
mappedName: "jvm.non_heap_memory_max",
attributes: []runtimeMetricAttribute{{
key: "jvm.memory.type",
values: []string{"non_heap"},
}},
}},
"jvm.buffer.memory.usage": {{
mappedName: "jvm.buffer_pool.direct.used",
attributes: []runtimeMetricAttribute{{
key: "jvm.buffer.pool.name",
values: []string{"direct"},
}},
}, {
mappedName: "jvm.buffer_pool.mapped.used",
attributes: []runtimeMetricAttribute{{
key: "jvm.buffer.pool.name",
values: []string{"mapped"},
}},
}},
"jvm.buffer.count": {{
mappedName: "jvm.buffer_pool.direct.count",
attributes: []runtimeMetricAttribute{{
key: "jvm.buffer.pool.name",
values: []string{"direct"},
}},
}, {
mappedName: "jvm.buffer_pool.mapped.count",
attributes: []runtimeMetricAttribute{{
key: "jvm.buffer.pool.name",
values: []string{"mapped"},
}},
}},
"jvm.buffer.memory.limit": {{
mappedName: "jvm.buffer_pool.direct.limit",
attributes: []runtimeMetricAttribute{{
key: "jvm.buffer.pool.name",
values: []string{"direct"},
}},
}, {
mappedName: "jvm.buffer_pool.mapped.limit",
attributes: []runtimeMetricAttribute{{
key: "jvm.buffer.pool.name",
values: []string{"mapped"},
}},
}},
}
var javaRuntimeMetricsMappings = runtimeMetricMappingList{
"process.runtime.jvm.threads.count": {{mappedName: "jvm.thread_count"}},
"process.runtime.jvm.classes.current_loaded": {{mappedName: "jvm.loaded_classes"}},
"process.runtime.jvm.system.cpu.utilization": {{mappedName: "jvm.cpu_load.system"}},
"process.runtime.jvm.cpu.utilization": {{mappedName: "jvm.cpu_load.process"}},
"process.runtime.jvm.memory.usage": {{
mappedName: "jvm.heap_memory",
attributes: []runtimeMetricAttribute{{
key: "type",
values: []string{"heap"},
}},
}, {
mappedName: "jvm.non_heap_memory",
attributes: []runtimeMetricAttribute{{
key: "type",
values: []string{"non_heap"},
}},
}, {
mappedName: "jvm.gc.old_gen_size",
attributes: []runtimeMetricAttribute{{
key: "pool",
values: []string{"G1 Old Gen", "Tenured Gen", "PS Old Gen"},
}, {
key: "type",
values: []string{"heap"},
}},
}, {
mappedName: "jvm.gc.eden_size",
attributes: []runtimeMetricAttribute{{
key: "pool",
values: []string{"G1 Eden Space", "Eden Space", "Par Eden Space", "PS Eden Space"},
}, {
key: "type",
values: []string{"heap"},
}},
}, {
mappedName: "jvm.gc.survivor_size",
attributes: []runtimeMetricAttribute{{
key: "pool",
values: []string{"G1 Survivor Space", "Survivor Space", "Par Survivor Space", "PS Survivor Space"},
}, {
key: "type",
values: []string{"heap"},
}},
}, {
mappedName: "jvm.gc.metaspace_size",
attributes: []runtimeMetricAttribute{{
key: "pool",
values: []string{"Metaspace"},
}, {
key: "type",
values: []string{"non_heap"},
}},
}},
"process.runtime.jvm.memory.committed": {{
mappedName: "jvm.heap_memory_committed",
attributes: []runtimeMetricAttribute{{
key: "type",
values: []string{"heap"},
}},
}, {
mappedName: "jvm.non_heap_memory_committed",
attributes: []runtimeMetricAttribute{{
key: "type",
values: []string{"non_heap"},
}},
}},
"process.runtime.jvm.memory.init": {{
mappedName: "jvm.heap_memory_init",
attributes: []runtimeMetricAttribute{{
key: "type",
values: []string{"heap"},
}},
}, {
mappedName: "jvm.non_heap_memory_init",
attributes: []runtimeMetricAttribute{{
key: "type",
values: []string{"non_heap"},
}},
}},
"process.runtime.jvm.memory.limit": {{
mappedName: "jvm.heap_memory_max",
attributes: []runtimeMetricAttribute{{
key: "type",
values: []string{"heap"},
}},
}, {
mappedName: "jvm.non_heap_memory_max",
attributes: []runtimeMetricAttribute{{
key: "type",
values: []string{"non_heap"},
}},
}},
"process.runtime.jvm.buffer.usage": {{
mappedName: "jvm.buffer_pool.direct.used",
attributes: []runtimeMetricAttribute{{
key: "pool",
values: []string{"direct"},
}},
}, {
mappedName: "jvm.buffer_pool.mapped.used",
attributes: []runtimeMetricAttribute{{
key: "pool",
values: []string{"mapped"},
}},
}},
"process.runtime.jvm.buffer.count": {{
mappedName: "jvm.buffer_pool.direct.count",
attributes: []runtimeMetricAttribute{{
key: "pool",
values: []string{"direct"},
}},
}, {
mappedName: "jvm.buffer_pool.mapped.count",
attributes: []runtimeMetricAttribute{{
key: "pool",
values: []string{"mapped"},
}},
}},
"process.runtime.jvm.buffer.limit": {{
mappedName: "jvm.buffer_pool.direct.limit",
attributes: []runtimeMetricAttribute{{
key: "pool",
values: []string{"direct"},
}},
}, {
mappedName: "jvm.buffer_pool.mapped.limit",
attributes: []runtimeMetricAttribute{{
key: "pool",
values: []string{"mapped"},
}},
}},
}
func getRuntimeMetricsMappings() runtimeMetricMappingList {
res := runtimeMetricMappingList{}
for k, v := range goRuntimeMetricsMappings {
res[k] = v
}
for k, v := range dotnetRuntimeMetricsMappings {
res[k] = v
}
for k, v := range javaRuntimeMetricsMappings {
res[k] = v
}
for k, v := range stableJavaRuntimeMetricsMappings {
res[k] = v
}
return res
}
// runtimeMetricsMappings defines the mappings from OTel runtime metric names to their
// equivalent Datadog runtime metric names
var runtimeMetricsMappings = getRuntimeMetricsMappings()