1
1
{% set auto_instrumentation_version = salt[' pillar.get' ](' splunk-otel-collector:auto_instrumentation_version' , ' latest' ) %}
2
2
{% set auto_instrumentation_systemd = salt[' pillar.get' ](' splunk-otel-collector:auto_instrumentation_systemd' , False ) | to_bool %}
3
+ {% set auto_instrumentation_sdks = salt[' pillar.get' ](' splunk-otel-collector:auto_instrumentation_sdks' , [' java' , ' nodejs' , ' dotnet' ]) %}
3
4
{% set auto_instrumentation_java_agent_path = salt[' pillar.get' ](' splunk-otel-collector:auto_instrumentation_java_agent_path' , ' /usr/lib/splunk-instrumentation/splunk-otel-javaagent.jar' ) %}
5
+ {% set auto_instrumentation_npm_path = salt[' pillar.get' ](' splunk-otel-collector:auto_instrumentation_npm_path' , ' npm' ) %}
4
6
{% set auto_instrumentation_ld_so_preload = salt[' pillar.get' ](' splunk-otel-collector:auto_instrumentation_ld_so_preload' ) %}
5
7
{% set auto_instrumentation_resource_attributes = salt[' pillar.get' ](' splunk-otel-collector:auto_instrumentation_resource_attributes' ) %}
6
8
{% set auto_instrumentation_service_name = salt[' pillar.get' ](' splunk-otel-collector:auto_instrumentation_service_name' ) %}
10
12
{% set auto_instrumentation_enable_profiler_memory = salt[' pillar.get' ](' splunk-otel-collector:auto_instrumentation_enable_profiler_memory' , False ) | to_bool %}
11
13
{% set auto_instrumentation_enable_metrics = salt[' pillar.get' ](' splunk-otel-collector:auto_instrumentation_enable_metrics' , False ) | to_bool %}
12
14
{% set auto_instrumentation_otlp_endpoint = salt[' pillar.get' ](' splunk-otel-collector:auto_instrumentation_otlp_endpoint' , ' http://127.0.0.1:4317' ) %}
15
+ {% set with_new_instrumentation = auto_instrumentation_version == ' latest' or salt[' pkg.version_cmp' ](auto_instrumentation_version, ' 0.87.0' ) >= 0 %}
16
+ {% set dotnet_supported = (auto_instrumentation_version == ' latest' or salt[' pkg.version_cmp' ](auto_instrumentation_version, ' 0.99.0' ) >= 0 ) and grains[' cpuarch' ] in [' amd64' , ' x86_64' ] %}
17
+ {% set systemd_config_path = ' /usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf' %}
18
+ {% set old_instrumentation_config_path = ' /usr/lib/splunk-instrumentation/instrumentation.conf' %}
19
+ {% set java_config_path = ' /etc/splunk/zeroconfig/java.conf' %}
20
+ {% set nodejs_config_path = ' /etc/splunk/zeroconfig/node.conf' %}
21
+ {% set dotnet_config_path = ' /etc/splunk/zeroconfig/dotnet.conf' %}
22
+ {% set nodejs_prefix = ' /usr/lib/splunk-instrumentation/splunk-otel-js' %}
23
+ {% set dotnet_home = ' /usr/lib/splunk-instrumentation/splunk-otel-dotnet' %}
13
24
14
25
Install Splunk OpenTelemetry Auto Instrumentation :
15
26
pkg.installed :
@@ -18,6 +29,21 @@ Install Splunk OpenTelemetry Auto Instrumentation:
18
29
- require:
19
30
- pkg: splunk-otel-collector
20
31
32
+ {% if ' nodejs' in auto_instrumentation_sdks and with_new_instrumentation %}
33
+ {{ nodejs_prefix }}/node_modules:
34
+ file.directory :
35
+ - makedirs: True
36
+ - require:
37
+ - pkg: splunk-otel-auto-instrumentation
38
+
39
+ Install splunk-otel-js :
40
+ cmd.run :
41
+ - name: {{ auto_instrumentation_npm_path }} install --global=false /usr/lib/splunk-instrumentation/splunk-otel-js.tgz
42
+ - cwd: {{ nodejs_prefix }}
43
+ - require:
44
+ - file: {{ nodejs_prefix }}/node_modules
45
+ {% endif %}
46
+
21
47
/etc/ld.so.preload :
22
48
file.managed :
23
49
- contents: |
@@ -32,11 +58,26 @@ Install Splunk OpenTelemetry Auto Instrumentation:
32
58
- pkg: splunk-otel-auto-instrumentation
33
59
34
60
{% if auto_instrumentation_systemd %}
35
- / usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf :
61
+ {{ systemd_config_path }} :
36
62
file.managed :
37
63
- contents:
38
64
- " [Manager]"
65
+ {% if ' java' in auto_instrumentation_sdks %}
39
66
- DefaultEnvironment="JAVA_TOOL_OPTIONS=-javaagent: {{ auto_instrumentation_java_agent_path }}"
67
+ {% endif %}
68
+ {% if ' nodejs' in auto_instrumentation_sdks and with_new_instrumentation %}
69
+ - DefaultEnvironment=" NODE_OPTIONS=-r {{ nodejs_prefix }}/node_modules/@splunk/otel/instrument"
70
+ {% endif %}
71
+ {% if ' dotnet' in auto_instrumentation_sdks and dotnet_supported %}
72
+ - DefaultEnvironment=" CORECLR_ENABLE_PROFILING=1"
73
+ - DefaultEnvironment=" CORECLR_PROFILER={918728DD-259F-4A6A-AC2B-B85E1B658318 }"
74
+ - DefaultEnvironment=" CORECLR_PROFILER_PATH={{ dotnet_home }}/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so"
75
+ - DefaultEnvironment="DOTNET_ADDITIONAL_DEPS= {{ dotnet_home }}/AdditionalDeps"
76
+ - DefaultEnvironment=" DOTNET_SHARED_STORE={{ dotnet_home }}/store"
77
+ - DefaultEnvironment=" DOTNET_STARTUP_HOOKS={{ dotnet_home }}/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll"
78
+ - DefaultEnvironment=" OTEL_DOTNET_AUTO_HOME={{ dotnet_home }}"
79
+ - DefaultEnvironment=" OTEL_DOTNET_AUTO_PLUGINS=Splunk.OpenTelemetry.AutoInstrumentation.Plugin,Splunk.OpenTelemetry.AutoInstrumentation"
80
+ {% endif %}
40
81
{% if auto_instrumentation_resource_attributes != " " %}
41
82
- DefaultEnvironment=" OTEL_RESOURCE_ATTRIBUTES=splunk.zc.method=splunk-otel-auto-instrumentation- {{ auto_instrumentation_version }}-systemd ,{{ auto_instrumentation_resource_attributes }}"
42
83
{% else %}
@@ -52,13 +93,22 @@ Install Splunk OpenTelemetry Auto Instrumentation:
52
93
- makedirs: True
53
94
- require:
54
95
- pkg: splunk-otel-auto-instrumentation
96
+
97
+ {% for config in [java_config_path, nodejs_config_path, dotnet_config_path, old_instrumentation_config_path] %}
98
+ Delete {{ config }}:
99
+ file.absent:
100
+ - name: {{ config }}
101
+ - require:
102
+ - pkg: splunk-otel-auto-instrumentation
103
+ {% endfor %}
55
104
{% else %}
56
105
Delete auto instrumentation systemd config:
57
106
file.absent:
58
- - name: /usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf
107
+ - name: {{ systemd_config_path }}
59
108
60
- {% if auto_instrumentation_version == ' latest' or salt[' pkg.version_cmp' ](auto_instrumentation_version, ' 0.87.0' ) >= 0 %}
61
- /etc/splunk/zeroconfig/java.conf:
109
+ {% if with_new_instrumentation %}
110
+ {% if ' java' in auto_instrumentation_sdks %}
111
+ {{ java_config_path }}:
62
112
file.managed:
63
113
- contents:
64
114
- JAVA_TOOL_OPTIONS=-javaagent:{{ auto_instrumentation_java_agent_path }}
@@ -78,7 +128,75 @@ Delete auto instrumentation systemd config:
78
128
- require:
79
129
- pkg: splunk-otel-auto-instrumentation
80
130
{% else %}
81
- /usr/lib/splunk-instrumentation/instrumentation.conf:
131
+ Delete {{ java_config_path }}:
132
+ file.absent:
133
+ - name:
134
+ - require:
135
+ - pkg: splunk-otel-auto-instrumentation
136
+ {% endif %}
137
+ {% if ' nodejs' in auto_instrumentation_sdks and with_new_instrumentation %}
138
+ {{ nodejs_config_path }}:
139
+ file.managed:
140
+ - contents:
141
+ - NODE_OPTIONS=-r {{ nodejs_prefix }}/node_modules/@splunk/otel/instrument
142
+ {% if auto_instrumentation_resource_attributes != " " %}
143
+ - OTEL_RESOURCE_ATTRIBUTES=splunk.zc.method=splunk-otel-auto-instrumentation-{{ auto_instrumentation_version }},{{ auto_instrumentation_resource_attributes }}
144
+ {% else %}
145
+ - OTEL_RESOURCE_ATTRIBUTES=splunk.zc.method=splunk-otel-auto-instrumentation-{{ auto_instrumentation_version }}
146
+ {% endif %}
147
+ {% if auto_instrumentation_service_name != " " %}
148
+ - OTEL_SERVICE_NAME={{ auto_instrumentation_service_name }}
149
+ {% endif %}
150
+ - SPLUNK_PROFILER_ENABLED={{ auto_instrumentation_enable_profiler | string | lower }}
151
+ - SPLUNK_PROFILER_MEMORY_ENABLED={{ auto_instrumentation_enable_profiler_memory | string | lower }}
152
+ - SPLUNK_METRICS_ENABLED={{ auto_instrumentation_enable_metrics | string | lower }}
153
+ - OTEL_EXPORTER_OTLP_ENDPOINT={{ auto_instrumentation_otlp_endpoint }}
154
+ - makedirs: True
155
+ - require:
156
+ - pkg: splunk-otel-auto-instrumentation
157
+ {% else %}
158
+ Delete {{ nodejs_config_path }}:
159
+ file.absent:
160
+ - name: {{ nodejs_config_path }}
161
+ - require:
162
+ - pkg: splunk-otel-auto-instrumentation
163
+ {% endif %}
164
+ {% if ' dotnet' in auto_instrumentation_sdks and dotnet_supported %}
165
+ {{ dotnet_config_path }}:
166
+ file.managed:
167
+ - contents:
168
+ - CORECLR_ENABLE_PROFILING=1
169
+ - CORECLR_PROFILER={918728DD-259F-4A6A-AC2B-B85E1B658318}
170
+ - CORECLR_PROFILER_PATH={{ dotnet_home }}/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so
171
+ - DOTNET_ADDITIONAL_DEPS={{ dotnet_home }}/AdditionalDeps
172
+ - DOTNET_SHARED_STORE={{ dotnet_home }}/store
173
+ - DOTNET_STARTUP_HOOKS={{ dotnet_home }}/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll
174
+ - OTEL_DOTNET_AUTO_HOME={{ dotnet_home }}
175
+ - OTEL_DOTNET_AUTO_PLUGINS=Splunk.OpenTelemetry.AutoInstrumentation.Plugin,Splunk.OpenTelemetry.AutoInstrumentation
176
+ {% if auto_instrumentation_resource_attributes != " " %}
177
+ - OTEL_RESOURCE_ATTRIBUTES=splunk.zc.method=splunk-otel-auto-instrumentation-{{ auto_instrumentation_version }},{{ auto_instrumentation_resource_attributes }}
178
+ {% else %}
179
+ - OTEL_RESOURCE_ATTRIBUTES=splunk.zc.method=splunk-otel-auto-instrumentation-{{ auto_instrumentation_version }}
180
+ {% endif %}
181
+ {% if auto_instrumentation_service_name != " " %}
182
+ - OTEL_SERVICE_NAME={{ auto_instrumentation_service_name }}
183
+ {% endif %}
184
+ - SPLUNK_PROFILER_ENABLED={{ auto_instrumentation_enable_profiler | string | lower }}
185
+ - SPLUNK_PROFILER_MEMORY_ENABLED={{ auto_instrumentation_enable_profiler_memory | string | lower }}
186
+ - SPLUNK_METRICS_ENABLED={{ auto_instrumentation_enable_metrics | string | lower }}
187
+ - OTEL_EXPORTER_OTLP_ENDPOINT={{ auto_instrumentation_otlp_endpoint }}
188
+ - makedirs: True
189
+ - require:
190
+ - pkg: splunk-otel-auto-instrumentation
191
+ {% else %}
192
+ Delete {{ dotnet_config_path }}:
193
+ file.absent:
194
+ - name: {{ dotnet_config_path }}
195
+ - require:
196
+ - pkg: splunk-otel-auto-instrumentation
197
+ {% endif %}
198
+ {% else %}
199
+ {{ old_instrumentation_config_path }}:
82
200
file.managed:
83
201
- contents:
84
202
- java_agent_jar={{ auto_instrumentation_java_agent_path }}
@@ -105,4 +223,4 @@ Reload systemd:
105
223
cmd.run:
106
224
- name: systemctl daemon-reload
107
225
- onchanges:
108
- - file: /usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf
226
+ - file: {{ systemd_config_path }}
0 commit comments