Skip to content

Commit 99ce01a

Browse files
test
1 parent 80cdaea commit 99ce01a

File tree

5 files changed

+53
-6
lines changed

5 files changed

+53
-6
lines changed

.github/workflows/chef-test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
push:
66
branches:
77
- main
8+
- dotnet-zc-chef
89
paths:
910
- '.github/workflows/chef-test.yml'
1011
- 'deployments/chef/**'

deployments/chef/attributes/default.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,6 @@
100100
default['splunk_otel_collector']['auto_instrumentation_enable_profiler_memory'] = false
101101
default['splunk_otel_collector']['auto_instrumentation_enable_metrics'] = false
102102
default['splunk_otel_collector']['auto_instrumentation_otlp_endpoint'] = 'http://127.0.0.1:4317'
103-
default['splunk_otel_collector']['with_auto_instrumentation_sdks'] = %w(java nodejs)
103+
default['splunk_otel_collector']['with_auto_instrumentation_sdks'] = %w(java nodejs dotnet)
104104
default['splunk_otel_collector']['auto_instrumentation_npm_path'] = 'npm'
105105
end

deployments/chef/recipes/auto_instrumentation.rb

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
with_systemd = node['splunk_otel_collector']['auto_instrumentation_systemd'].to_s.downcase == 'true'
66
with_java = node['splunk_otel_collector']['with_auto_instrumentation_sdks'].include?('java')
77
with_nodejs = node['splunk_otel_collector']['with_auto_instrumentation_sdks'].include?('nodejs') && with_new_instrumentation
8+
dotnet_supported = %w(x86_64 amd64).include?(node['cpu']['architecture']) && (node['splunk_otel_collector']['auto_instrumentation_version'] == 'latest' || Gem::Version.new(node['splunk_otel_collector']['auto_instrumentation_version']) >= Gem::Version.new('0.99.0'))
9+
with_dotnet = node['splunk_otel_collector']['with_auto_instrumentation_sdks'].include?('dotnet') && dotnet_supported
810
npm_path = node['splunk_otel_collector']['auto_instrumentation_npm_path']
911
lib_dir = '/usr/lib/splunk-instrumentation'
1012
splunk_otel_js_path = "#{lib_dir}/splunk-otel-js.tgz"
@@ -13,6 +15,7 @@
1315
zc_config_dir = '/etc/splunk/zeroconfig'
1416
java_config_file = "#{zc_config_dir}/java.conf"
1517
nodejs_config_file = "#{zc_config_dir}/node.conf"
18+
dotnet_config_file = "#{zc_config_dir}/dotnet.conf"
1619
old_config_file = "#{lib_dir}/instrumentation.conf"
1720
systemd_config_dir = '/usr/lib/systemd/system.conf.d'
1821
systemd_config_file = "#{systemd_config_dir}/00-splunk-otel-auto-instrumentation.conf"
@@ -66,7 +69,7 @@
6669
end
6770

6871
if with_systemd
69-
[java_config_file, nodejs_config_file, old_config_file].each do |config_file|
72+
[java_config_file, nodejs_config_file, dotnet_config_file, old_config_file].each do |config_file|
7073
file config_file do
7174
action :delete
7275
end
@@ -78,11 +81,12 @@
7881
variables(
7982
installed_version: lazy { node['packages']['splunk-otel-auto-instrumentation']['version'] },
8083
with_java: lazy { with_java },
81-
with_nodejs: lazy { node.run_state[:with_nodejs] }
84+
with_nodejs: lazy { node.run_state[:with_nodejs] },
85+
with_dotnet: lazy { with_dotnet }
8286
)
8387
source '00-splunk-otel-auto-instrumentation.conf.erb'
8488
notifies :run, 'execute[reload systemd]', :delayed
85-
only_if { with_java || node.run_state[:with_nodejs] }
89+
only_if { with_java || node.run_state[:with_nodejs] || with_dotnet }
8690
end
8791
elsif with_new_instrumentation
8892
[old_config_file, systemd_config_file].each do |config_file|
@@ -98,6 +102,10 @@
98102
action :delete
99103
not_if { node.run_state[:with_nodejs] }
100104
end
105+
file dotnet_config_file do
106+
action :delete
107+
not_if { with_dotnet }
108+
end
101109
directory zc_config_dir do
102110
recursive true
103111
end
@@ -115,8 +123,15 @@
115123
source 'node.conf.erb'
116124
only_if { node.run_state[:with_nodejs] }
117125
end
126+
template dotnet_config_file do
127+
variables(
128+
installed_version: lazy { node['packages']['splunk-otel-auto-instrumentation']['version'] }
129+
)
130+
source 'dotnet.conf.erb'
131+
only_if { with_dotnet }
132+
end
118133
else
119-
[java_config_file, nodejs_config_file, systemd_config_file].each do |config_file|
134+
[java_config_file, nodejs_config_file, dotnet_config_file, systemd_config_file].each do |config_file|
120135
file config_file do
121136
action :delete
122137
end
@@ -134,7 +149,8 @@
134149
variables(
135150
with_systemd: lazy { with_systemd },
136151
with_java: lazy { with_java },
137-
with_nodejs: lazy { node.run_state[:with_nodejs] }
152+
with_nodejs: lazy { node.run_state[:with_nodejs] },
153+
with_dotnet: lazy { with_dotnet }
138154
)
139155
source 'ld.so.preload.erb'
140156
end

deployments/chef/templates/00-splunk-otel-auto-instrumentation.conf.erb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ DefaultEnvironment="JAVA_TOOL_OPTIONS=-javaagent:<%= node['splunk_otel_collector
55
<% if @with_nodejs -%>
66
DefaultEnvironment="NODE_OPTIONS=-r /usr/lib/splunk-instrumentation/splunk-otel-js/node_modules/@splunk/otel/instrument"
77
<% end -%>
8+
<% if @with_dotnet -%>
9+
DefaultEnvironment="CORECLR_ENABLE_PROFILING=1"
10+
DefaultEnvironment="CORECLR_PROFILER={918728DD-259F-4A6A-AC2B-B85E1B658318}"
11+
DefaultEnvironment="CORECLR_PROFILER_PATH=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so"
12+
DefaultEnvironment="DOTNET_ADDITIONAL_DEPS=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/AdditionalDeps"
13+
DefaultEnvironment="DOTNET_SHARED_STORE=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/store"
14+
DefaultEnvironment="DOTNET_STARTUP_HOOKS=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll"
15+
DefaultEnvironment="OTEL_DOTNET_AUTO_HOME=/usr/lib/splunk-instrumentation/splunk-otel-dotnet"
16+
DefaultEnvironment="OTEL_DOTNET_AUTO_PLUGINS=Splunk.OpenTelemetry.AutoInstrumentation.Plugin,Splunk.OpenTelemetry.AutoInstrumentation"
17+
<% end -%>
818
<% if defined?(node['splunk_otel_collector']['auto_instrumentation_resource_attributes']) && node['splunk_otel_collector']['auto_instrumentation_resource_attributes'] != "" -%>
919
DefaultEnvironment="OTEL_RESOURCE_ATTRIBUTES=splunk.zc.method=splunk-otel-auto-instrumentation-<%= @installed_version %>-systemd,<%= node['splunk_otel_collector']['auto_instrumentation_resource_attributes'] %>"
1020
<% else -%>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
CORECLR_ENABLE_PROFILING=1
2+
CORECLR_PROFILER={918728DD-259F-4A6A-AC2B-B85E1B658318}
3+
CORECLR_PROFILER_PATH=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so
4+
DOTNET_ADDITIONAL_DEPS=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/AdditionalDeps
5+
DOTNET_SHARED_STORE=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/store
6+
DOTNET_STARTUP_HOOKS=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll
7+
OTEL_DOTNET_AUTO_HOME=/usr/lib/splunk-instrumentation/splunk-otel-dotnet
8+
OTEL_DOTNET_AUTO_PLUGINS=Splunk.OpenTelemetry.AutoInstrumentation.Plugin,Splunk.OpenTelemetry.AutoInstrumentation
9+
<% if defined?(node['splunk_otel_collector']['auto_instrumentation_resource_attributes']) && node['splunk_otel_collector']['auto_instrumentation_resource_attributes'] != "" -%>
10+
OTEL_RESOURCE_ATTRIBUTES=splunk.zc.method=splunk-otel-auto-instrumentation-<%= @installed_version %>,<%= node['splunk_otel_collector']['auto_instrumentation_resource_attributes'] %>
11+
<% else -%>
12+
OTEL_RESOURCE_ATTRIBUTES=splunk.zc.method=splunk-otel-auto-instrumentation-<%= @installed_version %>
13+
<% end -%>
14+
<% if defined?(node['splunk_otel_collector']['auto_instrumentation_service_name']) && node['splunk_otel_collector']['auto_instrumentation_service_name'] != "" -%>
15+
OTEL_SERVICE_NAME=<%= node['splunk_otel_collector']['auto_instrumentation_service_name'] %>
16+
<% end -%>
17+
SPLUNK_PROFILER_ENABLED=<%= node['splunk_otel_collector']['auto_instrumentation_enable_profiler'].to_s.downcase %>
18+
SPLUNK_PROFILER_MEMORY_ENABLED=<%= node['splunk_otel_collector']['auto_instrumentation_enable_profiler_memory'].to_s.downcase %>
19+
SPLUNK_METRICS_ENABLED=<%= node['splunk_otel_collector']['auto_instrumentation_enable_metrics'].to_s.downcase %>
20+
OTEL_EXPORTER_OTLP_ENDPOINT=<%= node['splunk_otel_collector']['auto_instrumentation_otlp_endpoint'] %>

0 commit comments

Comments
 (0)