diff --git a/deployments/chef/CHANGELOG.md b/deployments/chef/CHANGELOG.md index 4883cae69e..cd926e9b35 100644 --- a/deployments/chef/CHANGELOG.md +++ b/deployments/chef/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## chef-v0.14.0 + +- Initial support for [Splunk OpenTelemetry for .NET](https://github.com/signalfx/splunk-otel-dotnet) Auto + Instrumentation on Linux (x86_64/amd64 only): + - The .NET SDK is activated by default if the `with_auto_instrumentation` option is set to `true` and + `auto_instrumentation_version` is `latest` or >= `0.99.0`. + - Set the `with_auto_instrumentation_sdks` option to `java` and/or `nodejs` to skip .NET auto instrumentation. + ## chef-v0.13.0 - Only copy the collector configuration file to `ProgramData` if the source exists. diff --git a/deployments/chef/README.md b/deployments/chef/README.md index daafacf8a9..94e4602549 100644 --- a/deployments/chef/README.md +++ b/deployments/chef/README.md @@ -189,11 +189,12 @@ after installation/configuration in order for any change to take effect. - `with_auto_instrumentation_sdks`: List of Splunk OpenTelemetry Auto Instrumentation SDKs to install, configure, and activate. (**default:** - `%w(java nodejs)`) + `%w(java nodejs dotnet)`) Currently, the following values are supported: - `java`: [Splunk OpenTelemetry for Java](https://github.com/signalfx/splunk-otel-java) - `nodejs`: [Splunk OpenTelemetry for Node.js](https://github.com/signalfx/splunk-otel-js) + - `dotnet` [Splunk OpenTelemetry for .NET](https://github.com/signalfx/splunk-otel-dotnet) (x86_64/amd64 only) **Note:** This recipe does not manage the installation/configuration of Node.js, `npm`, or Node.js applications. If `nodejs` is included in this @@ -203,7 +204,8 @@ after installation/configuration in order for any change to take effect. - `auto_instrumentation_version`: Version of the `splunk-otel-auto-instrumentation` package to install, e.g. `0.50.0`. The minimum supported version is `0.48.0`. The minimum supported version for - Node.js auto instrumentation is `0.87.0`. (**default:** `latest`) + Node.js auto instrumentation is `0.87.0`. The minimum supported version for + .NET auto instrumentation is `0.99.0`. (**default:** `latest`) - `auto_instrumentation_systemd` (Linux only): By default, the `/etc/ld.so.preload` file on the node will be configured for the diff --git a/deployments/chef/attributes/default.rb b/deployments/chef/attributes/default.rb index 26e72d5b6c..2969b67630 100644 --- a/deployments/chef/attributes/default.rb +++ b/deployments/chef/attributes/default.rb @@ -100,6 +100,6 @@ default['splunk_otel_collector']['auto_instrumentation_enable_profiler_memory'] = false default['splunk_otel_collector']['auto_instrumentation_enable_metrics'] = false default['splunk_otel_collector']['auto_instrumentation_otlp_endpoint'] = 'http://127.0.0.1:4317' - default['splunk_otel_collector']['with_auto_instrumentation_sdks'] = %w(java nodejs) + default['splunk_otel_collector']['with_auto_instrumentation_sdks'] = %w(java nodejs dotnet) default['splunk_otel_collector']['auto_instrumentation_npm_path'] = 'npm' end diff --git a/deployments/chef/kitchen.windows.yml b/deployments/chef/kitchen.windows.yml index 16c8b67ad3..aaeb27e5ee 100644 --- a/deployments/chef/kitchen.windows.yml +++ b/deployments/chef/kitchen.windows.yml @@ -65,7 +65,7 @@ suites: remote_exec: true command: inspec exec custom_vars/test.rb - - name: with_default_dotnet_instrumentation + - name: with_default_windows_dotnet_instrumentation run_list: - recipe[splunk_otel_collector] attributes: @@ -76,9 +76,9 @@ suites: verifier: name: shell remote_exec: true - command: inspec exec with_default_dotnet_instrumentation/test.rb + command: inspec exec with_default_windows_dotnet_instrumentation/test.rb - - name: with_custom_dotnet_instrumentation + - name: with_custom_windows_dotnet_instrumentation run_list: - recipe[splunk_otel_collector] attributes: @@ -99,4 +99,4 @@ suites: verifier: name: shell remote_exec: true - command: inspec exec with_custom_dotnet_instrumentation/test.rb + command: inspec exec with_custom_windows_dotnet_instrumentation/test.rb diff --git a/deployments/chef/kitchen.yml b/deployments/chef/kitchen.yml index c15cc91ece..64e2dfa650 100644 --- a/deployments/chef/kitchen.yml +++ b/deployments/chef/kitchen.yml @@ -380,6 +380,65 @@ suites: auto_instrumentation_enable_metrics: true auto_instrumentation_otlp_endpoint: http://0.0.0.0:4317 + - name: with_default_preload_dotnet_instrumentation + run_list: + - recipe[splunk_otel_collector] + attributes: + splunk_otel_collector: + splunk_access_token: testing123 + splunk_realm: test + with_auto_instrumentation: true + with_auto_instrumentation_sdks: + - dotnet + + - name: with_custom_preload_dotnet_instrumentation + run_list: + - recipe[splunk_otel_collector] + attributes: + splunk_otel_collector: + splunk_access_token: testing123 + splunk_realm: test + with_auto_instrumentation: true + with_auto_instrumentation_sdks: + - dotnet + auto_instrumentation_ld_so_preload: "# my extra library" + auto_instrumentation_resource_attributes: deployment.environment=test + auto_instrumentation_service_name: test + auto_instrumentation_enable_profiler: true + auto_instrumentation_enable_profiler_memory: true + auto_instrumentation_enable_metrics: true + auto_instrumentation_otlp_endpoint: http://0.0.0.0:4317 + + - name: with_default_systemd_dotnet_instrumentation + run_list: + - recipe[splunk_otel_collector] + attributes: + splunk_otel_collector: + splunk_access_token: testing123 + splunk_realm: test + with_auto_instrumentation: true + with_auto_instrumentation_sdks: + - dotnet + auto_instrumentation_systemd: true + + - name: with_custom_systemd_dotnet_instrumentation + run_list: + - recipe[splunk_otel_collector] + attributes: + splunk_otel_collector: + splunk_access_token: testing123 + splunk_realm: test + with_auto_instrumentation: true + with_auto_instrumentation_sdks: + - dotnet + auto_instrumentation_systemd: true + auto_instrumentation_resource_attributes: deployment.environment=test + auto_instrumentation_service_name: test + auto_instrumentation_enable_profiler: true + auto_instrumentation_enable_profiler_memory: true + auto_instrumentation_enable_metrics: true + auto_instrumentation_otlp_endpoint: http://0.0.0.0:4317 + - name: with_default_preload_instrumentation_without_npm run_list: - recipe[splunk_otel_collector] diff --git a/deployments/chef/metadata.rb b/deployments/chef/metadata.rb index 30141d0125..b809dd4421 100644 --- a/deployments/chef/metadata.rb +++ b/deployments/chef/metadata.rb @@ -3,7 +3,7 @@ maintainer_email 'signalfx-support@splunk.com' license 'Apache-2.0' description 'Install/Configure the Splunk OpenTelemetry Collector' -version '0.13.0' +version '0.14.0' chef_version '>= 16.0' supports 'amazon' diff --git a/deployments/chef/recipes/auto_instrumentation.rb b/deployments/chef/recipes/auto_instrumentation.rb index 05335246bb..3e487bf768 100644 --- a/deployments/chef/recipes/auto_instrumentation.rb +++ b/deployments/chef/recipes/auto_instrumentation.rb @@ -5,6 +5,8 @@ with_systemd = node['splunk_otel_collector']['auto_instrumentation_systemd'].to_s.downcase == 'true' with_java = node['splunk_otel_collector']['with_auto_instrumentation_sdks'].include?('java') with_nodejs = node['splunk_otel_collector']['with_auto_instrumentation_sdks'].include?('nodejs') && with_new_instrumentation +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')) +with_dotnet = node['splunk_otel_collector']['with_auto_instrumentation_sdks'].include?('dotnet') && dotnet_supported npm_path = node['splunk_otel_collector']['auto_instrumentation_npm_path'] lib_dir = '/usr/lib/splunk-instrumentation' splunk_otel_js_path = "#{lib_dir}/splunk-otel-js.tgz" @@ -13,6 +15,7 @@ zc_config_dir = '/etc/splunk/zeroconfig' java_config_file = "#{zc_config_dir}/java.conf" nodejs_config_file = "#{zc_config_dir}/node.conf" +dotnet_config_file = "#{zc_config_dir}/dotnet.conf" old_config_file = "#{lib_dir}/instrumentation.conf" systemd_config_dir = '/usr/lib/systemd/system.conf.d' systemd_config_file = "#{systemd_config_dir}/00-splunk-otel-auto-instrumentation.conf" @@ -66,7 +69,7 @@ end if with_systemd - [java_config_file, nodejs_config_file, old_config_file].each do |config_file| + [java_config_file, nodejs_config_file, dotnet_config_file, old_config_file].each do |config_file| file config_file do action :delete end @@ -78,11 +81,12 @@ variables( installed_version: lazy { node['packages']['splunk-otel-auto-instrumentation']['version'] }, with_java: lazy { with_java }, - with_nodejs: lazy { node.run_state[:with_nodejs] } + with_nodejs: lazy { node.run_state[:with_nodejs] }, + with_dotnet: lazy { with_dotnet } ) source '00-splunk-otel-auto-instrumentation.conf.erb' notifies :run, 'execute[reload systemd]', :delayed - only_if { with_java || node.run_state[:with_nodejs] } + only_if { with_java || node.run_state[:with_nodejs] || with_dotnet } end elsif with_new_instrumentation [old_config_file, systemd_config_file].each do |config_file| @@ -98,6 +102,10 @@ action :delete not_if { node.run_state[:with_nodejs] } end + file dotnet_config_file do + action :delete + not_if { with_dotnet } + end directory zc_config_dir do recursive true end @@ -115,8 +123,15 @@ source 'node.conf.erb' only_if { node.run_state[:with_nodejs] } end + template dotnet_config_file do + variables( + installed_version: lazy { node['packages']['splunk-otel-auto-instrumentation']['version'] } + ) + source 'dotnet.conf.erb' + only_if { with_dotnet } + end else - [java_config_file, nodejs_config_file, systemd_config_file].each do |config_file| + [java_config_file, nodejs_config_file, dotnet_config_file, systemd_config_file].each do |config_file| file config_file do action :delete end @@ -134,7 +149,8 @@ variables( with_systemd: lazy { with_systemd }, with_java: lazy { with_java }, - with_nodejs: lazy { node.run_state[:with_nodejs] } + with_nodejs: lazy { node.run_state[:with_nodejs] }, + with_dotnet: lazy { with_dotnet } ) source 'ld.so.preload.erb' end diff --git a/deployments/chef/templates/00-splunk-otel-auto-instrumentation.conf.erb b/deployments/chef/templates/00-splunk-otel-auto-instrumentation.conf.erb index 29b8768b12..a9b6b18cb6 100644 --- a/deployments/chef/templates/00-splunk-otel-auto-instrumentation.conf.erb +++ b/deployments/chef/templates/00-splunk-otel-auto-instrumentation.conf.erb @@ -5,6 +5,16 @@ DefaultEnvironment="JAVA_TOOL_OPTIONS=-javaagent:<%= node['splunk_otel_collector <% if @with_nodejs -%> DefaultEnvironment="NODE_OPTIONS=-r /usr/lib/splunk-instrumentation/splunk-otel-js/node_modules/@splunk/otel/instrument" <% end -%> +<% if @with_dotnet -%> +DefaultEnvironment="CORECLR_ENABLE_PROFILING=1" +DefaultEnvironment="CORECLR_PROFILER={918728DD-259F-4A6A-AC2B-B85E1B658318}" +DefaultEnvironment="CORECLR_PROFILER_PATH=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so" +DefaultEnvironment="DOTNET_ADDITIONAL_DEPS=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/AdditionalDeps" +DefaultEnvironment="DOTNET_SHARED_STORE=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/store" +DefaultEnvironment="DOTNET_STARTUP_HOOKS=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll" +DefaultEnvironment="OTEL_DOTNET_AUTO_HOME=/usr/lib/splunk-instrumentation/splunk-otel-dotnet" +DefaultEnvironment="OTEL_DOTNET_AUTO_PLUGINS=Splunk.OpenTelemetry.AutoInstrumentation.Plugin,Splunk.OpenTelemetry.AutoInstrumentation" +<% end -%> <% if defined?(node['splunk_otel_collector']['auto_instrumentation_resource_attributes']) && node['splunk_otel_collector']['auto_instrumentation_resource_attributes'] != "" -%> DefaultEnvironment="OTEL_RESOURCE_ATTRIBUTES=splunk.zc.method=splunk-otel-auto-instrumentation-<%= @installed_version %>-systemd,<%= node['splunk_otel_collector']['auto_instrumentation_resource_attributes'] %>" <% else -%> diff --git a/deployments/chef/templates/dotnet.conf.erb b/deployments/chef/templates/dotnet.conf.erb new file mode 100644 index 0000000000..8a2b65e612 --- /dev/null +++ b/deployments/chef/templates/dotnet.conf.erb @@ -0,0 +1,20 @@ +CORECLR_ENABLE_PROFILING=1 +CORECLR_PROFILER={918728DD-259F-4A6A-AC2B-B85E1B658318} +CORECLR_PROFILER_PATH=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so +DOTNET_ADDITIONAL_DEPS=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/AdditionalDeps +DOTNET_SHARED_STORE=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/store +DOTNET_STARTUP_HOOKS=/usr/lib/splunk-instrumentation/splunk-otel-dotnet/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll +OTEL_DOTNET_AUTO_HOME=/usr/lib/splunk-instrumentation/splunk-otel-dotnet +OTEL_DOTNET_AUTO_PLUGINS=Splunk.OpenTelemetry.AutoInstrumentation.Plugin,Splunk.OpenTelemetry.AutoInstrumentation +<% if defined?(node['splunk_otel_collector']['auto_instrumentation_resource_attributes']) && node['splunk_otel_collector']['auto_instrumentation_resource_attributes'] != "" -%> +OTEL_RESOURCE_ATTRIBUTES=splunk.zc.method=splunk-otel-auto-instrumentation-<%= @installed_version %>,<%= node['splunk_otel_collector']['auto_instrumentation_resource_attributes'] %> +<% else -%> +OTEL_RESOURCE_ATTRIBUTES=splunk.zc.method=splunk-otel-auto-instrumentation-<%= @installed_version %> +<% end -%> +<% if defined?(node['splunk_otel_collector']['auto_instrumentation_service_name']) && node['splunk_otel_collector']['auto_instrumentation_service_name'] != "" -%> +OTEL_SERVICE_NAME=<%= node['splunk_otel_collector']['auto_instrumentation_service_name'] %> +<% end -%> +SPLUNK_PROFILER_ENABLED=<%= node['splunk_otel_collector']['auto_instrumentation_enable_profiler'].to_s.downcase %> +SPLUNK_PROFILER_MEMORY_ENABLED=<%= node['splunk_otel_collector']['auto_instrumentation_enable_profiler_memory'].to_s.downcase %> +SPLUNK_METRICS_ENABLED=<%= node['splunk_otel_collector']['auto_instrumentation_enable_metrics'].to_s.downcase %> +OTEL_EXPORTER_OTLP_ENDPOINT=<%= node['splunk_otel_collector']['auto_instrumentation_otlp_endpoint'] %> diff --git a/deployments/chef/templates/ld.so.preload.erb b/deployments/chef/templates/ld.so.preload.erb index fb44ed29dc..25a817e311 100644 --- a/deployments/chef/templates/ld.so.preload.erb +++ b/deployments/chef/templates/ld.so.preload.erb @@ -1,4 +1,4 @@ -<% if !@with_systemd && (@with_java || @with_nodejs) -%> +<% if !@with_systemd && (@with_java || @with_nodejs || @with_dotnet) -%> /usr/lib/splunk-instrumentation/libsplunk.so <% end -%> <% if defined?(node['splunk_otel_collector']['auto_instrumentation_ld_so_preload']) && node['splunk_otel_collector']['auto_instrumentation_ld_so_preload'] != "" -%> diff --git a/deployments/chef/test/integration/with_custom_preload_dotnet_instrumentation/test.rb b/deployments/chef/test/integration/with_custom_preload_dotnet_instrumentation/test.rb new file mode 100644 index 0000000000..9899a0a7bb --- /dev/null +++ b/deployments/chef/test/integration/with_custom_preload_dotnet_instrumentation/test.rb @@ -0,0 +1,61 @@ +libsplunk_path = '/usr/lib/splunk-instrumentation/libsplunk.so' +resource_attributes = 'splunk.zc.method=splunk-otel-auto-instrumentation-\d+\.\d+\.\d+,deployment.environment=test' +otlp_endpoint = 'http://0.0.0.0:4317' +ld_preload_line = '# my extra library' +dotnet_home = '/usr/lib/splunk-instrumentation/splunk-otel-dotnet' + +describe package('splunk-otel-auto-instrumentation') do + it { should be_installed } +end + +describe npm('@splunk/otel', path: '/usr/lib/splunk-instrumentation/splunk-otel-js') do + it { should_not be_installed } +end + +describe file('/etc/ld.so.preload') do + its('content') { should match /^#{libsplunk_path}$/ } + its('content') { should match /^#{ld_preload_line}$/ } +end + +describe file('/usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf') do + it { should_not exist } +end + +describe file('/etc/splunk/zeroconfig/java.conf') do + it { should_not exist } +end + +describe file('/etc/splunk/zeroconfig/node.conf') do + it { should_not exist } +end + +describe file('/usr/lib/splunk-instrumentation/instrumentation.conf') do + it { should_not exist } +end + +describe file('/etc/splunk/zeroconfig/dotnet.conf') do + its('content') { should match /^CORECLR_ENABLE_PROFILING=1$/ } + its('content') { should match /^CORECLR_PROFILER=\{918728DD-259F-4A6A-AC2B-B85E1B658318\}$/ } + its('content') { should match %r{^CORECLR_PROFILER_PATH=#{dotnet_home}/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so$} } + its('content') { should match %r{^DOTNET_ADDITIONAL_DEPS=#{dotnet_home}/AdditionalDeps$} } + its('content') { should match %r{^DOTNET_SHARED_STORE=#{dotnet_home}/store$} } + its('content') { should match %r{^DOTNET_STARTUP_HOOKS=#{dotnet_home}/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll$} } + its('content') { should match /^OTEL_DOTNET_AUTO_HOME=#{dotnet_home}$/ } + its('content') { should match /^OTEL_DOTNET_AUTO_PLUGINS=Splunk.OpenTelemetry.AutoInstrumentation.Plugin,Splunk.OpenTelemetry.AutoInstrumentation$/ } + its('content') { should match /^OTEL_RESOURCE_ATTRIBUTES=#{resource_attributes}$/ } + its('content') { should match /^OTEL_SERVICE_NAME=test$/ } + its('content') { should match /^SPLUNK_PROFILER_ENABLED=true$/ } + its('content') { should match /^SPLUNK_PROFILER_MEMORY_ENABLED=true$/ } + its('content') { should match /^SPLUNK_METRICS_ENABLED=true$/ } + its('content') { should match /^OTEL_EXPORTER_OTLP_ENDPOINT=#{otlp_endpoint}$/ } +end + +describe service('splunk-otel-collector') do + it { should be_enabled } + it { should be_running } +end + +describe service('td-agent') do + it { should_not be_enabled } + it { should_not be_running } +end diff --git a/deployments/chef/test/integration/with_custom_preload_instrumentation/test.rb b/deployments/chef/test/integration/with_custom_preload_instrumentation/test.rb index 5e42af543c..21728349bc 100644 --- a/deployments/chef/test/integration/with_custom_preload_instrumentation/test.rb +++ b/deployments/chef/test/integration/with_custom_preload_instrumentation/test.rb @@ -4,6 +4,7 @@ resource_attributes = 'splunk.zc.method=splunk-otel-auto-instrumentation-\d+\.\d+\.\d+,deployment.environment=test' otlp_endpoint = 'http://0.0.0.0:4317' ld_preload_line = '# my extra library' +dotnet_home = '/usr/lib/splunk-instrumentation/splunk-otel-dotnet' describe package('splunk-otel-auto-instrumentation') do it { should be_installed } @@ -46,6 +47,23 @@ its('content') { should match /^OTEL_EXPORTER_OTLP_ENDPOINT=#{otlp_endpoint}$/ } end +describe file('/etc/splunk/zeroconfig/dotnet.conf') do + its('content') { should match /^CORECLR_ENABLE_PROFILING=1$/ } + its('content') { should match /^CORECLR_PROFILER=\{918728DD-259F-4A6A-AC2B-B85E1B658318\}$/ } + its('content') { should match %r{^CORECLR_PROFILER_PATH=#{dotnet_home}/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so$} } + its('content') { should match %r{^DOTNET_ADDITIONAL_DEPS=#{dotnet_home}/AdditionalDeps$} } + its('content') { should match %r{^DOTNET_SHARED_STORE=#{dotnet_home}/store$} } + its('content') { should match %r{^DOTNET_STARTUP_HOOKS=#{dotnet_home}/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll$} } + its('content') { should match /^OTEL_DOTNET_AUTO_HOME=#{dotnet_home}$/ } + its('content') { should match /^OTEL_DOTNET_AUTO_PLUGINS=Splunk.OpenTelemetry.AutoInstrumentation.Plugin,Splunk.OpenTelemetry.AutoInstrumentation$/ } + its('content') { should match /^OTEL_RESOURCE_ATTRIBUTES=#{resource_attributes}$/ } + its('content') { should match /^OTEL_SERVICE_NAME=test$/ } + its('content') { should match /^SPLUNK_PROFILER_ENABLED=true$/ } + its('content') { should match /^SPLUNK_PROFILER_MEMORY_ENABLED=true$/ } + its('content') { should match /^SPLUNK_METRICS_ENABLED=true$/ } + its('content') { should match /^OTEL_EXPORTER_OTLP_ENDPOINT=#{otlp_endpoint}$/ } +end + describe service('splunk-otel-collector') do it { should be_enabled } it { should be_running } diff --git a/deployments/chef/test/integration/with_custom_preload_java_instrumentation/test.rb b/deployments/chef/test/integration/with_custom_preload_java_instrumentation/test.rb index c5efff4195..a8fb663d22 100644 --- a/deployments/chef/test/integration/with_custom_preload_java_instrumentation/test.rb +++ b/deployments/chef/test/integration/with_custom_preload_java_instrumentation/test.rb @@ -25,6 +25,10 @@ it { should_not exist } end +describe file('/etc/splunk/zeroconfig/dotnet.conf') do + it { should_not exist } +end + describe file('/usr/lib/splunk-instrumentation/instrumentation.conf') do it { should_not exist } end diff --git a/deployments/chef/test/integration/with_custom_preload_node_instrumentation/test.rb b/deployments/chef/test/integration/with_custom_preload_node_instrumentation/test.rb index eb3853433a..580d09af56 100644 --- a/deployments/chef/test/integration/with_custom_preload_node_instrumentation/test.rb +++ b/deployments/chef/test/integration/with_custom_preload_node_instrumentation/test.rb @@ -25,6 +25,10 @@ it { should_not exist } end +describe file('/etc/splunk/zeroconfig/dotnet.conf') do + it { should_not exist } +end + describe file('/usr/lib/splunk-instrumentation/instrumentation.conf') do it { should_not exist } end diff --git a/deployments/chef/test/integration/with_custom_systemd_dotnet_instrumentation/test.rb b/deployments/chef/test/integration/with_custom_systemd_dotnet_instrumentation/test.rb new file mode 100644 index 0000000000..1baf60f4b1 --- /dev/null +++ b/deployments/chef/test/integration/with_custom_systemd_dotnet_instrumentation/test.rb @@ -0,0 +1,61 @@ +libsplunk_path = '/usr/lib/splunk-instrumentation/libsplunk.so' +resource_attributes = 'splunk.zc.method=splunk-otel-auto-instrumentation-\d+\.\d+\.\d+-systemd,deployment.environment=test' +otlp_endpoint = 'http://0.0.0.0:4317' +dotnet_home = '/usr/lib/splunk-instrumentation/splunk-otel-dotnet' + +describe package('splunk-otel-auto-instrumentation') do + it { should be_installed } +end + +describe npm('@splunk/otel', path: '/usr/lib/splunk-instrumentation/splunk-otel-js') do + it { should_not be_installed } +end + +describe file('/etc/ld.so.preload') do + its('content') { should_not match /^#{libsplunk_path}$/ } +end + +describe file('/etc/splunk/zeroconfig/java.conf') do + it { should_not exist } +end + +describe file('/etc/splunk/zeroconfig/node.conf') do + it { should_not exist } +end + +describe file('/etc/splunk/zeroconfig/dotnet.conf') do + it { should_not exist } +end + +describe file('/usr/lib/splunk-instrumentation/instrumentation.conf') do + it { should_not exist } +end + +describe file('/usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf') do + its('content') { should_not match /.*JAVA_TOOL_OPTIONS.*/ } + its('content') { should_not match /.*NODE_OPTIONS.*/ } + its('content') { should match /^DefaultEnvironment="CORECLR_ENABLE_PROFILING=1"$/ } + its('content') { should match /^DefaultEnvironment="CORECLR_PROFILER=\{918728DD-259F-4A6A-AC2B-B85E1B658318\}"$/ } + its('content') { should match %r{^DefaultEnvironment="CORECLR_PROFILER_PATH=#{dotnet_home}/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so"$} } + its('content') { should match %r{^DefaultEnvironment="DOTNET_ADDITIONAL_DEPS=#{dotnet_home}/AdditionalDeps"$} } + its('content') { should match %r{^DefaultEnvironment="DOTNET_SHARED_STORE=#{dotnet_home}/store"$} } + its('content') { should match %r{^DefaultEnvironment="DOTNET_STARTUP_HOOKS=#{dotnet_home}/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll"$} } + its('content') { should match /^DefaultEnvironment="OTEL_DOTNET_AUTO_HOME=#{dotnet_home}"$/ } + its('content') { should match /^DefaultEnvironment="OTEL_DOTNET_AUTO_PLUGINS=Splunk.OpenTelemetry.AutoInstrumentation.Plugin,Splunk.OpenTelemetry.AutoInstrumentation"$/ } + its('content') { should match /^DefaultEnvironment="OTEL_RESOURCE_ATTRIBUTES=#{resource_attributes}"$/ } + its('content') { should match /^DefaultEnvironment="OTEL_SERVICE_NAME=test"$/ } + its('content') { should match /^DefaultEnvironment="SPLUNK_PROFILER_ENABLED=true"$/ } + its('content') { should match /^DefaultEnvironment="SPLUNK_PROFILER_MEMORY_ENABLED=true"$/ } + its('content') { should match /^DefaultEnvironment="SPLUNK_METRICS_ENABLED=true"$/ } + its('content') { should match /^DefaultEnvironment="OTEL_EXPORTER_OTLP_ENDPOINT=#{otlp_endpoint}"$/ } +end + +describe service('splunk-otel-collector') do + it { should be_enabled } + it { should be_running } +end + +describe service('td-agent') do + it { should_not be_enabled } + it { should_not be_running } +end diff --git a/deployments/chef/test/integration/with_custom_systemd_instrumentation/test.rb b/deployments/chef/test/integration/with_custom_systemd_instrumentation/test.rb index d0dcdc9625..3135f3dc5e 100644 --- a/deployments/chef/test/integration/with_custom_systemd_instrumentation/test.rb +++ b/deployments/chef/test/integration/with_custom_systemd_instrumentation/test.rb @@ -3,6 +3,7 @@ node_options = '-r /usr/lib/splunk-instrumentation/splunk-otel-js/node_modules/@splunk/otel/instrument' resource_attributes = 'splunk.zc.method=splunk-otel-auto-instrumentation-\d+\.\d+\.\d+-systemd,deployment.environment=test' otlp_endpoint = 'http://0.0.0.0:4317' +dotnet_home = '/usr/lib/splunk-instrumentation/splunk-otel-dotnet' describe package('splunk-otel-auto-instrumentation') do it { should be_installed } @@ -24,6 +25,10 @@ it { should_not exist } end +describe file('/etc/splunk/zeroconfig/dotnet.conf') do + it { should_not exist } +end + describe file('/usr/lib/splunk-instrumentation/instrumentation.conf') do it { should_not exist } end @@ -31,6 +36,14 @@ describe file('/usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf') do its('content') { should match /^DefaultEnvironment="JAVA_TOOL_OPTIONS=#{java_tool_options}"$/ } its('content') { should match /^DefaultEnvironment="NODE_OPTIONS=#{node_options}"$/ } + its('content') { should match /^DefaultEnvironment="CORECLR_ENABLE_PROFILING=1"$/ } + its('content') { should match /^DefaultEnvironment="CORECLR_PROFILER=\{918728DD-259F-4A6A-AC2B-B85E1B658318\}"$/ } + its('content') { should match %r{^DefaultEnvironment="CORECLR_PROFILER_PATH=#{dotnet_home}/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so"$} } + its('content') { should match %r{^DefaultEnvironment="DOTNET_ADDITIONAL_DEPS=#{dotnet_home}/AdditionalDeps"$} } + its('content') { should match %r{^DefaultEnvironment="DOTNET_SHARED_STORE=#{dotnet_home}/store"$} } + its('content') { should match %r{^DefaultEnvironment="DOTNET_STARTUP_HOOKS=#{dotnet_home}/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll"$} } + its('content') { should match /^DefaultEnvironment="OTEL_DOTNET_AUTO_HOME=#{dotnet_home}"$/ } + its('content') { should match /^DefaultEnvironment="OTEL_DOTNET_AUTO_PLUGINS=Splunk.OpenTelemetry.AutoInstrumentation.Plugin,Splunk.OpenTelemetry.AutoInstrumentation"$/ } its('content') { should match /^DefaultEnvironment="OTEL_RESOURCE_ATTRIBUTES=#{resource_attributes}"$/ } its('content') { should match /^DefaultEnvironment="OTEL_SERVICE_NAME=test"$/ } its('content') { should match /^DefaultEnvironment="SPLUNK_PROFILER_ENABLED=true"$/ } diff --git a/deployments/chef/test/integration/with_custom_systemd_java_instrumentation/test.rb b/deployments/chef/test/integration/with_custom_systemd_java_instrumentation/test.rb index a6d0346b4a..923d9c8294 100644 --- a/deployments/chef/test/integration/with_custom_systemd_java_instrumentation/test.rb +++ b/deployments/chef/test/integration/with_custom_systemd_java_instrumentation/test.rb @@ -23,12 +23,24 @@ it { should_not exist } end +describe file('/etc/splunk/zeroconfig/dotnet.conf') do + it { should_not exist } +end + describe file('/usr/lib/splunk-instrumentation/instrumentation.conf') do it { should_not exist } end describe file('/usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf') do its('content') { should_not match /.*NODE_OPTIONS.*/ } + its('content') { should_not match /.*CORECLR_ENABLE_PROFILING.*/ } + its('content') { should_not match /.*CORECLR_PROFILER.*/ } + its('content') { should_not match /.*CORECLR_PROFILER_PATH.*/ } + its('content') { should_not match /.*DOTNET_ADDITIONAL_DEPS.*/ } + its('content') { should_not match /.*DOTNET_SHARED_STORE.*/ } + its('content') { should_not match /.*DOTNET_STARTUP_HOOKS.*/ } + its('content') { should_not match /.*OTEL_DOTNET_AUTO_HOME.*/ } + its('content') { should_not match /.*OTEL_DOTNET_AUTO_PLUGINS.*/ } its('content') { should match /^DefaultEnvironment="JAVA_TOOL_OPTIONS=#{java_tool_options}"$/ } its('content') { should match /^DefaultEnvironment="OTEL_RESOURCE_ATTRIBUTES=#{resource_attributes}"$/ } its('content') { should match /^DefaultEnvironment="OTEL_SERVICE_NAME=test"$/ } diff --git a/deployments/chef/test/integration/with_custom_systemd_node_instrumentation/test.rb b/deployments/chef/test/integration/with_custom_systemd_node_instrumentation/test.rb index 031c7a8a01..94eecb15d8 100644 --- a/deployments/chef/test/integration/with_custom_systemd_node_instrumentation/test.rb +++ b/deployments/chef/test/integration/with_custom_systemd_node_instrumentation/test.rb @@ -23,12 +23,24 @@ it { should_not exist } end +describe file('/etc/splunk/zeroconfig/dotnet.conf') do + it { should_not exist } +end + describe file('/usr/lib/splunk-instrumentation/instrumentation.conf') do it { should_not exist } end describe file('/usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf') do its('content') { should_not match /.*JAVA_TOOL_OPTIONS.*/ } + its('content') { should_not match /.*CORECLR_ENABLE_PROFILING.*/ } + its('content') { should_not match /.*CORECLR_PROFILER.*/ } + its('content') { should_not match /.*CORECLR_PROFILER_PATH.*/ } + its('content') { should_not match /.*DOTNET_ADDITIONAL_DEPS.*/ } + its('content') { should_not match /.*DOTNET_SHARED_STORE.*/ } + its('content') { should_not match /.*DOTNET_STARTUP_HOOKS.*/ } + its('content') { should_not match /.*OTEL_DOTNET_AUTO_HOME.*/ } + its('content') { should_not match /.*OTEL_DOTNET_AUTO_PLUGINS.*/ } its('content') { should match /^DefaultEnvironment="NODE_OPTIONS=#{node_options}"$/ } its('content') { should match /^DefaultEnvironment="OTEL_RESOURCE_ATTRIBUTES=#{resource_attributes}"$/ } its('content') { should match /^DefaultEnvironment="OTEL_SERVICE_NAME=test"$/ } diff --git a/deployments/chef/test/integration/with_custom_dotnet_instrumentation/test.rb b/deployments/chef/test/integration/with_custom_windows_dotnet_instrumentation/test.rb similarity index 100% rename from deployments/chef/test/integration/with_custom_dotnet_instrumentation/test.rb rename to deployments/chef/test/integration/with_custom_windows_dotnet_instrumentation/test.rb diff --git a/deployments/chef/test/integration/with_default_preload_dotnet_instrumentation/test.rb b/deployments/chef/test/integration/with_default_preload_dotnet_instrumentation/test.rb new file mode 100644 index 0000000000..a15b62b79f --- /dev/null +++ b/deployments/chef/test/integration/with_default_preload_dotnet_instrumentation/test.rb @@ -0,0 +1,59 @@ +libsplunk_path = '/usr/lib/splunk-instrumentation/libsplunk.so' +resource_attributes = 'splunk.zc.method=splunk-otel-auto-instrumentation-\d+\.\d+\.\d+' +otlp_endpoint = 'http://127.0.0.1:4317' +dotnet_home = '/usr/lib/splunk-instrumentation/splunk-otel-dotnet' + +describe package('splunk-otel-auto-instrumentation') do + it { should be_installed } +end + +describe npm('@splunk/otel', path: '/usr/lib/splunk-instrumentation/splunk-otel-js') do + it { should_not be_installed } +end + +describe file('/etc/ld.so.preload') do + its('content') { should match /^#{libsplunk_path}$/ } +end + +describe file('/usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf') do + it { should_not exist } +end + +describe file('/etc/splunk/zeroconfig/java.conf') do + it { should_not exist } +end + +describe file('/etc/splunk/zeroconfig/node.conf') do + it { should_not exist } +end + +describe file('/usr/lib/splunk-instrumentation/instrumentation.conf') do + it { should_not exist } +end + +describe file('/etc/splunk/zeroconfig/dotnet.conf') do + its('content') { should match /^CORECLR_ENABLE_PROFILING=1$/ } + its('content') { should match /^CORECLR_PROFILER=\{918728DD-259F-4A6A-AC2B-B85E1B658318\}$/ } + its('content') { should match %r{^CORECLR_PROFILER_PATH=#{dotnet_home}/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so$} } + its('content') { should match %r{^DOTNET_ADDITIONAL_DEPS=#{dotnet_home}/AdditionalDeps$} } + its('content') { should match %r{^DOTNET_SHARED_STORE=#{dotnet_home}/store$} } + its('content') { should match %r{^DOTNET_STARTUP_HOOKS=#{dotnet_home}/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll$} } + its('content') { should match /^OTEL_DOTNET_AUTO_HOME=#{dotnet_home}$/ } + its('content') { should match /^OTEL_DOTNET_AUTO_PLUGINS=Splunk.OpenTelemetry.AutoInstrumentation.Plugin,Splunk.OpenTelemetry.AutoInstrumentation$/ } + its('content') { should match /^OTEL_RESOURCE_ATTRIBUTES=#{resource_attributes}$/ } + its('content') { should_not match /.*OTEL_SERVICE_NAME.*/ } + its('content') { should match /^SPLUNK_PROFILER_ENABLED=false$/ } + its('content') { should match /^SPLUNK_PROFILER_MEMORY_ENABLED=false$/ } + its('content') { should match /^SPLUNK_METRICS_ENABLED=false$/ } + its('content') { should match /^OTEL_EXPORTER_OTLP_ENDPOINT=#{otlp_endpoint}$/ } +end + +describe service('splunk-otel-collector') do + it { should be_enabled } + it { should be_running } +end + +describe service('td-agent') do + it { should_not be_enabled } + it { should_not be_running } +end diff --git a/deployments/chef/test/integration/with_default_preload_instrumentation/test.rb b/deployments/chef/test/integration/with_default_preload_instrumentation/test.rb index e43d1d9fb8..a402f218f5 100644 --- a/deployments/chef/test/integration/with_default_preload_instrumentation/test.rb +++ b/deployments/chef/test/integration/with_default_preload_instrumentation/test.rb @@ -3,6 +3,7 @@ node_options = '-r /usr/lib/splunk-instrumentation/splunk-otel-js/node_modules/@splunk/otel/instrument' resource_attributes = 'splunk.zc.method=splunk-otel-auto-instrumentation-\d+\.\d+\.\d+' otlp_endpoint = 'http://127.0.0.1:4317' +dotnet_home = '/usr/lib/splunk-instrumentation/splunk-otel-dotnet' describe package('splunk-otel-auto-instrumentation') do it { should be_installed } @@ -44,6 +45,23 @@ its('content') { should match /^OTEL_EXPORTER_OTLP_ENDPOINT=#{otlp_endpoint}$/ } end +describe file('/etc/splunk/zeroconfig/dotnet.conf') do + its('content') { should match /^CORECLR_ENABLE_PROFILING=1$/ } + its('content') { should match /^CORECLR_PROFILER=\{918728DD-259F-4A6A-AC2B-B85E1B658318\}$/ } + its('content') { should match %r{^CORECLR_PROFILER_PATH=#{dotnet_home}/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so$} } + its('content') { should match %r{^DOTNET_ADDITIONAL_DEPS=#{dotnet_home}/AdditionalDeps$} } + its('content') { should match %r{^DOTNET_SHARED_STORE=#{dotnet_home}/store$} } + its('content') { should match %r{^DOTNET_STARTUP_HOOKS=#{dotnet_home}/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll$} } + its('content') { should match /^OTEL_DOTNET_AUTO_HOME=#{dotnet_home}$/ } + its('content') { should match /^OTEL_DOTNET_AUTO_PLUGINS=Splunk.OpenTelemetry.AutoInstrumentation.Plugin,Splunk.OpenTelemetry.AutoInstrumentation$/ } + its('content') { should match /^OTEL_RESOURCE_ATTRIBUTES=#{resource_attributes}$/ } + its('content') { should_not match /.*OTEL_SERVICE_NAME.*/ } + its('content') { should match /^SPLUNK_PROFILER_ENABLED=false$/ } + its('content') { should match /^SPLUNK_PROFILER_MEMORY_ENABLED=false$/ } + its('content') { should match /^SPLUNK_METRICS_ENABLED=false$/ } + its('content') { should match /^OTEL_EXPORTER_OTLP_ENDPOINT=#{otlp_endpoint}$/ } +end + describe service('splunk-otel-collector') do it { should be_enabled } it { should be_running } diff --git a/deployments/chef/test/integration/with_default_preload_instrumentation_without_npm/test.rb b/deployments/chef/test/integration/with_default_preload_instrumentation_without_npm/test.rb index 2b825656c3..8e908e7d97 100644 --- a/deployments/chef/test/integration/with_default_preload_instrumentation_without_npm/test.rb +++ b/deployments/chef/test/integration/with_default_preload_instrumentation_without_npm/test.rb @@ -2,6 +2,7 @@ java_tool_options = '-javaagent:/usr/lib/splunk-instrumentation/splunk-otel-javaagent.jar' resource_attributes = 'splunk.zc.method=splunk-otel-auto-instrumentation-\d+\.\d+\.\d+' otlp_endpoint = 'http://127.0.0.1:4317' +dotnet_home = '/usr/lib/splunk-instrumentation/splunk-otel-dotnet' describe package('splunk-otel-auto-instrumentation') do it { should be_installed } @@ -37,6 +38,23 @@ its('content') { should match /^OTEL_EXPORTER_OTLP_ENDPOINT=#{otlp_endpoint}$/ } end +describe file('/etc/splunk/zeroconfig/dotnet.conf') do + its('content') { should match /^CORECLR_ENABLE_PROFILING=1$/ } + its('content') { should match /^CORECLR_PROFILER=\{918728DD-259F-4A6A-AC2B-B85E1B658318\}$/ } + its('content') { should match %r{^CORECLR_PROFILER_PATH=#{dotnet_home}/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so$} } + its('content') { should match %r{^DOTNET_ADDITIONAL_DEPS=#{dotnet_home}/AdditionalDeps$} } + its('content') { should match %r{^DOTNET_SHARED_STORE=#{dotnet_home}/store$} } + its('content') { should match %r{^DOTNET_STARTUP_HOOKS=#{dotnet_home}/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll$} } + its('content') { should match /^OTEL_DOTNET_AUTO_HOME=#{dotnet_home}$/ } + its('content') { should match /^OTEL_DOTNET_AUTO_PLUGINS=Splunk.OpenTelemetry.AutoInstrumentation.Plugin,Splunk.OpenTelemetry.AutoInstrumentation$/ } + its('content') { should match /^OTEL_RESOURCE_ATTRIBUTES=#{resource_attributes}$/ } + its('content') { should_not match /.*OTEL_SERVICE_NAME.*/ } + its('content') { should match /^SPLUNK_PROFILER_ENABLED=false$/ } + its('content') { should match /^SPLUNK_PROFILER_MEMORY_ENABLED=false$/ } + its('content') { should match /^SPLUNK_METRICS_ENABLED=false$/ } + its('content') { should match /^OTEL_EXPORTER_OTLP_ENDPOINT=#{otlp_endpoint}$/ } +end + describe service('splunk-otel-collector') do it { should be_enabled } it { should be_running } diff --git a/deployments/chef/test/integration/with_default_preload_java_instrumentation/test.rb b/deployments/chef/test/integration/with_default_preload_java_instrumentation/test.rb index 2b825656c3..51944b6324 100644 --- a/deployments/chef/test/integration/with_default_preload_java_instrumentation/test.rb +++ b/deployments/chef/test/integration/with_default_preload_java_instrumentation/test.rb @@ -23,6 +23,10 @@ it { should_not exist } end +describe file('/etc/splunk/zeroconfig/dotnet.conf') do + it { should_not exist } +end + describe file('/usr/lib/splunk-instrumentation/instrumentation.conf') do it { should_not exist } end diff --git a/deployments/chef/test/integration/with_default_preload_node_instrumentation/test.rb b/deployments/chef/test/integration/with_default_preload_node_instrumentation/test.rb index 0f6f6eda3f..9a542491f4 100644 --- a/deployments/chef/test/integration/with_default_preload_node_instrumentation/test.rb +++ b/deployments/chef/test/integration/with_default_preload_node_instrumentation/test.rb @@ -27,6 +27,10 @@ it { should_not exist } end +describe file('/etc/splunk/zeroconfig/dotnet.conf') do + it { should_not exist } +end + describe file('/etc/splunk/zeroconfig/node.conf') do its('content') { should match /^NODE_OPTIONS=#{node_options}$/ } its('content') { should match /^OTEL_RESOURCE_ATTRIBUTES=#{resource_attributes}$/ } diff --git a/deployments/chef/test/integration/with_default_systemd_dotnet_instrumentation/test.rb b/deployments/chef/test/integration/with_default_systemd_dotnet_instrumentation/test.rb new file mode 100644 index 0000000000..364558abf6 --- /dev/null +++ b/deployments/chef/test/integration/with_default_systemd_dotnet_instrumentation/test.rb @@ -0,0 +1,61 @@ +libsplunk_path = '/usr/lib/splunk-instrumentation/libsplunk.so' +resource_attributes = 'splunk.zc.method=splunk-otel-auto-instrumentation-\d+\.\d+\.\d+-systemd' +otlp_endpoint = 'http://127.0.0.1:4317' +dotnet_home = '/usr/lib/splunk-instrumentation/splunk-otel-dotnet' + +describe package('splunk-otel-auto-instrumentation') do + it { should be_installed } +end + +describe npm('@splunk/otel', path: '/usr/lib/splunk-instrumentation/splunk-otel-js') do + it { should_not be_installed } +end + +describe file('/etc/ld.so.preload') do + its('content') { should_not match /^#{libsplunk_path}$/ } +end + +describe file('/etc/splunk/zeroconfig/java.conf') do + it { should_not exist } +end + +describe file('/etc/splunk/zeroconfig/node.conf') do + it { should_not exist } +end + +describe file('/etc/splunk/zeroconfig/dotnet.conf') do + it { should_not exist } +end + +describe file('/usr/lib/splunk-instrumentation/instrumentation.conf') do + it { should_not exist } +end + +describe file('/usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf') do + its('content') { should_not match /.*JAVA_TOOL_OPTIONS.*/ } + its('content') { should_not match /.*NODE_OPTIONS.*/ } + its('content') { should match /^DefaultEnvironment="CORECLR_ENABLE_PROFILING=1"$/ } + its('content') { should match /^DefaultEnvironment="CORECLR_PROFILER=\{918728DD-259F-4A6A-AC2B-B85E1B658318\}"$/ } + its('content') { should match %r{^DefaultEnvironment="CORECLR_PROFILER_PATH=#{dotnet_home}/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so"$} } + its('content') { should match %r{^DefaultEnvironment="DOTNET_ADDITIONAL_DEPS=#{dotnet_home}/AdditionalDeps"$} } + its('content') { should match %r{^DefaultEnvironment="DOTNET_SHARED_STORE=#{dotnet_home}/store"$} } + its('content') { should match %r{^DefaultEnvironment="DOTNET_STARTUP_HOOKS=#{dotnet_home}/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll"$} } + its('content') { should match /^DefaultEnvironment="OTEL_DOTNET_AUTO_HOME=#{dotnet_home}"$/ } + its('content') { should match /^DefaultEnvironment="OTEL_DOTNET_AUTO_PLUGINS=Splunk.OpenTelemetry.AutoInstrumentation.Plugin,Splunk.OpenTelemetry.AutoInstrumentation"$/ } + its('content') { should match /^DefaultEnvironment="OTEL_RESOURCE_ATTRIBUTES=#{resource_attributes}"$/ } + its('content') { should_not match /.*OTEL_SERVICE_NAME.*/ } + its('content') { should match /^DefaultEnvironment="SPLUNK_PROFILER_ENABLED=false"$/ } + its('content') { should match /^DefaultEnvironment="SPLUNK_PROFILER_MEMORY_ENABLED=false"$/ } + its('content') { should match /^DefaultEnvironment="SPLUNK_METRICS_ENABLED=false"$/ } + its('content') { should match /^DefaultEnvironment="OTEL_EXPORTER_OTLP_ENDPOINT=#{otlp_endpoint}"$/ } +end + +describe service('splunk-otel-collector') do + it { should be_enabled } + it { should be_running } +end + +describe service('td-agent') do + it { should_not be_enabled } + it { should_not be_running } +end diff --git a/deployments/chef/test/integration/with_default_systemd_instrumentation/test.rb b/deployments/chef/test/integration/with_default_systemd_instrumentation/test.rb index cc78ee00c1..8178046c33 100644 --- a/deployments/chef/test/integration/with_default_systemd_instrumentation/test.rb +++ b/deployments/chef/test/integration/with_default_systemd_instrumentation/test.rb @@ -3,6 +3,7 @@ node_options = '-r /usr/lib/splunk-instrumentation/splunk-otel-js/node_modules/@splunk/otel/instrument' resource_attributes = 'splunk.zc.method=splunk-otel-auto-instrumentation-\d+\.\d+\.\d+-systemd' otlp_endpoint = 'http://127.0.0.1:4317' +dotnet_home = '/usr/lib/splunk-instrumentation/splunk-otel-dotnet' describe package('splunk-otel-auto-instrumentation') do it { should be_installed } @@ -24,6 +25,10 @@ it { should_not exist } end +describe file('/etc/splunk/zeroconfig/dotnet.conf') do + it { should_not exist } +end + describe file('/usr/lib/splunk-instrumentation/instrumentation.conf') do it { should_not exist } end @@ -31,6 +36,14 @@ describe file('/usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf') do its('content') { should match /^DefaultEnvironment="JAVA_TOOL_OPTIONS=#{java_tool_options}"$/ } its('content') { should match /^DefaultEnvironment="NODE_OPTIONS=#{node_options}"$/ } + its('content') { should match /^DefaultEnvironment="CORECLR_ENABLE_PROFILING=1"$/ } + its('content') { should match /^DefaultEnvironment="CORECLR_PROFILER=\{918728DD-259F-4A6A-AC2B-B85E1B658318\}"$/ } + its('content') { should match %r{^DefaultEnvironment="CORECLR_PROFILER_PATH=#{dotnet_home}/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so"$} } + its('content') { should match %r{^DefaultEnvironment="DOTNET_ADDITIONAL_DEPS=#{dotnet_home}/AdditionalDeps"$} } + its('content') { should match %r{^DefaultEnvironment="DOTNET_SHARED_STORE=#{dotnet_home}/store"$} } + its('content') { should match %r{^DefaultEnvironment="DOTNET_STARTUP_HOOKS=#{dotnet_home}/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll"$} } + its('content') { should match /^DefaultEnvironment="OTEL_DOTNET_AUTO_HOME=#{dotnet_home}"$/ } + its('content') { should match /^DefaultEnvironment="OTEL_DOTNET_AUTO_PLUGINS=Splunk.OpenTelemetry.AutoInstrumentation.Plugin,Splunk.OpenTelemetry.AutoInstrumentation"$/ } its('content') { should match /^DefaultEnvironment="OTEL_RESOURCE_ATTRIBUTES=#{resource_attributes}"$/ } its('content') { should_not match /.*OTEL_SERVICE_NAME.*/ } its('content') { should match /^DefaultEnvironment="SPLUNK_PROFILER_ENABLED=false"$/ } diff --git a/deployments/chef/test/integration/with_default_systemd_instrumentation_without_npm/test.rb b/deployments/chef/test/integration/with_default_systemd_instrumentation_without_npm/test.rb index eaf40cc866..dd3635f27d 100644 --- a/deployments/chef/test/integration/with_default_systemd_instrumentation_without_npm/test.rb +++ b/deployments/chef/test/integration/with_default_systemd_instrumentation_without_npm/test.rb @@ -2,6 +2,7 @@ java_tool_options = '-javaagent:/usr/lib/splunk-instrumentation/splunk-otel-javaagent.jar' resource_attributes = 'splunk.zc.method=splunk-otel-auto-instrumentation-\d+\.\d+\.\d+-systemd' otlp_endpoint = 'http://127.0.0.1:4317' +dotnet_home = '/usr/lib/splunk-instrumentation/splunk-otel-dotnet' describe package('splunk-otel-auto-instrumentation') do it { should be_installed } @@ -23,6 +24,10 @@ it { should_not exist } end +describe file('/etc/splunk/zeroconfig/dotnet.conf') do + it { should_not exist } +end + describe file('/usr/lib/splunk-instrumentation/instrumentation.conf') do it { should_not exist } end @@ -30,6 +35,14 @@ describe file('/usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf') do its('content') { should match /^DefaultEnvironment="JAVA_TOOL_OPTIONS=#{java_tool_options}"$/ } its('content') { should_not match /.*NODE_OPTIONS.*/ } + its('content') { should match /^DefaultEnvironment="CORECLR_ENABLE_PROFILING=1"$/ } + its('content') { should match /^DefaultEnvironment="CORECLR_PROFILER=\{918728DD-259F-4A6A-AC2B-B85E1B658318\}"$/ } + its('content') { should match %r{^DefaultEnvironment="CORECLR_PROFILER_PATH=#{dotnet_home}/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so"$} } + its('content') { should match %r{^DefaultEnvironment="DOTNET_ADDITIONAL_DEPS=#{dotnet_home}/AdditionalDeps"$} } + its('content') { should match %r{^DefaultEnvironment="DOTNET_SHARED_STORE=#{dotnet_home}/store"$} } + its('content') { should match %r{^DefaultEnvironment="DOTNET_STARTUP_HOOKS=#{dotnet_home}/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll"$} } + its('content') { should match /^DefaultEnvironment="OTEL_DOTNET_AUTO_HOME=#{dotnet_home}"$/ } + its('content') { should match /^DefaultEnvironment="OTEL_DOTNET_AUTO_PLUGINS=Splunk.OpenTelemetry.AutoInstrumentation.Plugin,Splunk.OpenTelemetry.AutoInstrumentation"$/ } its('content') { should match /^DefaultEnvironment="OTEL_RESOURCE_ATTRIBUTES=#{resource_attributes}"$/ } its('content') { should_not match /.*OTEL_SERVICE_NAME.*/ } its('content') { should match /^DefaultEnvironment="SPLUNK_PROFILER_ENABLED=false"$/ } diff --git a/deployments/chef/test/integration/with_default_systemd_java_instrumentation/test.rb b/deployments/chef/test/integration/with_default_systemd_java_instrumentation/test.rb index eaf40cc866..c59b1010ea 100644 --- a/deployments/chef/test/integration/with_default_systemd_java_instrumentation/test.rb +++ b/deployments/chef/test/integration/with_default_systemd_java_instrumentation/test.rb @@ -23,6 +23,10 @@ it { should_not exist } end +describe file('/etc/splunk/zeroconfig/dotnet.conf') do + it { should_not exist } +end + describe file('/usr/lib/splunk-instrumentation/instrumentation.conf') do it { should_not exist } end @@ -30,6 +34,14 @@ describe file('/usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf') do its('content') { should match /^DefaultEnvironment="JAVA_TOOL_OPTIONS=#{java_tool_options}"$/ } its('content') { should_not match /.*NODE_OPTIONS.*/ } + its('content') { should_not match /.*CORECLR_ENABLE_PROFILING.*/ } + its('content') { should_not match /.*CORECLR_PROFILER.*/ } + its('content') { should_not match /.*CORECLR_PROFILER_PATH.*/ } + its('content') { should_not match /.*DOTNET_ADDITIONAL_DEPS.*/ } + its('content') { should_not match /.*DOTNET_SHARED_STORE.*/ } + its('content') { should_not match /.*DOTNET_STARTUP_HOOKS.*/ } + its('content') { should_not match /.*OTEL_DOTNET_AUTO_HOME.*/ } + its('content') { should_not match /.*OTEL_DOTNET_AUTO_PLUGINS.*/ } its('content') { should match /^DefaultEnvironment="OTEL_RESOURCE_ATTRIBUTES=#{resource_attributes}"$/ } its('content') { should_not match /.*OTEL_SERVICE_NAME.*/ } its('content') { should match /^DefaultEnvironment="SPLUNK_PROFILER_ENABLED=false"$/ } diff --git a/deployments/chef/test/integration/with_default_systemd_node_instrumentation/test.rb b/deployments/chef/test/integration/with_default_systemd_node_instrumentation/test.rb index e25a93322b..dddbb19a4d 100644 --- a/deployments/chef/test/integration/with_default_systemd_node_instrumentation/test.rb +++ b/deployments/chef/test/integration/with_default_systemd_node_instrumentation/test.rb @@ -23,6 +23,10 @@ it { should_not exist } end +describe file('/etc/splunk/zeroconfig/dotnet.conf') do + it { should_not exist } +end + describe file('/usr/lib/splunk-instrumentation/instrumentation.conf') do it { should_not exist } end @@ -30,6 +34,14 @@ describe file('/usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf') do its('content') { should_not match /.*JAVA_TOOL_OPTIONS.*/ } its('content') { should match /^DefaultEnvironment="NODE_OPTIONS=#{node_options}"$/ } + its('content') { should_not match /.*CORECLR_ENABLE_PROFILING.*/ } + its('content') { should_not match /.*CORECLR_PROFILER.*/ } + its('content') { should_not match /.*CORECLR_PROFILER_PATH.*/ } + its('content') { should_not match /.*DOTNET_ADDITIONAL_DEPS.*/ } + its('content') { should_not match /.*DOTNET_SHARED_STORE.*/ } + its('content') { should_not match /.*DOTNET_STARTUP_HOOKS.*/ } + its('content') { should_not match /.*OTEL_DOTNET_AUTO_HOME.*/ } + its('content') { should_not match /.*OTEL_DOTNET_AUTO_PLUGINS.*/ } its('content') { should match /^DefaultEnvironment="OTEL_RESOURCE_ATTRIBUTES=#{resource_attributes}"$/ } its('content') { should_not match /.*OTEL_SERVICE_NAME.*/ } its('content') { should match /^DefaultEnvironment="SPLUNK_PROFILER_ENABLED=false"$/ } diff --git a/deployments/chef/test/integration/with_default_dotnet_instrumentation/test.rb b/deployments/chef/test/integration/with_default_windows_dotnet_instrumentation/test.rb similarity index 100% rename from deployments/chef/test/integration/with_default_dotnet_instrumentation/test.rb rename to deployments/chef/test/integration/with_default_windows_dotnet_instrumentation/test.rb