diff --git a/.github/workflows/ansible.yml b/.github/workflows/ansible.yml index f33b61551f..bddf559198 100644 --- a/.github/workflows/ansible.yml +++ b/.github/workflows/ansible.yml @@ -12,6 +12,7 @@ on: - 'deployments/ansible/galaxy.yml' branches: - main + - ansible-new-zeroconfig pull_request: paths: - '.github/workflows/ansible.yml' diff --git a/deployments/ansible/molecule/with_instrumentation_preload_custom/Dockerfile.j2 b/deployments/ansible/molecule/with_instrumentation_preload_custom/Dockerfile.j2 new file mode 120000 index 0000000000..867ec5c3dc --- /dev/null +++ b/deployments/ansible/molecule/with_instrumentation_preload_custom/Dockerfile.j2 @@ -0,0 +1 @@ +../default/Dockerfile.j2 \ No newline at end of file diff --git a/deployments/ansible/molecule/with_instrumentation_preload_custom/converge.yml b/deployments/ansible/molecule/with_instrumentation_preload_custom/converge.yml new file mode 100644 index 0000000000..6e85bb4ac6 --- /dev/null +++ b/deployments/ansible/molecule/with_instrumentation_preload_custom/converge.yml @@ -0,0 +1,18 @@ +--- +- name: Converge scenario with auto-instrumentation installation + hosts: all + become: yes + vars: + splunk_access_token: fake-token + splunk_realm: fake-realm + install_splunk_otel_auto_instrumentation: true + splunk_otel_auto_instrumentation_resource_attributes: deployment.environment=test + splunk_otel_auto_instrumentation_service_name: test + splunk_otel_auto_instrumentation_enable_profiler: true + splunk_otel_auto_instrumentation_enable_profiler_memory: true + splunk_otel_auto_instrumentation_enable_metrics: true + splunk_otel_auto_instrumentation_otlp_endpoint: http://0.0.0.0:4317 + tasks: + - name: "Include signalfx.splunk_otel_collector.collector role" + include_role: + name: "collector" diff --git a/deployments/ansible/molecule/with_instrumentation_preload_custom/molecule.yml b/deployments/ansible/molecule/with_instrumentation_preload_custom/molecule.yml new file mode 100644 index 0000000000..2333d7016e --- /dev/null +++ b/deployments/ansible/molecule/with_instrumentation_preload_custom/molecule.yml @@ -0,0 +1 @@ +# no default config provided, make sure to set --base-config molecule argument instead diff --git a/deployments/ansible/molecule/with_instrumentation_preload_custom/verify.yml b/deployments/ansible/molecule/with_instrumentation_preload_custom/verify.yml new file mode 100644 index 0000000000..8de5eb2f2c --- /dev/null +++ b/deployments/ansible/molecule/with_instrumentation_preload_custom/verify.yml @@ -0,0 +1,85 @@ +--- +- name: Verify scenario with auto-instrumentation installation + hosts: all + gather_facts: false + tasks: + - name: Populate service facts + ansible.builtin.service_facts: + + - name: Assert splunk-otel-collector service is running + assert: + that: ansible_facts.services['splunk-otel-collector.service'].state == 'running' + + - name: Populate package facts + ansible.builtin.package_facts: + + - name: Get splunk-otel-auto-instrumentation version + set_fact: + auto_instrumentation_version: "{{ ansible_facts.packages['splunk-otel-auto-instrumentation'][0].version }}" + + - name: Check for systemd drop-in file + ansible.builtin.stat: + path: /usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf + register: systemd + + - name: Assert systemd drop-in file does not exist + assert: + that: not systemd.stat.exists + + - name: Assert /etc/ld.so.preload contains path to libsplunk.so + ansible.builtin.lineinfile: + line: /usr/lib/splunk-instrumentation/libsplunk.so + dest: /etc/ld.so.preload + state: present + check_mode: yes + + - name: Assert instrumentation config contains path to java agent + ansible.builtin.lineinfile: + line: JAVA_TOOL_OPTIONS=-javaagent:/usr/lib/splunk-instrumentation/splunk-otel-javaagent.jar + dest: /etc/splunk/zeroconfig/java.conf + state: present + check_mode: yes + + - name: Assert instrumentation config contains OTEL_RESOURCE_ATTRIBUTES + ansible.builtin.lineinfile: + line: "OTEL_RESOURCE_ATTRIBUTES=\ + splunk.zc.method=splunk-otel-auto-instrumentation-{{ auto_instrumentation_version }},\ + deployment.environment=test" + dest: /etc/splunk/zeroconfig/java.conf + state: present + check_mode: yes + + - name: Assert instrumentation config contains OTEL_SERVICE_NAME + ansible.builtin.lineinfile: + line: OTEL_SERVICE_NAME=test + dest: /etc/splunk/zeroconfig/java.conf + state: present + check_mode: yes + + - name: Assert instrumentation config contains SPLUNK_PROFILER_ENABLED + ansible.builtin.lineinfile: + line: SPLUNK_PROFILER_ENABLED=true + dest: /etc/splunk/zeroconfig/java.conf + state: present + check_mode: yes + + - name: Assert instrumentation config contains SPLUNK_PROFILER_MEMORY_ENABLED + ansible.builtin.lineinfile: + line: SPLUNK_PROFILER_MEMORY_ENABLED=true + dest: /etc/splunk/zeroconfig/java.conf + state: present + check_mode: yes + + - name: Assert instrumentation config contains SPLUNK_METRICS_ENABLED + ansible.builtin.lineinfile: + line: SPLUNK_METRICS_ENABLED=true + dest: /etc/splunk/zeroconfig/java.conf + state: present + check_mode: yes + + - name: Assert instrumentation config contains OTEL_EXPORTER_OTLP_ENDPOINT + ansible.builtin.lineinfile: + line: OTEL_EXPORTER_OTLP_ENDPOINT=http://0.0.0.0:4317 + dest: /etc/splunk/zeroconfig/java.conf + state: present + check_mode: yes diff --git a/deployments/ansible/molecule/with_instrumentation_preload_default/Dockerfile.j2 b/deployments/ansible/molecule/with_instrumentation_preload_default/Dockerfile.j2 new file mode 120000 index 0000000000..867ec5c3dc --- /dev/null +++ b/deployments/ansible/molecule/with_instrumentation_preload_default/Dockerfile.j2 @@ -0,0 +1 @@ +../default/Dockerfile.j2 \ No newline at end of file diff --git a/deployments/ansible/molecule/with_instrumentation_preload_default/converge.yml b/deployments/ansible/molecule/with_instrumentation_preload_default/converge.yml new file mode 100644 index 0000000000..865e54a41c --- /dev/null +++ b/deployments/ansible/molecule/with_instrumentation_preload_default/converge.yml @@ -0,0 +1,12 @@ +--- +- name: Converge scenario with auto-instrumentation installation + hosts: all + become: yes + vars: + splunk_access_token: fake-token + splunk_realm: fake-realm + install_splunk_otel_auto_instrumentation: true + tasks: + - name: "Include signalfx.splunk_otel_collector.collector role" + include_role: + name: "collector" diff --git a/deployments/ansible/molecule/with_instrumentation_preload_default/molecule.yml b/deployments/ansible/molecule/with_instrumentation_preload_default/molecule.yml new file mode 100644 index 0000000000..2333d7016e --- /dev/null +++ b/deployments/ansible/molecule/with_instrumentation_preload_default/molecule.yml @@ -0,0 +1 @@ +# no default config provided, make sure to set --base-config molecule argument instead diff --git a/deployments/ansible/molecule/with_instrumentation_preload_default/verify.yml b/deployments/ansible/molecule/with_instrumentation_preload_default/verify.yml new file mode 100644 index 0000000000..1d74ed416b --- /dev/null +++ b/deployments/ansible/molecule/with_instrumentation_preload_default/verify.yml @@ -0,0 +1,84 @@ +--- +- name: Verify scenario with auto-instrumentation installation + hosts: all + gather_facts: false + tasks: + - name: Populate service facts + ansible.builtin.service_facts: + + - name: Assert splunk-otel-collector service is running + assert: + that: ansible_facts.services['splunk-otel-collector.service'].state == 'running' + + - name: Populate package facts + ansible.builtin.package_facts: + + - name: Get splunk-otel-auto-instrumentation version + set_fact: + auto_instrumentation_version: "{{ ansible_facts.packages['splunk-otel-auto-instrumentation'][0].version }}" + + - name: Check for systemd drop-in file + ansible.builtin.stat: + path: /usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf + register: systemd + + - name: Assert systemd drop-in file does not exist + assert: + that: not systemd.stat.exists + + - name: Assert /etc/ld.so.preload contains path to libsplunk.so + ansible.builtin.lineinfile: + line: /usr/lib/splunk-instrumentation/libsplunk.so + dest: /etc/ld.so.preload + state: present + check_mode: yes + + - name: Assert instrumentation config contains path to java agent + ansible.builtin.lineinfile: + line: JAVA_TOOL_OPTIONS=-javaagent:/usr/lib/splunk-instrumentation/splunk-otel-javaagent.jar + dest: /etc/splunk/zeroconfig/java.conf + state: present + check_mode: yes + + - name: Assert instrumentation config contains OTEL_RESOURCE_ATTRIBUTES + ansible.builtin.lineinfile: + line: "OTEL_RESOURCE_ATTRIBUTES=\ + splunk.zc.method=splunk-otel-auto-instrumentation-{{ auto_instrumentation_version }}" + dest: /etc/splunk/zeroconfig/java.conf + state: present + check_mode: yes + + - name: Assert instrumentation config does not contain OTEL_SERVICE_NAME + ansible.builtin.lineinfile: + regexp: '.*OTEL_SERVICE_NAME.*' + dest: /etc/splunk/zeroconfig/java.conf + state: absent + check_mode: yes + + - name: Assert instrumentation config contains SPLUNK_PROFILER_ENABLED + ansible.builtin.lineinfile: + line: SPLUNK_PROFILER_ENABLED=false + dest: /etc/splunk/zeroconfig/java.conf + state: present + check_mode: yes + + - name: Assert instrumentation config contains SPLUNK_PROFILER_MEMORY_ENABLED + ansible.builtin.lineinfile: + line: SPLUNK_PROFILER_MEMORY_ENABLED=false + dest: /etc/splunk/zeroconfig/java.conf + state: present + check_mode: yes + + - name: Assert instrumentation config contains SPLUNK_METRICS_ENABLED + ansible.builtin.lineinfile: + line: SPLUNK_METRICS_ENABLED=false + dest: /etc/splunk/zeroconfig/java.conf + state: present + check_mode: yes + + - name: Assert instrumentation config contains OTEL_EXPORTER_OTLP_ENDPOINT + ansible.builtin.lineinfile: + line: OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4317 + dest: /etc/splunk/zeroconfig/java.conf + state: present + check_mode: yes diff --git a/deployments/ansible/molecule/with_instrumentation_systemd_custom/Dockerfile.j2 b/deployments/ansible/molecule/with_instrumentation_systemd_custom/Dockerfile.j2 new file mode 120000 index 0000000000..867ec5c3dc --- /dev/null +++ b/deployments/ansible/molecule/with_instrumentation_systemd_custom/Dockerfile.j2 @@ -0,0 +1 @@ +../default/Dockerfile.j2 \ No newline at end of file diff --git a/deployments/ansible/molecule/with_instrumentation_systemd_custom/converge.yml b/deployments/ansible/molecule/with_instrumentation_systemd_custom/converge.yml new file mode 100644 index 0000000000..b41ee9ab49 --- /dev/null +++ b/deployments/ansible/molecule/with_instrumentation_systemd_custom/converge.yml @@ -0,0 +1,19 @@ +--- +- name: Converge scenario with auto-instrumentation installation + hosts: all + become: yes + vars: + splunk_access_token: fake-token + splunk_realm: fake-realm + install_splunk_otel_auto_instrumentation: true + splunk_otel_auto_instrumentation_systemd: true + splunk_otel_auto_instrumentation_resource_attributes: deployment.environment=test + splunk_otel_auto_instrumentation_service_name: test + splunk_otel_auto_instrumentation_enable_profiler: true + splunk_otel_auto_instrumentation_enable_profiler_memory: true + splunk_otel_auto_instrumentation_enable_metrics: true + splunk_otel_auto_instrumentation_otlp_endpoint: http://0.0.0.0:4317 + tasks: + - name: "Include signalfx.splunk_otel_collector.collector role" + include_role: + name: "collector" diff --git a/deployments/ansible/molecule/with_instrumentation_systemd_custom/molecule.yml b/deployments/ansible/molecule/with_instrumentation_systemd_custom/molecule.yml new file mode 100644 index 0000000000..2333d7016e --- /dev/null +++ b/deployments/ansible/molecule/with_instrumentation_systemd_custom/molecule.yml @@ -0,0 +1 @@ +# no default config provided, make sure to set --base-config molecule argument instead diff --git a/deployments/ansible/molecule/with_instrumentation_systemd_custom/verify.yml b/deployments/ansible/molecule/with_instrumentation_systemd_custom/verify.yml new file mode 100644 index 0000000000..e1dd18f944 --- /dev/null +++ b/deployments/ansible/molecule/with_instrumentation_systemd_custom/verify.yml @@ -0,0 +1,79 @@ +--- +- name: Verify scenario with auto-instrumentation installation + hosts: all + gather_facts: false + tasks: + - name: Populate service facts + ansible.builtin.service_facts: + + - name: Assert splunk-otel-collector service is running + assert: + that: ansible_facts.services['splunk-otel-collector.service'].state == 'running' + + - name: Populate package facts + ansible.builtin.package_facts: + + - name: Get splunk-otel-auto-instrumentation version + set_fact: + auto_instrumentation_version: "{{ ansible_facts.packages['splunk-otel-auto-instrumentation'][0].version }}" + + - name: Check for /etc/ld.so.preload + ansible.builtin.stat: + path: /etc/ld.so.preload + register: preload + + - name: Assert /etc/ld.so.preload does not exist + assert: + that: not preload.stat.exists + + - name: Assert instrumentation config contains path to java agent + ansible.builtin.lineinfile: + line: "DefaultEnvironment=\"JAVA_TOOL_OPTIONS=\ + -javaagent:/usr/lib/splunk-instrumentation/splunk-otel-javaagent.jar\"" + dest: /usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf + state: present + check_mode: yes + + - name: Assert instrumentation config contains OTEL_RESOURCE_ATTRIBUTES + ansible.builtin.lineinfile: + line: "DefaultEnvironment=\"OTEL_RESOURCE_ATTRIBUTES=\ + splunk.zc.method=splunk-otel-auto-instrumentation-{{ auto_instrumentation_version }},\ + deployment.environment=test\"" + dest: /usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf + state: present + check_mode: yes + + - name: Assert instrumentation config contains OTEL_SERVICE_NAME + ansible.builtin.lineinfile: + line: DefaultEnvironment="OTEL_SERVICE_NAME=test" + dest: /usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf + state: present + check_mode: yes + + - name: Assert instrumentation config contains SPLUNK_PROFILER_ENABLED + ansible.builtin.lineinfile: + line: DefaultEnvironment="SPLUNK_PROFILER_ENABLED=true" + dest: /usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf + state: present + check_mode: yes + + - name: Assert instrumentation config contains SPLUNK_PROFILER_MEMORY_ENABLED + ansible.builtin.lineinfile: + line: DefaultEnvironment="SPLUNK_PROFILER_MEMORY_ENABLED=true" + dest: /usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf + state: present + check_mode: yes + + - name: Assert instrumentation config contains SPLUNK_METRICS_ENABLED + ansible.builtin.lineinfile: + line: DefaultEnvironment="SPLUNK_METRICS_ENABLED=true" + dest: /usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf + state: present + check_mode: yes + + - name: Assert instrumentation config contains OTEL_EXPORTER_OTLP_ENDPOINT + ansible.builtin.lineinfile: + line: DefaultEnvironment="OTEL_EXPORTER_OTLP_ENDPOINT=http://0.0.0.0:4317" + dest: /usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf + state: present + check_mode: yes diff --git a/deployments/ansible/molecule/with_instrumentation_systemd_default/Dockerfile.j2 b/deployments/ansible/molecule/with_instrumentation_systemd_default/Dockerfile.j2 new file mode 120000 index 0000000000..867ec5c3dc --- /dev/null +++ b/deployments/ansible/molecule/with_instrumentation_systemd_default/Dockerfile.j2 @@ -0,0 +1 @@ +../default/Dockerfile.j2 \ No newline at end of file diff --git a/deployments/ansible/molecule/with_instrumentation_systemd_default/converge.yml b/deployments/ansible/molecule/with_instrumentation_systemd_default/converge.yml new file mode 100644 index 0000000000..72a3142da2 --- /dev/null +++ b/deployments/ansible/molecule/with_instrumentation_systemd_default/converge.yml @@ -0,0 +1,13 @@ +--- +- name: Converge scenario with auto-instrumentation installation + hosts: all + become: yes + vars: + splunk_access_token: fake-token + splunk_realm: fake-realm + install_splunk_otel_auto_instrumentation: true + splunk_otel_auto_instrumentation_systemd: true + tasks: + - name: "Include signalfx.splunk_otel_collector.collector role" + include_role: + name: "collector" diff --git a/deployments/ansible/molecule/with_instrumentation_systemd_default/molecule.yml b/deployments/ansible/molecule/with_instrumentation_systemd_default/molecule.yml new file mode 100644 index 0000000000..2333d7016e --- /dev/null +++ b/deployments/ansible/molecule/with_instrumentation_systemd_default/molecule.yml @@ -0,0 +1 @@ +# no default config provided, make sure to set --base-config molecule argument instead diff --git a/deployments/ansible/molecule/with_instrumentation_systemd_default/verify.yml b/deployments/ansible/molecule/with_instrumentation_systemd_default/verify.yml new file mode 100644 index 0000000000..77a0b321b5 --- /dev/null +++ b/deployments/ansible/molecule/with_instrumentation_systemd_default/verify.yml @@ -0,0 +1,78 @@ +--- +- name: Verify scenario with auto-instrumentation installation + hosts: all + gather_facts: false + tasks: + - name: Populate service facts + ansible.builtin.service_facts: + + - name: Assert splunk-otel-collector service is running + assert: + that: ansible_facts.services['splunk-otel-collector.service'].state == 'running' + + - name: Populate package facts + ansible.builtin.package_facts: + + - name: Get splunk-otel-auto-instrumentation version + set_fact: + auto_instrumentation_version: "{{ ansible_facts.packages['splunk-otel-auto-instrumentation'][0].version }}" + + - name: Check for /etc/ld.so.preload + ansible.builtin.stat: + path: /etc/ld.so.preload + register: preload + + - name: Assert /etc/ld.so.preload does not exist + assert: + that: not preload.stat.exists + + - name: Assert instrumentation config contains path to java agent + ansible.builtin.lineinfile: + line: "DefaultEnvironment=\"JAVA_TOOL_OPTIONS=\ + -javaagent:/usr/lib/splunk-instrumentation/splunk-otel-javaagent.jar\"" + dest: /usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf + state: present + check_mode: yes + + - name: Assert instrumentation config contains OTEL_RESOURCE_ATTRIBUTES + ansible.builtin.lineinfile: + line: "DefaultEnvironment=\"OTEL_RESOURCE_ATTRIBUTES=\ + splunk.zc.method=splunk-otel-auto-instrumentation-{{ auto_instrumentation_version }}\"" + dest: /usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf + state: present + check_mode: yes + + - name: Assert instrumentation config contains OTEL_SERVICE_NAME + ansible.builtin.lineinfile: + regexp: '.*OTEL_SERVICE_NAME.*' + dest: /usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf + state: absent + check_mode: yes + + - name: Assert instrumentation config contains SPLUNK_PROFILER_ENABLED + ansible.builtin.lineinfile: + line: DefaultEnvironment="SPLUNK_PROFILER_ENABLED=false" + dest: /usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf + state: present + check_mode: yes + + - name: Assert instrumentation config contains SPLUNK_PROFILER_MEMORY_ENABLED + ansible.builtin.lineinfile: + line: DefaultEnvironment="SPLUNK_PROFILER_MEMORY_ENABLED=false" + dest: /usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf + state: present + check_mode: yes + + - name: Assert instrumentation config contains SPLUNK_METRICS_ENABLED + ansible.builtin.lineinfile: + line: DefaultEnvironment="SPLUNK_METRICS_ENABLED=false" + dest: /usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf + state: present + check_mode: yes + + - name: Assert instrumentation config contains OTEL_EXPORTER_OTLP_ENDPOINT + ansible.builtin.lineinfile: + line: DefaultEnvironment="OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4317" + dest: /usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf + state: present + check_mode: yes diff --git a/deployments/ansible/roles/collector/defaults/main.yml b/deployments/ansible/roles/collector/defaults/main.yml index 74832d8eef..19390ac5df 100644 --- a/deployments/ansible/roles/collector/defaults/main.yml +++ b/deployments/ansible/roles/collector/defaults/main.yml @@ -62,6 +62,7 @@ splunk_otel_collector_proxy_https: "" splunk_otel_collector_no_proxy: "localhost,127.0.0.1,::1" install_splunk_otel_auto_instrumentation: false +splunk_otel_auto_instrumentation_systemd: false splunk_otel_auto_instrumentation_version: latest splunk_otel_auto_instrumentation_ld_so_preload: "" splunk_otel_auto_instrumentation_java_agent_jar: /usr/lib/splunk-instrumentation/splunk-otel-javaagent.jar @@ -72,6 +73,7 @@ splunk_otel_auto_instrumentation_disable_telemetry: false splunk_otel_auto_instrumentation_enable_profiler: false splunk_otel_auto_instrumentation_enable_profiler_memory: false splunk_otel_auto_instrumentation_enable_metrics: false +splunk_otel_auto_instrumentation_otlp_endpoint: http://127.0.0.1:4317 # Custom environment variables for the collector service splunk_otel_collector_additional_env_vars: {} diff --git a/deployments/ansible/roles/collector/tasks/linux_install.yml b/deployments/ansible/roles/collector/tasks/linux_install.yml index edf4d1f2f3..5852b57bb4 100644 --- a/deployments/ansible/roles/collector/tasks/linux_install.yml +++ b/deployments/ansible/roles/collector/tasks/linux_install.yml @@ -83,7 +83,7 @@ ansible.builtin.template: src: ld_so_preload.j2 dest: /etc/ld.so.preload - when: install_splunk_otel_auto_instrumentation + when: install_splunk_otel_auto_instrumentation and not (splunk_otel_auto_instrumentation_systemd | bool) - name: Get installed package facts package_facts: @@ -99,4 +99,19 @@ ansible.builtin.template: src: splunk-otel-auto-instrumentation.conf.j2 dest: /usr/lib/splunk-instrumentation/instrumentation.conf - when: install_splunk_otel_auto_instrumentation + when: install_splunk_otel_auto_instrumentation and auto_instrumentation_version is version('0.87.0', '<') and \ + not (splunk_otel_auto_instrumentation_systemd | bool) + +- name: Set up the Splunk OpenTelemetry Auto Instrumentation for Java config file + ansible.builtin.template: + src: java.conf.j2 + dest: /etc/splunk/zeroconfig/java.conf + when: install_splunk_otel_auto_instrumentation and auto_instrumentation_version is version('0.87.0', '>=') and \ + not (splunk_otel_auto_instrumentation_systemd | bool) + +- name: Set up systemd for Splunk OpenTelemetry Auto Instrumentation + ansible.builtin.template: + src: 00-splunk-otel-auto-instrumentation.conf.j2 + dest: /usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf + when: install_splunk_otel_auto_instrumentation and (splunk_otel_auto_instrumentation_systemd | bool) + notify: Reload systemd daemon diff --git a/deployments/ansible/roles/collector/templates/00-splunk-otel-auto-instrumentation.conf.j2 b/deployments/ansible/roles/collector/templates/00-splunk-otel-auto-instrumentation.conf.j2 new file mode 100644 index 0000000000..6e1b132387 --- /dev/null +++ b/deployments/ansible/roles/collector/templates/00-splunk-otel-auto-instrumentation.conf.j2 @@ -0,0 +1,14 @@ +[Manager] +DefaultEnvironment="JAVA_TOOL_OPTIONS=-javaagent:{{ splunk_otel_auto_instrumentation_java_agent_jar }}" +DefaultEnvironment="OTEL_EXPORTER_OTLP_ENDPOINT={{ splunk_otel_auto_instrumentation_otlp_endpoint }}" +{% if splunk_otel_auto_instrumentation_resource_attributes is defined and splunk_otel_auto_instrumentation_resource_attributes %} +DefaultEnvironment="OTEL_RESOURCE_ATTRIBUTES=splunk.zc.method=splunk-otel-auto-instrumentation-{{ auto_instrumentation_version }},{{ splunk_otel_auto_instrumentation_resource_attributes }}" +{% else %} +DefaultEnvironment="OTEL_RESOURCE_ATTRIBUTES=splunk.zc.method=splunk-otel-auto-instrumentation-{{ auto_instrumentation_version }}" +{% endif %} +{% if splunk_otel_auto_instrumentation_service_name is defined and splunk_otel_auto_instrumentation_service_name %} +DefaultEnvironment="OTEL_SERVICE_NAME={{ splunk_otel_auto_instrumentation_service_name }}" +{% endif %} +DefaultEnvironment="SPLUNK_PROFILER_ENABLED={{ splunk_otel_auto_instrumentation_enable_profiler | string | lower }}" +DefaultEnvironment="SPLUNK_PROFILER_MEMORY_ENABLED={{ splunk_otel_auto_instrumentation_enable_profiler_memory | string | lower }}" +DefaultEnvironment="SPLUNK_METRICS_ENABLED={{ splunk_otel_auto_instrumentation_enable_metrics | string | lower }}" diff --git a/deployments/ansible/roles/collector/templates/java.conf.j2 b/deployments/ansible/roles/collector/templates/java.conf.j2 new file mode 100644 index 0000000000..9767825727 --- /dev/null +++ b/deployments/ansible/roles/collector/templates/java.conf.j2 @@ -0,0 +1,13 @@ +JAVA_TOOL_OPTIONS=-javaagent:{{ splunk_otel_auto_instrumentation_java_agent_jar }} +OTEL_EXPORTER_OTLP_ENDPOINT={{ splunk_otel_auto_instrumentation_otlp_endpoint }} +{% if splunk_otel_auto_instrumentation_resource_attributes is defined and splunk_otel_auto_instrumentation_resource_attributes %} +OTEL_RESOURCE_ATTRIBUTES=splunk.zc.method=splunk-otel-auto-instrumentation-{{ auto_instrumentation_version }},{{ splunk_otel_auto_instrumentation_resource_attributes }} +{% else %} +OTEL_RESOURCE_ATTRIBUTES=splunk.zc.method=splunk-otel-auto-instrumentation-{{ auto_instrumentation_version }} +{% endif %} +{% if splunk_otel_auto_instrumentation_service_name is defined and splunk_otel_auto_instrumentation_service_name %} +OTEL_SERVICE_NAME={{ splunk_otel_auto_instrumentation_service_name }} +{% endif %} +SPLUNK_PROFILER_ENABLED={{ splunk_otel_auto_instrumentation_enable_profiler | string | lower }} +SPLUNK_PROFILER_MEMORY_ENABLED={{ splunk_otel_auto_instrumentation_enable_profiler_memory | string | lower }} +SPLUNK_METRICS_ENABLED={{ splunk_otel_auto_instrumentation_enable_metrics | string | lower }}