Skip to content

Commit 2e6a69b

Browse files
Kieleklachmatt
andauthored
Bump OTel .NET Auto to 1.12.0 (#643)
* Bump OTel .NET Auto to 1.12.0 * Document OTEL_DOTNET_EXPERIMENTAL_SQLCLIENT_ENABLE_TRACE_CONTEXT_PROPAGATION * adjust logging to upstream logging changes --------- Co-authored-by: Mateusz Lach <mateusza@splunk.com>
1 parent aa5aa7f commit 2e6a69b

File tree

12 files changed

+90
-59
lines changed

12 files changed

+90
-59
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ This component adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.h
1111

1212
### Changed
1313

14+
- Updated [OpenTelemetry .NET Auto Instrumentation](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation):
15+
[`1.12.0`](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/tag/v1.12.0).
16+
1417
### Deprecated
1518

1619
### Removed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Splunk Distribution of OpenTelemetry .NET
22

3-
[![OpenTelemetry .NET](https://img.shields.io/badge/OTel-1.11.2-blueviolet)](https://github.com/open-telemetry/opentelemetry-dotnet/releases/tag/core-1.11.2)
4-
[![OpenTelemetry .NET Auto Instrumentation](https://img.shields.io/badge/OTelAuto-v1.11.0-blueviolet)](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/tag/v1.11.0)
3+
[![OpenTelemetry .NET](https://img.shields.io/badge/OTel-1.12.0-blueviolet)](https://github.com/open-telemetry/opentelemetry-dotnet/releases/tag/core-1.12.0)
4+
[![OpenTelemetry .NET Auto Instrumentation](https://img.shields.io/badge/OTelAuto-v1.12.0-blueviolet)](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/tag/v1.12.0)
55
[![Splunk GDI Specification](https://img.shields.io/badge/GDI-1.7.0-blueviolet)](https://github.com/signalfx/gdi-specification/releases/tag/v1.7.0)
66
[![Keep a Changelog](https://img.shields.io/badge/changelog-Keep%20a%20Changelog-%23E05735)](CHANGELOG.md)
77
[![LICENSE](https://img.shields.io/github/license/signalfx/splunk-otel-dotnet)](LICENSE)

build/Build.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ partial class Build : NukeBuild
1616
[Parameter("Configuration to build - Default is 'Release'")]
1717
readonly Configuration Configuration = Configuration.Release;
1818

19-
const string OpenTelemetryAutoInstrumentationDefaultVersion = "v1.11.0";
19+
const string OpenTelemetryAutoInstrumentationDefaultVersion = "v1.12.0";
2020

2121
[Parameter($"OpenTelemetry AutoInstrumentation dependency version - Default is '{OpenTelemetryAutoInstrumentationDefaultVersion}'")]
2222
readonly string OpenTelemetryAutoInstrumentationVersion = OpenTelemetryAutoInstrumentationDefaultVersion;

docs/advanced-config.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
88
## OpenTelemetry configuration
99

10-
See [Open Telemetry Auto Instrumentation documentation](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/v1.11.0/docs/config.md)
10+
See [Open Telemetry Auto Instrumentation documentation](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/v1.12.0/docs/config.md)
1111
for configuration details.
1212

1313
## Splunk distribution configuration
@@ -23,7 +23,7 @@ Download and install the latest binaries from
2323

2424
When running your application, make sure to:
2525

26-
1. Set the [resources](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/v1.11.0/docs/config.md#resources).
26+
1. Set the [resources](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/v1.12.0/docs/config.md#resources).
2727
1. Set the environment variables from the table below.
2828

2929
| Environment variable | .NET version | Value |
@@ -45,7 +45,7 @@ When running your application, make sure to:
4545
| `OTEL_DOTNET_AUTO_HOME` | All versions | `$INSTALL_DIR` |
4646
| `OTEL_DOTNET_AUTO_PLUGINS` | All versions | `Splunk.OpenTelemetry.AutoInstrumentation.Plugin, Splunk.OpenTelemetry.AutoInstrumentation` |
4747

48-
> Some settings can be omitted on .NET. For more information, see the [documentation](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/v1.11.0/docs/config.md#net-clr-profiler).
48+
> Some settings can be omitted on .NET. For more information, see the [documentation](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/v1.12.0/docs/config.md#net-clr-profiler).
4949
5050
### Splunk plugin settings
5151

script-templates/Splunk.OTel.DotNet.psm1.template

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,36 @@ function Is-Greater-Version($v1, $v2) {
324324
return $false;
325325
}
326326

327+
<#
328+
.SYNOPSIS
329+
Installs OpenTelemetry .NET Assemblies in GAC.
330+
.PARAMETER InstallDir
331+
Default: <auto> - the default path is Program Files dir.
332+
Install path of the OpenTelemetry .NET Automatic Instrumentation
333+
Possible values: <auto>, (Custom path)
334+
#>
335+
function Register-AssembliesInGAC() {
336+
$installDir = Get-Current-InstallDir
337+
338+
# Register .NET Framework dlls in GAC
339+
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") | Out-Null
340+
$publish = New-Object System.EnterpriseServices.Internal.Publish
341+
$dlls = Get-ChildItem -Path $installDir\netfx\ -Filter *.dll -File
342+
for ($i = 0; $i -lt $dlls.Count; $i++) {
343+
$percentageComplete = $i / $dlls.Count * 100
344+
Write-Progress -Activity "Registering .NET Framework dlls in GAC" `
345+
-Status "Module $($i+1) out of $($dlls.Count). Installing $($dlls[$i].Name):" `
346+
-PercentComplete $percentageComplete
347+
348+
if (Test-AssemblyNotForGAC $dlls[$i].Name) {
349+
continue
350+
}
351+
352+
$publish.GacInstall($dlls[$i].FullName)
353+
}
354+
Write-Progress -Activity "Registering .NET Framework dlls in GAC" -Status "Ready" -Completed
355+
}
356+
327357
<#
328358
.SYNOPSIS
329359
Installs Splunk Distribution of OpenTelemetry .NET.
@@ -337,7 +367,9 @@ function Install-OpenTelemetryCore() {
337367
[Parameter(Mandatory = $false)]
338368
[string]$InstallDir = "<auto>",
339369
[Parameter(Mandatory = $false)]
340-
[string]$LocalPath
370+
[string]$LocalPath,
371+
[Parameter(Mandatory = $false)]
372+
[bool]$RegisterAssembliesInGAC = $true
341373
)
342374

343375
$version = "v{{VERSION}}"
@@ -361,23 +393,9 @@ function Install-OpenTelemetryCore() {
361393
# OpenTelemetry service locator
362394
[System.Environment]::SetEnvironmentVariable($ServiceLocatorVariable, $installDir, [System.EnvironmentVariableTarget]::Machine)
363395

364-
# Register .NET Framework dlls in GAC
365-
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") | Out-Null
366-
$publish = New-Object System.EnterpriseServices.Internal.Publish
367-
$dlls = Get-ChildItem -Path $installDir\netfx\ -Filter *.dll -File
368-
for ($i = 0; $i -lt $dlls.Count; $i++) {
369-
$percentageComplete = $i / $dlls.Count * 100
370-
Write-Progress -Activity "Registering .NET Framework dlls in GAC" `
371-
-Status "Module $($i+1) out of $($dlls.Count). Installing $($dlls[$i].Name):" `
372-
-PercentComplete $percentageComplete
373-
374-
if (Test-AssemblyNotForGAC $dlls[$i].Name) {
375-
continue
376-
}
377-
378-
$publish.GacInstall($dlls[$i].FullName)
396+
if ($RegisterAssembliesInGAC){
397+
Register-AssembliesInGAC $installDir
379398
}
380-
Write-Progress -Activity "Registering .NET Framework dlls in GAC" -Status "Ready" -Completed
381399
}
382400
catch {
383401
$message = $_
@@ -435,7 +453,9 @@ function Uninstall-OpenTelemetryCore() {
435453
function Update-OpenTelemetryCore() {
436454
param(
437455
[Parameter(Mandatory = $false)]
438-
[bool]$RegisterIIS = $false
456+
[bool]$RegisterIIS = $false,
457+
[Parameter(Mandatory = $false)]
458+
[bool]$RegisterAssembliesInGAC = $true
439459
)
440460

441461
$currentInstallVersion = Get-OpenTelemetryInstallVersion
@@ -465,7 +485,7 @@ function Update-OpenTelemetryCore() {
465485
Remove-Module Splunk.OTel.DotNet
466486
Import-Module $modulePath
467487

468-
Install-OpenTelemetryCore -InstallDir $installDir
488+
Install-OpenTelemetryCore -InstallDir $installDir -RegisterAssembliesInGAC $$RegisterAssembliesInGAC
469489
if ($RegisterIIS) {
470490
Register-OpenTelemetryForIIS
471491
}
@@ -695,3 +715,4 @@ Export-ModuleMember -Function Get-OpenTelemetryInstallVersion
695715
Export-ModuleMember -Function Get-SplunkOpenTelemetryForDotNetVersion
696716
Export-ModuleMember -Function Enable-OpenTelemetryForIISAppPool
697717
Export-ModuleMember -Function Disable-OpenTelemetryForIISAppPool
718+
Export-ModuleMember -Function Register-AssembliesInGAC

script-templates/splunk-otel-dotnet-install.sh.template

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ case "$ARCHITECTURE" in
4646
;;
4747
esac
4848

49+
if command -v curl > /dev/null 2>&1; then
50+
DOWNLOADER="curl -sSfLo"
51+
elif command -v wget > /dev/null 2>&1; then
52+
DOWNLOADER="wget -qO"
53+
else
54+
echo "Error: Neither curl nor wget is available." >&2
55+
exit 1
56+
fi
57+
4958
test -z "$OTEL_DOTNET_AUTO_HOME" && OTEL_DOTNET_AUTO_HOME="$HOME/.splunk-otel-dotnet"
5059
test -z "$VERSION" && VERSION="v{{VERSION}}"
5160

@@ -64,7 +73,7 @@ if [ ! -f "${LOCAL_PATH}" ]; then
6473
(
6574
cd "$DOWNLOAD_DIR"
6675
echo "Downloading $VERSION for $OS_TYPE ($LOCAL_PATH)..."
67-
curl -sSfLo "$LOCAL_PATH" "$RELEASES_URL/download/$VERSION/$ARCHIVE"
76+
${DOWNLOADER} "$LOCAL_PATH" "$RELEASES_URL/download/$VERSION/$ARCHIVE"
6877
)
6978
else
7079
echo "Using local installation archive: $LOCAL_PATH"

src/Splunk.OpenTelemetry.AutoInstrumentation/Logging/Logger.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ namespace Splunk.OpenTelemetry.AutoInstrumentation.Logging;
2020

2121
internal class Logger : ILogger
2222
{
23+
private const string SplunkLoggerSuffix = "Splunk";
2324
private static readonly bool IsDebugEnabledField;
2425
private static readonly object? Log;
2526
private static readonly MethodInfo? DebugMethod;
@@ -36,8 +37,9 @@ static Logger()
3637
System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(oTelLoggingType.TypeHandle);
3738

3839
var method = oTelLoggingType.GetMethod("GetLogger", [typeof(string)])!;
40+
var closeLoggerMethod = oTelLoggingType.GetMethod("CloseLogger", [typeof(string), Type.GetType("OpenTelemetry.AutoInstrumentation.Logging.IOtelLogger, OpenTelemetry.AutoInstrumentation")!])!;
3941

40-
Log = method.Invoke(null, ["Splunk"])!;
42+
Log = method.Invoke(null, [SplunkLoggerSuffix])!;
4143

4244
DebugMethod = GetMethod("Debug");
4345
WarningMethod = GetMethod("Warning");
@@ -49,6 +51,8 @@ static Logger()
4951
var isLogLevelEnabled = Log?.GetType().GetMethod("IsEnabled");
5052
var isDebugEnabledResult = isLogLevelEnabled?.Invoke(Log, [debugLevel]);
5153
IsDebugEnabledField = isDebugEnabledResult is true;
54+
55+
AppDomain.CurrentDomain.ProcessExit += (_, _) => closeLoggerMethod.Invoke(null, [SplunkLoggerSuffix, Log]);
5256
}
5357
catch (Exception ex)
5458
{

src/Splunk.OpenTelemetry.AutoInstrumentation/Splunk.OpenTelemetry.AutoInstrumentation.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@
2020
<PrivateAssets>all</PrivateAssets>
2121
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2222
</PackageReference>
23-
<PackageReference Include="OpenTelemetry.Api" Version="1.11.2" />
24-
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.11.2" />
23+
<PackageReference Include="OpenTelemetry.Api" Version="1.12.0" />
24+
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.12.0" />
2525
</ItemGroup>
2626

2727
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' ">
2828
<Reference Include="System.Configuration" />
2929
<Reference Include="System.Web" />
30-
<PackageReference Include="OpenTelemetry.Instrumentation.AspNet" Version="1.11.0-beta.2" />
30+
<PackageReference Include="OpenTelemetry.Instrumentation.AspNet" Version="1.12.0-beta.1" />
3131
</ItemGroup>
3232

3333
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
34-
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.11.1" />
34+
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.12.0" />
3535
</ItemGroup>
3636

3737
<PropertyGroup>
@@ -62,7 +62,7 @@
6262
<Content Include="splunk-launch.*">
6363
<PackageCopyToOutput>true</PackageCopyToOutput>
6464
</Content>
65-
<PackageReference Include="OpenTelemetry.AutoInstrumentation" Version="1.11.0">
65+
<PackageReference Include="OpenTelemetry.AutoInstrumentation" Version="1.12.0">
6666
<PrivateAssets>none</PrivateAssets> <!-- Ensures that content and build transitive dependencies are properly delivered -->
6767
</PackageReference>
6868
<None Include="splunk-logo-256x256.png" Pack="true" PackagePath="images" />

test/Splunk.OpenTelemetry.AutoInstrumentation.IntegrationTests/BuildTests.DistributionStructure_windows.verified.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@
4444
\net\System.ServiceModel.Primitives.dll,
4545
\net\System.ServiceModel.dll,
4646
\net\ruleEngine.json,
47-
\netfx\Grpc.Core.Api.dll,
48-
\netfx\Grpc.Core.dll,
4947
\netfx\Microsoft.Bcl.AsyncInterfaces.dll,
5048
\netfx\Microsoft.Extensions.Configuration.Abstractions.dll,
5149
\netfx\Microsoft.Extensions.Configuration.Binder.dll,
@@ -190,10 +188,6 @@
190188
\netfx\System.Xml.XPath.dll,
191189
\netfx\System.Xml.XmlDocument.dll,
192190
\netfx\System.Xml.XmlSerializer.dll,
193-
\netfx\grpc_csharp_ext.x64.dll,
194-
\netfx\grpc_csharp_ext.x86.dll,
195-
\netfx\libgrpc_csharp_ext.x64.dylib,
196-
\netfx\libgrpc_csharp_ext.x64.so,
197191
\netfx\netstandard.dll,
198192
\store\x64\net8.0\microsoft.extensions.configuration.abstractions\9.0.0\lib\net9.0\Microsoft.Extensions.Configuration.Abstractions.dll,
199193
\store\x64\net8.0\microsoft.extensions.configuration.binder\9.0.0\lib\net9.0\Microsoft.Extensions.Configuration.Binder.dll,
@@ -243,4 +237,4 @@
243237
\store\x86\net9.0\microsoft.extensions.primitives\9.0.0\lib\net9.0\Microsoft.Extensions.Primitives.dll,
244238
\win-x64\OpenTelemetry.AutoInstrumentation.Native.dll,
245239
\win-x86\OpenTelemetry.AutoInstrumentation.Native.dll
246-
]
240+
]

0 commit comments

Comments
 (0)