From 274df4d9a30d122597996789774e60773524e7a7 Mon Sep 17 00:00:00 2001 From: Simon Bear Date: Wed, 25 Sep 2024 14:36:41 +1000 Subject: [PATCH] Add http.agent system property support to exec jar role --- ansible/roles/exec-jar/defaults/main.yml | 1 + ansible/roles/exec-jar/templates/service.conf | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 ansible/roles/exec-jar/defaults/main.yml diff --git a/ansible/roles/exec-jar/defaults/main.yml b/ansible/roles/exec-jar/defaults/main.yml new file mode 100644 index 000000000..2c19532a0 --- /dev/null +++ b/ansible/roles/exec-jar/defaults/main.yml @@ -0,0 +1 @@ +http_user_agent: "{{ service_name }}/{{ version }}" \ No newline at end of file diff --git a/ansible/roles/exec-jar/templates/service.conf b/ansible/roles/exec-jar/templates/service.conf index da61b09d0..218ca939c 100644 --- a/ansible/roles/exec-jar/templates/service.conf +++ b/ansible/roles/exec-jar/templates/service.conf @@ -2,6 +2,9 @@ JAVA_HOME="{{ java_home }}" JAVA_OPTS="-Djava.awt.headless=true -Xmx{{ max_memory | default('2g') }} -Xms{{ min_memory | default('1g') }}{% for jvm_param in jvm_params | default([]) %} {{jvm_param}}{% endfor %}{% for extra_param in extra_params | default([]) %} -D{{extra_param.key}}={{extra_param.value}}{% endfor %} {{java_security_opts}}" +{% if http_user_agent != None or http_user_agent != '' %} +JAVA_OPTS="${JAVA_OPTS} -Dhttp.agent={{ http_user_agent }}" +{% endif %} #JAVA_OPTS="${JAVA_OPTS} -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n" {% if datadog_java_apm_enabled is defined and datadog_java_apm_enabled %}