|
22 | 22 | from buildpack import util |
23 | 23 | from buildpack.core import runtime |
24 | 24 | from buildpack.infrastructure import database |
| 25 | +from buildpack.telemetry.metrics import deny_all_apm_metrics |
25 | 26 | from lib.m2ee.version import MXVersion |
26 | 27 | from lib.m2ee.util import strtobool |
27 | 28 |
|
@@ -253,7 +254,7 @@ def _set_up_dd_java_agent(m2ee, model_version, runtime_version, jmx_config_files |
253 | 254 | util.upsert_javaopts( |
254 | 255 | m2ee, |
255 | 256 | [ |
256 | | - "-Ddd.jmxfetch.enabled=true", |
| 257 | + f"-Ddd.jmxfetch.enabled=true", |
257 | 258 | f"-Ddd.jmxfetch.statsd.port={get_statsd_port()}", |
258 | 259 | ], |
259 | 260 | ) |
@@ -287,7 +288,7 @@ def _get_runtime_jmx_config(extra_jmx_instance_config=None): |
287 | 288 | # NamedUserSessions = 0; |
288 | 289 | # AnonymousSessions = 0; |
289 | 290 | "attribute": { |
290 | | - "NamedUsers": {"metrics_type": "gauge"}, |
| 291 | + "NamedUsers": {"metrics_type": "gauge", "alias": "mx.ekrem_test_named_users"}, |
291 | 292 | "NamedUserSessions": {"metrics_type": "gauge"}, |
292 | 293 | "AnonymousSessions": {"metrics_type": "gauge"}, |
293 | 294 | }, |
@@ -493,18 +494,19 @@ def update_config( |
493 | 494 | }, |
494 | 495 | ) |
495 | 496 |
|
496 | | - # Set up runtime JMX configuration |
497 | | - with open(_get_jmx_conf_file(), "w") as file_handler: |
498 | | - file_handler.write( |
499 | | - yaml.safe_dump( |
500 | | - _get_runtime_jmx_config( |
501 | | - extra_jmx_instance_config=extra_jmx_instance_config, |
| 497 | + if not deny_all_apm_metrics(): |
| 498 | + # Set up runtime JMX configuration |
| 499 | + with open(_get_jmx_conf_file(), "w") as file_handler: |
| 500 | + file_handler.write( |
| 501 | + yaml.safe_dump( |
| 502 | + _get_runtime_jmx_config( |
| 503 | + extra_jmx_instance_config=extra_jmx_instance_config, |
| 504 | + ) |
502 | 505 | ) |
503 | 506 | ) |
504 | | - ) |
| 507 | + jmx_config_files.append(_get_jmx_conf_file()) |
505 | 508 |
|
506 | 509 | # Set up Datadog Java Trace Agent |
507 | | - jmx_config_files.append(_get_jmx_conf_file()) |
508 | 510 | _set_up_dd_java_agent( |
509 | 511 | m2ee, |
510 | 512 | model_version, |
|
0 commit comments