Skip to content

Commit f62a3a2

Browse files
authored
Merge branch 'main' into TestHostObserver
2 parents 72efc43 + 70d2c94 commit f62a3a2

File tree

9 files changed

+159
-7
lines changed

9 files changed

+159
-7
lines changed

.github/workflows/auto-instrumentation.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313
- '!**.md'
1414
- 'packaging/**'
1515
- '!packaging/technical-addon/**'
16+
- '!packaging/dotnet-instr-deployer-add-on/**'
1617

1718
concurrency:
1819
group: auto-instrumentation-${{ github.event.pull_request.number || github.ref }}

.github/workflows/dotnet-instr-deployer-add-on.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ env:
1313
GO_VERSION: 1.23.6
1414

1515
jobs:
16-
build:
16+
build-pack-test-dotnet-deployer-ta:
1717
runs-on: windows-latest
1818

1919
steps:
@@ -41,3 +41,33 @@ jobs:
4141
with:
4242
name: splunk_otel_dotnet_deployer
4343
path: ./packaging/dotnet-instr-deployer-add-on/out/distribution/splunk_otel_dotnet_deployer.tgz
44+
45+
# Run the .NET Instrumentation Deployer Add-On integration tests
46+
47+
- name: Download the Splunk UF MSI
48+
shell: bash
49+
run: curl https://download.splunk.com/products/universalforwarder/releases/9.4.0/windows/splunkforwarder-9.4.0-6b4ebe426ca6-windows-x64.msi -o splunkforwarder.msi
50+
51+
- name: Install Splunk UF
52+
run: msiexec.exe /i "$PWD\splunkforwarder.msi" /qn /l*v install-log.txt AGREETOLICENSE=Yes USE_LOCAL_SYSTEM=1
53+
# USE_LOCAL_SYSTEM=1 is required when installing the UF since the install script needs to import the
54+
# Splunk.OTel.DotNet.psm1 that requires admin privileges.
55+
56+
- name: Start Splunk UF and check its status # Need to ensure that the UF is Ok before running the tests
57+
run: |
58+
Start-Sleep 30
59+
cd "${Env:ProgramFiles}\SplunkUniversalForwarder\bin"
60+
.\splunk.exe status
61+
.\splunk.exe start
62+
63+
- name: Run the .NET Instrumentation Deployer Add-On integration tests
64+
working-directory: ./packaging/dotnet-instr-deployer-add-on
65+
run: |
66+
./tests/integration/win-deployment-test.ps1 `
67+
-tgzFilePath ./out/distribution/splunk_otel_dotnet_deployer.tgz `
68+
-splunkInstallPath $(Join-Path "${Env:ProgramFiles}" "SplunkUniversalForwarder")
69+
70+
- name: Display the Deployer TA logs # It is expected to be relatively small
71+
if: always()
72+
run: |
73+
Get-Content "${Env:ProgramFiles}\SplunkUniversalForwarder\var\log\splunk\splunk_otel_dotnet_deployer.log"

examples/prometheus-federation/prom-counter/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.24.0-bullseye
1+
FROM golang:1.24.1-bullseye
22

33
WORKDIR /go/src/app
44

examples/splunk-hec-traces/tracing/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.24.0-bullseye
1+
FROM golang:1.24.1-bullseye
22

33
WORKDIR /go/src/app
44

examples/splunk-hec/logging/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.24.0-bullseye
1+
FROM golang:1.24.1-bullseye
22

33
WORKDIR /go/src/app
44

packaging/dotnet-instr-deployer-add-on/README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,16 @@ Notice that the technical add-on is not a standalone application, it is meant
1717
to be run under `splunkd` control.
1818

1919
__Note:__ the technical add-on is only available for Windows x86_64 and requires
20-
`splunkd` to be running under a user with administrative privileges.
20+
`splunkd` to be running under a user with administrative privileges. If the
21+
`splunkd` process is not running with the necessary rights, the installation
22+
will fail with an error similar to:
23+
24+
```PowerShell
25+
+ Import-Module $modulePath
26+
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
27+
+ CategoryInfo : PermissionDenied: (Splunk.OTel.DotNet.psm1:String) [Import-Module], ScriptRequiresException
28+
+ FullyQualifiedErrorId : ScriptRequiresElevation,Microsoft.PowerShell.Commands.ImportModuleCommand
29+
```
2130

2231
## Configuration
2332

packaging/dotnet-instr-deployer-add-on/assets/windows_x86_64/bin/installer-wrapper.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ if ($uninstall) {
4949
Write-Host "Installing Splunk Distribution of OpenTelemetry .NET ..."
5050

5151
# Avoid issues with NGEN assemblies by forcing SingleDomain mode.
52-
RUN Set-ItemProperty -Path "HKLM:\\SOFTWARE\\Microsoft\\.NETFramework" -Name "LoaderOptimization" -Value 1 -Type DWord
52+
Set-ItemProperty -Path "HKLM:\\SOFTWARE\\Microsoft\\.NETFramework" -Name "LoaderOptimization" -Value 1 -Type DWord
5353

5454
$zipPath = Join-Path $scriptDir "splunk-opentelemetry-dotnet-windows.zip"
5555
Install-OpenTelemetryCore -LocalPath $zipPath
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
<#
2+
.SYNOPSIS
3+
The script validates if the Splunk OpenTelemetry .NET Deployer TA can be
4+
installed and uninstalled successfully by Splunk.
5+
6+
.DESCRIPTION
7+
The script extracts the Splunk OpenTelemetry .NET Deployer TA from a .tgz file
8+
and installs it. It then validates the installation by checking if the expected
9+
files and directories are present. The script also uninstalls the Splunk OpenTelemetry
10+
.NET instrumentation, by changing the local configuration of the Deployer TA
11+
and validates the uninstallation by once again checking if the instrumentation
12+
files and folders were removed.
13+
14+
.PARAMETER tgzFilePath
15+
Path to the .tgz file containing the Splunk OpenTelemetry .NET Deployer TA.
16+
17+
.PARAMETER splunkInstallPath
18+
Path to the Splunk installation directory.
19+
20+
.PARAMETER splunkAppName
21+
Actual name on the disk of the folder with the Splunk OpenTelemetry .NET
22+
Deployer TA app.
23+
#>
24+
param (
25+
[string]$tgzFilePath,
26+
[string]$splunkInstallPath,
27+
[string]$splunkAppName = "splunk_otel_dotnet_deployer"
28+
)
29+
30+
# Function to extract .tgz file into the given destination path
31+
function Expand-Tgz {
32+
param (
33+
[string]$tgzFilePath,
34+
[string]$destinationPath
35+
)
36+
37+
Write-Host "Expanding '$tgzFilePath' into '$destinationPath'"
38+
tar -xzf $tgzFilePath -C $destinationPath
39+
}
40+
41+
# Validate parameters
42+
if (-not (Test-Path $tgzFilePath)) {
43+
Write-Error "The specified .tgz file does not exist: $tgzFilePath"
44+
exit 1
45+
}
46+
if (-not (Test-Path $splunkInstallPath)) {
47+
Write-Error "The specified Splunk installation path does not exist: $splunkInstallPath"
48+
exit 1
49+
}
50+
51+
$splunkAppsPath = Join-Path $splunkInstallPath "etc/apps"
52+
Expand-Tgz -tgzFilePath $tgzFilePath -destinationPath $splunkAppsPath
53+
54+
# Check if the TA is installed
55+
$taPath = Join-Path $splunkAppsPath $splunkAppName
56+
if (Test-Path $taPath) {
57+
Write-Host "Splunk TA $splunkAppName is installed at $taPath"
58+
} else {
59+
Write-Error "Splunk TA $splunkAppName is not installed"
60+
exit 1
61+
}
62+
63+
# Restart Splunk
64+
Write-Host "Restarting Splunk"
65+
& "$splunkInstallPath/bin/splunk.exe" restart
66+
67+
# Check if the Splunk OpenTelemetry .NET instrumentation is installed - remember
68+
# that the TA needs some time to complete this operation after the restart
69+
Start-Sleep -Seconds 30
70+
$splunkOtelDotNetPath = Join-Path ${env:ProgramFiles} "Splunk OpenTelemetry .NET"
71+
if (Test-Path $splunkOtelDotNetPath) {
72+
Write-Host "Splunk OpenTelemetry .NET instrumentation is installed at $splunkOtelDotNetPath"
73+
} else {
74+
Write-Error "Splunk OpenTelemetry .NET instrumentation is not installed"
75+
exit 1
76+
}
77+
78+
# Create a local inputs.conf for the TA and configure it to uninstall the Splunk OpenTelemety .NET instrumentation
79+
$localInputsConfPath = Join-Path $taPath "local/inputs.conf"
80+
# Ensure the local directory exists
81+
$localDir = Join-Path $taPath "local"
82+
if (-not (Test-Path $localDir)) {
83+
New-Item -ItemType Directory -Path $localDir | Out-Null
84+
}
85+
86+
# Copy the default inputs.conf to the local directory
87+
$defaultInputsConfPath = Join-Path $taPath "default/inputs.conf"
88+
if (Test-Path $defaultInputsConfPath) {
89+
Copy-Item -Path $defaultInputsConfPath -Destination $localInputsConfPath
90+
Write-Host "Copied default inputs.conf to local directory"
91+
} else {
92+
Write-Error "Default inputs.conf does not exist at $defaultInputsConfPath"
93+
exit 1
94+
}
95+
96+
# Modify the local inputs.conf to uninstall the Splunk OpenTelemetry .NET instrumentation
97+
$localInputsConfContent = $(Get-Content $localInputsConfPath).Replace("uninstall = false", "uninstall = true")
98+
Set-Content -Path $localInputsConfPath -Value $localInputsConfContent
99+
100+
# Restart Splunk
101+
Write-Host "Restarting Splunk"
102+
& "$splunkInstallPath/bin/splunk.exe" restart
103+
104+
# Check if the Splunk OpenTelemetry .NET instrumentation is uninstalled - remember
105+
# that the TA needs some time to complete this operation after the restart
106+
Start-Sleep -Seconds 30
107+
if (-not (Test-Path $splunkOtelDotNetPath)) {
108+
Write-Host "Splunk OpenTelemetry .NET instrumentation is uninstalled"
109+
} else {
110+
Write-Error "Splunk OpenTelemetry .NET instrumentation is not uninstalled"
111+
exit 1
112+
}

packaging/release/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
PyGithub==2.6.1
2-
boto3==1.37.4
2+
boto3==1.37.9
33
docker==7.1.0
44
requests==2.32.3

0 commit comments

Comments
 (0)