Skip to content

Commit 0ba76a4

Browse files
committed
feat: update custom jmx metrics' names.
use 'mx' prefix instead of jmx so that the metrics are indexed for free by Datadog
1 parent 04b221e commit 0ba76a4

File tree

1 file changed

+18
-22
lines changed

1 file changed

+18
-22
lines changed

buildpack/telemetry/datadog.py

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,9 @@ def _get_runtime_jmx_config(extra_jmx_instance_config=None):
272272
# and run app/.local/bin/java -jar ~/jmxterm.jar
273273
#
274274
# The extra attributes are only available from Mendix 7.15.0+
275+
# Note: aliases are added later to make the metrics available for free on
276+
# Datadog as `mx` is supported prefix. Before that, all these metrics were
277+
# being indexed as custom metrics by Datadog which are not free.
275278
config = {
276279
"init_config": {},
277280
"instances": [
@@ -287,9 +290,9 @@ def _get_runtime_jmx_config(extra_jmx_instance_config=None):
287290
# NamedUserSessions = 0;
288291
# AnonymousSessions = 0;
289292
"attribute": {
290-
"NamedUsers": {"metrics_type": "gauge"},
291-
"NamedUserSessions": {"metrics_type": "gauge"},
292-
"AnonymousSessions": {"metrics_type": "gauge"},
293+
"NamedUsers": {"metrics_type": "gauge", "alias": "mx.com.mendix.named_users"},
294+
"NamedUserSessions": {"metrics_type": "gauge", "alias": "mx.com.mendix.named_user_sessions"},
295+
"AnonymousSessions": {"metrics_type": "gauge", "alias": "mx.com.mendix.anonymous_sessions"},
293296
},
294297
}
295298
},
@@ -302,11 +305,11 @@ def _get_runtime_jmx_config(extra_jmx_instance_config=None):
302305
# Deletes = 0;
303306
# Transactions = 25;
304307
"attribute": {
305-
"Selects": {"metrics_type": "counter"},
306-
"Updates": {"metrics_type": "counter"},
307-
"Inserts": {"metrics_type": "counter"},
308-
"Deletes": {"metrics_type": "counter"},
309-
"Transactions": {"metrics_type": "counter"},
308+
"Selects": {"metrics_type": "counter", "alias": "mx.com.mendix.selects"},
309+
"Updates": {"metrics_type": "counter", "alias": "mx.com.mendix.updates"},
310+
"Inserts": {"metrics_type": "counter", "alias": "mx.com.mendix.inserts"},
311+
"Deletes": {"metrics_type": "counter", "alias": "mx.com.mendix.deletes"},
312+
"Transactions": {"metrics_type": "counter", "alias": "mx.com.mendix.transactions"},
310313
},
311314
}
312315
},
@@ -315,7 +318,9 @@ def _get_runtime_jmx_config(extra_jmx_instance_config=None):
315318
"bean": "com.mendix:type=General",
316319
# Languages = en_US;
317320
# Entities = 24;
318-
"attribute": {"Entities": {"metrics_type": "gauge"}},
321+
"attribute": {
322+
"Entities": {"metrics_type": "gauge", "alias": "mx.com.mendix.entities"},
323+
},
319324
}
320325
},
321326
{
@@ -330,23 +335,14 @@ def _get_runtime_jmx_config(extra_jmx_instance_config=None):
330335
# ThreadsPriority = 5;
331336
# QueueSize = 0;
332337
"attribute": {
333-
"Threads": {"metrics_type": "gauge"},
334-
"MaxThreads": {"metrics_type": "gauge"},
335-
"IdleThreads": {"metrics_type": "gauge"},
336-
"QueueSize": {"metrics_type": "gauge"},
338+
"Threads": {"metrics_type": "gauge", "alias": "mx.com.mendix.threads"},
339+
"MaxThreads": {"metrics_type": "gauge", "alias": "mx.com.mendix.max_threads"},
340+
"IdleThreads": {"metrics_type": "gauge", "alias": "mx.com.mendix.idle_threads"},
341+
"QueueSize": {"metrics_type": "gauge", "alias": "mx.com.mendix.queue_size"},
337342
},
338343
}
339344
},
340345
],
341-
# }, {
342-
# 'include': {
343-
# 'bean': 'com.mendix:type=Jetty',
344-
# # ConnectedEndPoints = 0;
345-
# # IdleTimeout = 30000;
346-
# # RequestsActiveMax = 0;
347-
# 'attribute': {
348-
# }
349-
# },
350346
}
351347
],
352348
}

0 commit comments

Comments
 (0)