|
5 | 5 | with_systemd = node['splunk_otel_collector']['auto_instrumentation_systemd'].to_s.downcase == 'true'
|
6 | 6 | with_java = node['splunk_otel_collector']['with_auto_instrumentation_sdks'].include?('java')
|
7 | 7 | 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 |
8 | 10 | npm_path = node['splunk_otel_collector']['auto_instrumentation_npm_path']
|
9 | 11 | lib_dir = '/usr/lib/splunk-instrumentation'
|
10 | 12 | splunk_otel_js_path = "#{lib_dir}/splunk-otel-js.tgz"
|
|
13 | 15 | zc_config_dir = '/etc/splunk/zeroconfig'
|
14 | 16 | java_config_file = "#{zc_config_dir}/java.conf"
|
15 | 17 | nodejs_config_file = "#{zc_config_dir}/node.conf"
|
| 18 | +dotnet_config_file = "#{zc_config_dir}/dotnet.conf" |
16 | 19 | old_config_file = "#{lib_dir}/instrumentation.conf"
|
17 | 20 | systemd_config_dir = '/usr/lib/systemd/system.conf.d'
|
18 | 21 | systemd_config_file = "#{systemd_config_dir}/00-splunk-otel-auto-instrumentation.conf"
|
|
66 | 69 | end
|
67 | 70 |
|
68 | 71 | 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| |
70 | 73 | file config_file do
|
71 | 74 | action :delete
|
72 | 75 | end
|
|
78 | 81 | variables(
|
79 | 82 | installed_version: lazy { node['packages']['splunk-otel-auto-instrumentation']['version'] },
|
80 | 83 | 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 } |
82 | 86 | )
|
83 | 87 | source '00-splunk-otel-auto-instrumentation.conf.erb'
|
84 | 88 | 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 } |
86 | 90 | end
|
87 | 91 | elsif with_new_instrumentation
|
88 | 92 | [old_config_file, systemd_config_file].each do |config_file|
|
|
98 | 102 | action :delete
|
99 | 103 | not_if { node.run_state[:with_nodejs] }
|
100 | 104 | end
|
| 105 | + file dotnet_config_file do |
| 106 | + action :delete |
| 107 | + not_if { with_dotnet } |
| 108 | + end |
101 | 109 | directory zc_config_dir do
|
102 | 110 | recursive true
|
103 | 111 | end
|
|
115 | 123 | source 'node.conf.erb'
|
116 | 124 | only_if { node.run_state[:with_nodejs] }
|
117 | 125 | 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 |
118 | 133 | 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| |
120 | 135 | file config_file do
|
121 | 136 | action :delete
|
122 | 137 | end
|
|
134 | 149 | variables(
|
135 | 150 | with_systemd: lazy { with_systemd },
|
136 | 151 | 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 } |
138 | 154 | )
|
139 | 155 | source 'ld.so.preload.erb'
|
140 | 156 | end
|
0 commit comments