Skip to content

Commit 7118df8

Browse files
test
1 parent 4aae9ef commit 7118df8

File tree

24 files changed

+689
-7
lines changed

24 files changed

+689
-7
lines changed

.github/workflows/ansible.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
- 'deployments/ansible/galaxy.yml'
1313
branches:
1414
- main
15+
- dotnet-zc-ansible
1516
pull_request:
1617
paths:
1718
- '.github/workflows/ansible.yml'

deployments/ansible/molecule/with_instrumentation/verify.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
loop:
2424
- /etc/splunk/zeroconfig/java.conf
2525
- /etc/splunk/zeroconfig/node.conf
26+
- /etc/splunk/zeroconfig/dotnet.conf
2627
register: new_config_files
2728

2829
- name: Assert the new config files do not exist

deployments/ansible/molecule/with_instrumentation_preload_custom/verify.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,24 @@
7676
register: config
7777
failed_when: config is changed
7878

79+
- name: Assert instrumentation config contains .NET env vars
80+
ansible.builtin.lineinfile:
81+
line: "{{ item }}"
82+
dest: /etc/splunk/zeroconfig/dotnet.conf
83+
state: present
84+
check_mode: yes
85+
register: config
86+
failed_when: config is changed
87+
loop:
88+
- CORECLR_ENABLE_PROFILING=1
89+
- CORECLR_PROFILER={918728DD-259F-4A6A-AC2B-B85E1B658318}
90+
- CORECLR_PROFILER_PATH=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so
91+
- DOTNET_ADDITIONAL_DEPS=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/AdditionalDeps
92+
- DOTNET_SHARED_STORE=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/store
93+
- DOTNET_STARTUP_HOOKS=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll
94+
- OTEL_DOTNET_AUTO_HOME=/usr/lib/splunk-instrumentation/splunk-otel-dotnet
95+
- OTEL_DOTNET_AUTO_PLUGINS=Splunk.OpenTelemetry.AutoInstrumentation.Plugin,Splunk.OpenTelemetry.AutoInstrumentation
96+
7997
- name: Assert instrumentation config contains OTEL_RESOURCE_ATTRIBUTES
8098
ansible.builtin.lineinfile:
8199
line: "OTEL_RESOURCE_ATTRIBUTES=\
@@ -89,6 +107,7 @@
89107
loop:
90108
- java.conf
91109
- node.conf
110+
- dotnet.conf
92111

93112
- name: Assert instrumentation config contains OTEL_SERVICE_NAME
94113
ansible.builtin.lineinfile:
@@ -101,6 +120,7 @@
101120
loop:
102121
- java.conf
103122
- node.conf
123+
- dotnet.conf
104124

105125
- name: Assert instrumentation config contains SPLUNK_PROFILER_ENABLED
106126
ansible.builtin.lineinfile:
@@ -113,6 +133,7 @@
113133
loop:
114134
- java.conf
115135
- node.conf
136+
- dotnet.conf
116137

117138
- name: Assert instrumentation config contains SPLUNK_PROFILER_MEMORY_ENABLED
118139
ansible.builtin.lineinfile:
@@ -125,6 +146,7 @@
125146
loop:
126147
- java.conf
127148
- node.conf
149+
- dotnet.conf
128150

129151
- name: Assert instrumentation config contains SPLUNK_METRICS_ENABLED
130152
ansible.builtin.lineinfile:
@@ -137,6 +159,7 @@
137159
loop:
138160
- java.conf
139161
- node.conf
162+
- dotnet.conf
140163

141164
- name: Assert instrumentation config contains OTEL_EXPORTER_OTLP_ENDPOINT
142165
ansible.builtin.lineinfile:
@@ -149,3 +172,4 @@
149172
loop:
150173
- java.conf
151174
- node.conf
175+
- dotnet.conf

deployments/ansible/molecule/with_instrumentation_preload_default/verify.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,24 @@
6767
register: config
6868
failed_when: config is changed
6969

70+
- name: Assert instrumentation config contains .NET env vars
71+
ansible.builtin.lineinfile:
72+
line: "{{ item }}"
73+
dest: /etc/splunk/zeroconfig/dotnet.conf
74+
state: present
75+
check_mode: yes
76+
register: config
77+
failed_when: config is changed
78+
loop:
79+
- CORECLR_ENABLE_PROFILING=1
80+
- CORECLR_PROFILER={918728DD-259F-4A6A-AC2B-B85E1B658318}
81+
- CORECLR_PROFILER_PATH=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so
82+
- DOTNET_ADDITIONAL_DEPS=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/AdditionalDeps
83+
- DOTNET_SHARED_STORE=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/store
84+
- DOTNET_STARTUP_HOOKS=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll
85+
- OTEL_DOTNET_AUTO_HOME=/usr/lib/splunk-instrumentation/splunk-otel-dotnet
86+
- OTEL_DOTNET_AUTO_PLUGINS=Splunk.OpenTelemetry.AutoInstrumentation.Plugin,Splunk.OpenTelemetry.AutoInstrumentation
87+
7088
- name: Assert instrumentation config contains OTEL_RESOURCE_ATTRIBUTES
7189
ansible.builtin.lineinfile:
7290
line: "OTEL_RESOURCE_ATTRIBUTES=\
@@ -79,6 +97,7 @@
7997
loop:
8098
- java.conf
8199
- node.conf
100+
- dotnet.conf
82101

83102
- name: Assert instrumentation config does not contain OTEL_SERVICE_NAME
84103
ansible.builtin.lineinfile:
@@ -91,6 +110,7 @@
91110
loop:
92111
- java.conf
93112
- node.conf
113+
- dotnet.conf
94114

95115
- name: Assert instrumentation config contains SPLUNK_PROFILER_ENABLED
96116
ansible.builtin.lineinfile:
@@ -103,6 +123,7 @@
103123
loop:
104124
- java.conf
105125
- node.conf
126+
- dotnet.conf
106127

107128
- name: Assert instrumentation config contains SPLUNK_PROFILER_MEMORY_ENABLED
108129
ansible.builtin.lineinfile:
@@ -115,6 +136,7 @@
115136
loop:
116137
- java.conf
117138
- node.conf
139+
- dotnet.conf
118140

119141
- name: Assert instrumentation config contains SPLUNK_METRICS_ENABLED
120142
ansible.builtin.lineinfile:
@@ -127,6 +149,7 @@
127149
loop:
128150
- java.conf
129151
- node.conf
152+
- dotnet.conf
130153

131154
- name: Assert instrumentation config contains OTEL_EXPORTER_OTLP_ENDPOINT
132155
ansible.builtin.lineinfile:
@@ -139,3 +162,4 @@
139162
loop:
140163
- java.conf
141164
- node.conf
165+
- dotnet.conf
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{% if item.image not in ["opensuse12", "opensuse15", "centos9"] %}
2+
FROM geerlingguy/docker-{{ item.image }}-ansible:latest
3+
{% if item.image == "centos8" %}
4+
RUN sed -i 's|#mirrorlist|mirrorlist|g' /etc/yum.repos.d/CentOS*.repo
5+
RUN sed -i 's|^baseurl|#baseurl|' /etc/yum.repos.d/CentOS*.repo
6+
RUN sed -i 's|\$releasever|8-stream|g' /etc/yum.repos.d/CentOS*.repo
7+
{% elif item.image == "debian9" %}
8+
RUN sed -i 's|http://.*.debian.org|http://archive.debian.org|' /etc/apt/sources.list
9+
RUN sed -i '/stretch-updates/d' /etc/apt/sources.list
10+
{% endif %}
11+
{% elif item.image == "centos9" %}
12+
FROM quay.io/centos/centos:stream9
13+
ENV container docker
14+
RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
15+
RUN dnf install -y initscripts sudo systemd
16+
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i = \
17+
"systemd-tmpfiles-setup.service" ] || rm -f $i; done); \
18+
rm -f /lib/systemd/system/multi-user.target.wants/*;\
19+
rm -f /lib/systemd/system/local-fs.target.wants/*; \
20+
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
21+
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
22+
rm -f /lib/systemd/system/basic.target.wants/*;\
23+
rm -f /lib/systemd/system/anaconda.target.wants/*;
24+
# Disable requiretty.
25+
RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers
26+
CMD ["/usr/sbin/init"]
27+
{% else %}
28+
{% if item.image == "opensuse12" %}
29+
FROM opensuse/leap:42
30+
RUN sed -i 's|download.opensuse.org|ftp5.gwdg.de/pub/opensuse/discontinued|' /etc/zypp/repos.d/*.repo
31+
RUN zypper -n clean && zypper -n refresh
32+
RUN zypper -n install -l ansible dbus-1 rpm-python sudo systemd-sysvinit
33+
{% else %}
34+
FROM opensuse/leap:15
35+
RUN sed -i 's|download.opensuse.org|provo-mirror.opensuse.org|' /etc/zypp/repos.d/*.repo
36+
RUN zypper -n install -l ansible dbus-1 python3-rpm sudo systemd-sysvinit
37+
{% endif %}
38+
39+
ENV container docker
40+
41+
RUN (cd /usr/lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i = \
42+
"systemd-tmpfiles-setup.service" ] || rm -f $i; done); \
43+
rm -f /usr/lib/systemd/system/multi-user.target.wants/*;\
44+
rm -f /usr/lib/systemd/system/local-fs.target.wants/*; \
45+
rm -f /usr/lib/systemd/system/sockets.target.wants/*udev*; \
46+
rm -f /usr/lib/systemd/system/sockets.target.wants/*initctl*; \
47+
rm -f /usr/lib/systemd/system/basic.target.wants/*;
48+
49+
# Disable requiretty.
50+
RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers
51+
52+
# Install Ansible inventory file.
53+
RUN mkdir -p /etc/ansible
54+
RUN echo -e '[local]\nlocalhost ansible_connection=local' > /etc/ansible/hosts
55+
56+
VOLUME [ "/sys/fs/cgroup" ]
57+
CMD ["/sbin/init"]
58+
{% endif %}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
- name: Converge scenario with auto-instrumentation installation
3+
hosts: all
4+
become: yes
5+
vars:
6+
splunk_access_token: fake-token
7+
splunk_realm: fake-realm
8+
install_splunk_otel_auto_instrumentation: true
9+
splunk_otel_auto_instrumentation_sdks:
10+
- dotnet
11+
tasks:
12+
- name: "Install nodejs for tests"
13+
ansible.builtin.import_tasks: ../shared/install_nodejs.yml
14+
- name: "Include signalfx.splunk_otel_collector.collector role"
15+
include_role:
16+
name: "collector"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# no default config provided, make sure to set --base-config molecule argument instead
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
---
2+
- name: Verify scenario with auto-instrumentation installation
3+
hosts: all
4+
gather_facts: false
5+
tasks:
6+
- name: Populate service facts
7+
ansible.builtin.service_facts:
8+
9+
- name: Assert splunk-otel-collector service is running
10+
assert:
11+
that: ansible_facts.services['splunk-otel-collector.service'].state == 'running'
12+
13+
- name: Populate package facts
14+
ansible.builtin.package_facts:
15+
16+
- name: Get splunk-otel-auto-instrumentation version
17+
set_fact:
18+
auto_instrumentation_version: "{{ ansible_facts.packages['splunk-otel-auto-instrumentation'][0].version }}"
19+
20+
- name: Check if splunk-otel-js is installed
21+
shell: npm ls @splunk/otel
22+
args:
23+
chdir: /usr/lib/splunk-instrumentation/splunk-otel-js
24+
register: npm_ls
25+
failed_when: npm_ls.rc == 0
26+
27+
- name: Check for the old config file
28+
ansible.builtin.stat:
29+
path: /usr/lib/splunk-instrumentation/instrumentation.conf
30+
register: old_config
31+
32+
- name: Assert the old config file does not exist
33+
assert:
34+
that: not old_config.stat.exists
35+
36+
- name: Check for systemd drop-in file
37+
ansible.builtin.stat:
38+
path: /usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf
39+
register: systemd
40+
41+
- name: Assert systemd drop-in file does not exist
42+
assert:
43+
that: not systemd.stat.exists
44+
45+
- name: Check for Java config file
46+
ansible.builtin.stat:
47+
path: /etc/splunk/zeroconfig/java.conf
48+
register: java_config
49+
50+
- name: Assert Java config file does not exist
51+
assert:
52+
that: not java_config.stat.exists
53+
54+
- name: Check for Node.js config file
55+
ansible.builtin.stat:
56+
path: /etc/splunk/zeroconfig/node.conf
57+
register: node_config
58+
59+
- name: Assert Node.js config file does not exist
60+
assert:
61+
that: not node_config.stat.exists
62+
63+
- name: Assert /etc/ld.so.preload contains path to libsplunk.so
64+
ansible.builtin.lineinfile:
65+
line: /usr/lib/splunk-instrumentation/libsplunk.so
66+
dest: /etc/ld.so.preload
67+
state: present
68+
check_mode: yes
69+
register: preload
70+
failed_when: preload is changed
71+
72+
- name: Assert instrumentation config contains .NET env vars
73+
ansible.builtin.lineinfile:
74+
line: "{{ item }}"
75+
dest: /etc/splunk/zeroconfig/dotnet.conf
76+
state: present
77+
check_mode: yes
78+
register: config
79+
failed_when: config is changed
80+
loop:
81+
- CORECLR_ENABLE_PROFILING=1
82+
- CORECLR_PROFILER={918728DD-259F-4A6A-AC2B-B85E1B658318}
83+
- CORECLR_PROFILER_PATH=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so
84+
- DOTNET_ADDITIONAL_DEPS=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/AdditionalDeps
85+
- DOTNET_SHARED_STORE=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/store
86+
- DOTNET_STARTUP_HOOKS=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll
87+
- OTEL_DOTNET_AUTO_HOME=/usr/lib/splunk-instrumentation/splunk-otel-dotnet
88+
- OTEL_DOTNET_AUTO_PLUGINS=Splunk.OpenTelemetry.AutoInstrumentation.Plugin,Splunk.OpenTelemetry.AutoInstrumentation
89+
90+
- name: Assert instrumentation config contains OTEL_RESOURCE_ATTRIBUTES
91+
ansible.builtin.lineinfile:
92+
line: "OTEL_RESOURCE_ATTRIBUTES=\
93+
splunk.zc.method=splunk-otel-auto-instrumentation-{{ auto_instrumentation_version }}"
94+
dest: /etc/splunk/zeroconfig/dotnet.conf
95+
state: present
96+
check_mode: yes
97+
register: config
98+
failed_when: config is changed
99+
100+
- name: Assert instrumentation config does not contain OTEL_SERVICE_NAME
101+
ansible.builtin.lineinfile:
102+
regexp: '.*OTEL_SERVICE_NAME.*'
103+
dest: /etc/splunk/zeroconfig/dotnet.conf
104+
state: absent
105+
check_mode: yes
106+
register: config
107+
failed_when: config is changed
108+
109+
- name: Assert instrumentation config contains SPLUNK_PROFILER_ENABLED
110+
ansible.builtin.lineinfile:
111+
line: SPLUNK_PROFILER_ENABLED=false
112+
dest: /etc/splunk/zeroconfig/dotnet.conf
113+
state: present
114+
check_mode: yes
115+
register: config
116+
failed_when: config is changed
117+
118+
- name: Assert instrumentation config contains SPLUNK_PROFILER_MEMORY_ENABLED
119+
ansible.builtin.lineinfile:
120+
line: SPLUNK_PROFILER_MEMORY_ENABLED=false
121+
dest: /etc/splunk/zeroconfig/dotnet.conf
122+
state: present
123+
check_mode: yes
124+
register: config
125+
failed_when: config is changed
126+
127+
- name: Assert instrumentation config contains SPLUNK_METRICS_ENABLED
128+
ansible.builtin.lineinfile:
129+
line: SPLUNK_METRICS_ENABLED=false
130+
dest: /etc/splunk/zeroconfig/dotnet.conf
131+
state: present
132+
check_mode: yes
133+
register: config
134+
failed_when: config is changed
135+
136+
- name: Assert instrumentation config contains OTEL_EXPORTER_OTLP_ENDPOINT
137+
ansible.builtin.lineinfile:
138+
line: OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4317
139+
dest: /etc/splunk/zeroconfig/dotnet.conf
140+
state: present
141+
check_mode: yes
142+
register: config
143+
failed_when: config is changed

deployments/ansible/molecule/with_instrumentation_preload_java/verify.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@
5151
assert:
5252
that: not node_config.stat.exists
5353

54+
- name: Check for .NET config file
55+
ansible.builtin.stat:
56+
path: /etc/splunk/zeroconfig/dotnet.conf
57+
register: dotnet_config
58+
59+
- name: Assert .NET config file does not exist
60+
assert:
61+
that: not dotnet_config.stat.exists
62+
5463
- name: Assert /etc/ld.so.preload contains path to libsplunk.so
5564
ansible.builtin.lineinfile:
5665
line: /usr/lib/splunk-instrumentation/libsplunk.so

0 commit comments

Comments
 (0)