diff --git a/.github/.github.csproj b/.github/.github.csproj index 568bf7d..18aece6 100644 --- a/.github/.github.csproj +++ b/.github/.github.csproj @@ -1,6 +1,7 @@ + - net8.0 + net9.0 False diff --git a/.github/workflows/bootstrap/action.yml b/.github/workflows/bootstrap/action.yml index 07ff848..ce2687e 100644 --- a/.github/workflows/bootstrap/action.yml +++ b/.github/workflows/bootstrap/action.yml @@ -39,10 +39,6 @@ runs: with: global-json-file: ./global.json - - name: Install Aspire workload - shell: bash - run: dotnet workload install aspire - - id: dotnet shell: bash run: | diff --git a/Directory.Build.props b/Directory.Build.props index ad8531d..eccdf61 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -22,6 +22,6 @@ - + \ No newline at end of file diff --git a/build/build.fsproj b/build/build.fsproj index 40a5dc5..5115c02 100644 --- a/build/build.fsproj +++ b/build/build.fsproj @@ -1,35 +1,37 @@ + - net8.0 + net9.0 Exe $(NoWarn);NU1701 false + - - + + - - - - + + + + - + - - + + - - - - - - - + + + + + + + diff --git a/build/scripts/Targets.fs b/build/scripts/Targets.fs index 316564b..0f6748e 100644 --- a/build/scripts/Targets.fs +++ b/build/scripts/Targets.fs @@ -76,7 +76,7 @@ let private runTests suite _ = let settingsArg = ["-s"; "tests/.runsettings"] - let tfmArgs = if OS.Current = OS.Windows then [] else ["-f"; "net8.0"] + let tfmArgs = if OS.Current = OS.Windows then [] else ["-f"; "net9.0"] exec { env (Map ["TEST_SUITE", suite.SuitName]) run "dotnet" ( @@ -128,13 +128,13 @@ let private generateApiChanges _ = nugetPackages |> Seq.iter(fun p -> let outputFile = Path.Combine(output, $"breaking-changes-%s{p}.md") - let tfm = "net8.0" + let tfm = "net9.0" let args = [ "assembly-differ" $"previous-nuget|%s{p}|%s{currentVersion}|%s{tfm}"; //$"directory|.artifacts/bin/%s{p}/release/%s{tfm}"; - $"directory|.artifacts/bin/%s{p}/release_net8.0"; + $"directory|.artifacts/bin/%s{p}/release_net9.0"; "-a"; "true"; "--target"; p; "-f"; "github-comment"; "--output"; outputFile ] exec { run "dotnet" args } diff --git a/dotnet-tools.json b/dotnet-tools.json index 1eb8d6b..1ad6bf7 100644 --- a/dotnet-tools.json +++ b/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "minver-cli": { - "version": "5.0.0", + "version": "6.0.0", "commands": [ "minver" ] diff --git a/examples/AppHost/AppHost.csproj b/examples/AppHost/AppHost.csproj index 67ee46d..51d51cc 100644 --- a/examples/AppHost/AppHost.csproj +++ b/examples/AppHost/AppHost.csproj @@ -1,15 +1,17 @@ + + Exe - net8.0 + net9.0 enable enable true - + diff --git a/examples/AppHost/Properties/launchSettings.json b/examples/AppHost/Properties/launchSettings.json index d1b87a7..fb536e1 100644 --- a/examples/AppHost/Properties/launchSettings.json +++ b/examples/AppHost/Properties/launchSettings.json @@ -1,15 +1,16 @@ { "$schema": "http://json.schemastore.org/launchsettings.json", "profiles": { - "http": { + "https": { "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, - "applicationUrl": "http://localhost:15114", + "applicationUrl": "https://localhost:15114", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", "DOTNET_ENVIRONMENT": "Development", - "DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:16161" + "DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:16161", + "DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22052" } } } diff --git a/examples/Example.AspNetCore.Mvc/Dockerfile b/examples/Example.AspNetCore.Mvc/Dockerfile index ddf5378..0b2a591 100644 --- a/examples/Example.AspNetCore.Mvc/Dockerfile +++ b/examples/Example.AspNetCore.Mvc/Dockerfile @@ -1,10 +1,10 @@ -FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base +FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base USER $APP_UID WORKDIR /app EXPOSE 8080 EXPOSE 8081 -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build ARG BUILD_CONFIGURATION=Release WORKDIR /src COPY ["examples/Example.AspNetCore.Mvc/Example.AspNetCore.Mvc.csproj", "examples/Example.AspNetCore.Mvc/"] diff --git a/examples/Example.AspNetCore.Mvc/Example.AspNetCore.Mvc.csproj b/examples/Example.AspNetCore.Mvc/Example.AspNetCore.Mvc.csproj index 837362b..c620139 100644 --- a/examples/Example.AspNetCore.Mvc/Example.AspNetCore.Mvc.csproj +++ b/examples/Example.AspNetCore.Mvc/Example.AspNetCore.Mvc.csproj @@ -1,7 +1,7 @@ - + - net8.0 + net9.0 enable enable Linux diff --git a/examples/Example.AutoInstrumentation/Dockerfile b/examples/Example.AutoInstrumentation/Dockerfile index 234387c..82d3ecc 100644 --- a/examples/Example.AutoInstrumentation/Dockerfile +++ b/examples/Example.AutoInstrumentation/Dockerfile @@ -1,4 +1,4 @@ -ARG OTEL_VERSION=1.7.0 +ARG OTEL_VERSION=1.9.0 FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base ARG TARGETPLATFORM ARG TARGETARCH @@ -18,7 +18,6 @@ ADD https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/relea RUN chmod +x otel-dotnet-auto-install.sh RUN OTEL_DOTNET_AUTO_HOME="/app/otel" sh otel-dotnet-auto-install.sh - FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build_example ENV _PROJECT="Example.AutoInstrumentation" ENV _PROJECTPATH="${_PROJECT}/${_PROJECT}.csproj" @@ -33,7 +32,7 @@ RUN dotnet build "${_PROJECT}.csproj" -c Release -o /app/build_example FROM build_example AS publish_example RUN dotnet publish "Example.AutoInstrumentation.csproj" -c Release -o /app/example /p:UseAppHost=false -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build_distro +FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build_distro ENV _PROJECT="Elastic.OpenTelemetry" ENV _PROJECTPATH="${_PROJECT}/${_PROJECT}.csproj" WORKDIR /work @@ -49,14 +48,14 @@ ARG TARGETARCH ARG TARGETVARIANT WORKDIR /app COPY --from=publish_example /app/example /app/example -COPY --from=build_distro /work/.artifacts/bin/Elastic.OpenTelemetry/release_netstandard2.1/Elastic.OpenTelemetry.dll /app/otel/net/ -COPY --from=build_distro /work/.artifacts/bin/Elastic.OpenTelemetry/release_netstandard2.1/Elastic.OpenTelemetry.pdb /app/otel/net/ +COPY --from=build_distro /work/.artifacts/bin/Elastic.OpenTelemetry/release_net8.0/Elastic.OpenTelemetry.dll /app/otel/net/ +COPY --from=build_distro /work/.artifacts/bin/Elastic.OpenTelemetry/release_net8.0/Elastic.OpenTelemetry.pdb /app/otel/net/ ENV CORECLR_ENABLE_PROFILING="1" ENV CORECLR_PROFILER="{918728DD-259F-4A6A-AC2B-B85E1B658318}" ENV CORECLR_PROFILER_PATH="/app/otel/linux-${TARGETARCH}/OpenTelemetry.AutoInstrumentation.Native.so" ENV OTEL_DOTNET_AUTO_PLUGINS="Elastic.OpenTelemetry.AutoInstrumentationPlugin, Elastic.OpenTelemetry, Version=1.0.0.0, Culture=neutral, PublicKeyToken=069ca2728db333c1" - + ENV OTEL_TRACES_EXPORTER=none ENV OTEL_METRICS_EXPORTER=none ENV OTEL_LOGS_EXPORTER=none @@ -64,9 +63,9 @@ ENV OTEL_SERVICE_NAME=ExampleInstrumentation ENV OTEL_LOG_LEVEL=debug ENV OTEL_DOTNET_AUTO_LOG_DIRECTORY=/app/logs -ENV ELASTIC_OTEL_LOG_TARGETS=stdout ENV OTEL_DOTNET_AUTO_HOME="/app/otel" +ENV OTEL_DOTNET_AUTO_LOGGER="console" ENV DOTNET_ADDITIONAL_DEPS="/app/otel/AdditionalDeps" ENV DOTNET_SHARED_STORE="/app/otel/store" ENV DOTNET_STARTUP_HOOKS="/app/otel/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll" diff --git a/examples/Example.AutoInstrumentation/Example.AutoInstrumentation.csproj b/examples/Example.AutoInstrumentation/Example.AutoInstrumentation.csproj index 2a040bd..61d61c4 100644 --- a/examples/Example.AutoInstrumentation/Example.AutoInstrumentation.csproj +++ b/examples/Example.AutoInstrumentation/Example.AutoInstrumentation.csproj @@ -1,17 +1,18 @@ - + - - Exe - net8.0 - enable - enable - Linux - + + Exe + + net8.0 + enable + enable + Linux + - - - .dockerignore - - + + + .dockerignore + + diff --git a/examples/Example.AutoInstrumentation/distribution.Dockerfile b/examples/Example.AutoInstrumentation/distribution.Dockerfile index e965f3c..7a17235 100644 --- a/examples/Example.AutoInstrumentation/distribution.Dockerfile +++ b/examples/Example.AutoInstrumentation/distribution.Dockerfile @@ -1,4 +1,4 @@ -ARG OTEL_VERSION=1.7.0 +ARG OTEL_VERSION=1.9.0 FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build ARG TARGETPLATFORM ARG TARGETARCH @@ -19,7 +19,6 @@ COPY examples/${_PROJECT} examples/${_PROJECT} WORKDIR "/work/examples/${_PROJECT}" RUN dotnet publish "${_PROJECT}.csproj" -c Release -a $TARGETARCH --no-restore -o /app/example - FROM build AS final COPY ".artifacts/elastic-distribution" /distro/elastic diff --git a/examples/Example.Console/Example.Console.csproj b/examples/Example.Console/Example.Console.csproj index ff660d3..8a0cd10 100644 --- a/examples/Example.Console/Example.Console.csproj +++ b/examples/Example.Console/Example.Console.csproj @@ -1,19 +1,19 @@ - - Exe - net8.0 - enable - enable - + + Exe + net9.0 + enable + enable + - - - - + + + + - - - + + + diff --git a/examples/Example.MinimalApi/Example.MinimalApi.csproj b/examples/Example.MinimalApi/Example.MinimalApi.csproj index 11c4254..d48e6b0 100644 --- a/examples/Example.MinimalApi/Example.MinimalApi.csproj +++ b/examples/Example.MinimalApi/Example.MinimalApi.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 enable enable diff --git a/examples/Example.WorkerService/Example.WorkerService.csproj b/examples/Example.WorkerService/Example.WorkerService.csproj index 6838c59..4171dbd 100644 --- a/examples/Example.WorkerService/Example.WorkerService.csproj +++ b/examples/Example.WorkerService/Example.WorkerService.csproj @@ -1,15 +1,15 @@ - net8.0 + net9.0 enable enable dotnet-Example.Elastic.OpenTelemetry.Worker-3a9724de-5d6b-4e68-a21e-b90c655cc721 - - + + diff --git a/examples/ServiceDefaults/Extensions.cs b/examples/ServiceDefaults/Extensions.cs index 601c411..c2322dc 100644 --- a/examples/ServiceDefaults/Extensions.cs +++ b/examples/ServiceDefaults/Extensions.cs @@ -12,7 +12,9 @@ using OpenTelemetry.Trace; // ReSharper disable once CheckNamespace +#pragma warning disable IDE0130 // Namespace does not match folder structure namespace Microsoft.Extensions.Hosting; +#pragma warning restore IDE0130 // Namespace does not match folder structure public static class Extensions { @@ -30,7 +32,7 @@ public static IHostApplicationBuilder AddServiceDefaults(this IHostApplicationBu http.AddStandardResilienceHandler(); // Turn on service discovery by default - http.UseServiceDiscovery(); + http.AddServiceDiscovery(); }); return builder; diff --git a/examples/ServiceDefaults/ServiceDefaults.csproj b/examples/ServiceDefaults/ServiceDefaults.csproj index 766d807..cd8c0ff 100644 --- a/examples/ServiceDefaults/ServiceDefaults.csproj +++ b/examples/ServiceDefaults/ServiceDefaults.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 enable enable true @@ -10,10 +10,10 @@ - - - - + + + + diff --git a/global.json b/global.json index 72d38cd..30094e8 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.100", + "version": "9.0.100", "rollForward": "latestMajor", "allowPrerelease": false } diff --git a/src/Elastic.OpenTelemetry.AutoInstrumentation/Elastic.OpenTelemetry.AutoInstrumentation.csproj b/src/Elastic.OpenTelemetry.AutoInstrumentation/Elastic.OpenTelemetry.AutoInstrumentation.csproj index db96356..1279089 100644 --- a/src/Elastic.OpenTelemetry.AutoInstrumentation/Elastic.OpenTelemetry.AutoInstrumentation.csproj +++ b/src/Elastic.OpenTelemetry.AutoInstrumentation/Elastic.OpenTelemetry.AutoInstrumentation.csproj @@ -1,15 +1,15 @@ - - net6.0;net8.0;net462 - enable - enable - True - + + net462;net8.0 + enable + enable + True + - - - + + + @@ -18,33 +18,26 @@ and link it as _instrument.cmd since we manually copy it over in the prebuild event --> - - + + - + - - - - - + + + - + - - - + + + - + diff --git a/src/Elastic.OpenTelemetry.AutoInstrumentation/_instrument.cmd b/src/Elastic.OpenTelemetry.AutoInstrumentation/_instrument.cmd index 9cf290b..d91a563 100755 --- a/src/Elastic.OpenTelemetry.AutoInstrumentation/_instrument.cmd +++ b/src/Elastic.OpenTelemetry.AutoInstrumentation/_instrument.cmd @@ -1,13 +1,44 @@ @echo off -setlocal +setlocal ENABLEDELAYEDEXPANSION :: This script is expected to be used in a build that specified a RuntimeIdentifier (RID) set BASE_PATH=%~dp0 +set COR_PROFILER_PATH=%BASE_PATH%OpenTelemetry.AutoInstrumentation.Native.dll + +:: Validate +IF EXIST %COR_PROFILER_PATH% ( + set CORECLR_PROFILER_PATH=!COR_PROFILER_PATH! +) ELSE ( + set "COR_PROFILER_PATH=" + + echo Unable to locate the native profiler inside current directory, possibly due to runtime identifier not being specified when building/publishing. ^ +Attempting to use the native profiler from runtimes\win-x64\native and runtimes\win-x86\native subdirectories. + + set COR_PROFILER_PATH_64=%BASE_PATH%runtimes\win-x64\native\OpenTelemetry.AutoInstrumentation.Native.dll + set COR_PROFILER_PATH_32=%BASE_PATH%runtimes\win-x86\native\OpenTelemetry.AutoInstrumentation.Native.dll + + IF EXIST !COR_PROFILER_PATH_64! ( + IF EXIST !COR_PROFILER_PATH_32! ( + set CORECLR_PROFILER_PATH_32=!COR_PROFILER_PATH_32! + ) ELSE ( + set "COR_PROFILER_PATH_32=" + ) + set CORECLR_PROFILER_PATH_64=!COR_PROFILER_PATH_64! + ) ELSE ( + set "COR_PROFILER_PATH_64=" + IF EXIST !COR_PROFILER_PATH_32! ( + set CORECLR_PROFILER_PATH_32=!COR_PROFILER_PATH_32! + ) ELSE ( + set "COR_PROFILER_PATH_32=" + echo Unable to locate the native profiler. 1>&2 + exit /b 1 + ) + ) +) :: Settings for .NET Framework set COR_ENABLE_PROFILING=1 set COR_PROFILER={918728DD-259F-4A6A-AC2B-B85E1B658318} -set COR_PROFILER_PATH=%BASE_PATH%OpenTelemetry.AutoInstrumentation.Native.dll :: On .NET Framework automatic assembly redirection MUST be disabled. This setting :: is ignored on .NET. This is necessary because the NuGet package doesn't bring @@ -20,7 +51,6 @@ set OTEL_DOTNET_AUTO_NETFX_REDIRECT_ENABLED=false set ASPNETCORE_HOSTINGSTARTUPASSEMBLIES=OpenTelemetry.AutoInstrumentation.AspNetCoreBootstrapper set CORECLR_ENABLE_PROFILING=1 set CORECLR_PROFILER={918728DD-259F-4A6A-AC2B-B85E1B658318} -set CORECLR_PROFILER_PATH=%BASE_PATH%OpenTelemetry.AutoInstrumentation.Native.dll set DOTNET_STARTUP_HOOKS=%BASE_PATH%OpenTelemetry.AutoInstrumentation.StartupHook.dll :: Settings for OpenTelemetry diff --git a/src/Elastic.OpenTelemetry.AutoInstrumentation/_instrument.sh b/src/Elastic.OpenTelemetry.AutoInstrumentation/_instrument.sh index 1a8d131..478f34f 100755 --- a/src/Elastic.OpenTelemetry.AutoInstrumentation/_instrument.sh +++ b/src/Elastic.OpenTelemetry.AutoInstrumentation/_instrument.sh @@ -2,12 +2,64 @@ BASE_PATH="$(cd "$(dirname "$0")" && pwd)" +CORECLR_PROFILER_PATH="$(ls ${BASE_PATH}/OpenTelemetry.AutoInstrumentation.Native.* 2>/dev/null)" + +status=$? +if [ $status -ne 0 ]; then + echo "Unable to locate the native profiler inside current directory, possibly due to runtime identifier not being specified when building/publishing. +Attempting to detect the runtime and use the native profiler from corresponding subdirectory of runtimes directory." + + case "$(uname -s | tr '[:upper:]' '[:lower:]')" in + linux*) + if [ "$(ldd /bin/ls | grep -m1 'musl')" ]; then + OS_TYPE="linux-musl" + else + OS_TYPE="linux" + fi + FILE_EXTENSION=".so" + ;; + darwin*) + OS_TYPE="osx" + FILE_EXTENSION=".dylib" + ;; + esac + + case "$OS_TYPE" in + "linux"|"linux-musl"|"osx") + ;; + *) + echo "Detected operating system type not supported." >&2 + exit 1 + ;; + esac + + case $(uname -m) in + x86_64) ARCHITECTURE="x64" ;; + aarch64) ARCHITECTURE="arm64" ;; + esac + + case "$ARCHITECTURE" in + "x64"|"arm64") + ;; + *) + echo "Detected architecture not supported." >&2 + exit 1 + ;; + esac + CORECLR_PROFILER_PATH="${BASE_PATH}/runtimes/${OS_TYPE}-${ARCHITECTURE}/native/OpenTelemetry.AutoInstrumentation.Native${FILE_EXTENSION}" + if [ ! -f "${CORECLR_PROFILER_PATH}" ]; then + echo "Unable to locate the native profiler." >&2 + exit 1 + fi +fi + +export CORECLR_PROFILER_PATH + # Settings for .NET export ASPNETCORE_HOSTINGSTARTUPASSEMBLIES=OpenTelemetry.AutoInstrumentation.AspNetCoreBootstrapper export CORECLR_ENABLE_PROFILING=1 export CORECLR_PROFILER="{918728DD-259F-4A6A-AC2B-B85E1B658318}" -CORECLR_PROFILER_PATH="$(ls ${BASE_PATH}/OpenTelemetry.AutoInstrumentation.Native.*)" -export CORECLR_PROFILER_PATH + export DOTNET_STARTUP_HOOKS=${BASE_PATH}/OpenTelemetry.AutoInstrumentation.StartupHook.dll # Settings for OpenTelemetry diff --git a/src/Elastic.OpenTelemetry/Diagnostics/LoggerMessages.cs b/src/Elastic.OpenTelemetry/Diagnostics/LoggerMessages.cs index 26686f1..3fd2d99 100644 --- a/src/Elastic.OpenTelemetry/Diagnostics/LoggerMessages.cs +++ b/src/Elastic.OpenTelemetry/Diagnostics/LoggerMessages.cs @@ -47,7 +47,7 @@ public static void LogAgentPreamble(this ILogger logger) logger.LogInformation("Process ID: {ProcessId}", process.Id); logger.LogInformation("Process name: {ProcessName}", process.ProcessName); -#if NET6_0_OR_GREATER +#if NET8_0_OR_GREATER logger.LogInformation("Process path: {ProcessPath}", Environment.ProcessPath); #else logger.LogInformation("Process path: {ProcessPath}", ""); diff --git a/src/Elastic.OpenTelemetry/Elastic.OpenTelemetry.csproj b/src/Elastic.OpenTelemetry/Elastic.OpenTelemetry.csproj index 69f6374..5055985 100644 --- a/src/Elastic.OpenTelemetry/Elastic.OpenTelemetry.csproj +++ b/src/Elastic.OpenTelemetry/Elastic.OpenTelemetry.csproj @@ -2,7 +2,7 @@ Library - netstandard2.0;netstandard2.1;net462;net6.0;net8.0 + netstandard2.0;netstandard2.1;net462;net8.0 Elastic Distribution of OpenTelemetry .NET OpenTelemetry extensions for Elastic Observability, fully native with zero code changes. elastic;opentelemetry;observabillity;apm;logs;metrics;traces;monitoring @@ -19,20 +19,17 @@ - - - + + + - + - - - - + diff --git a/src/Elastic.OpenTelemetry/ElasticOpenTelemetryBuilder.cs b/src/Elastic.OpenTelemetry/ElasticOpenTelemetryBuilder.cs index 6b44c98..a1628c2 100644 --- a/src/Elastic.OpenTelemetry/ElasticOpenTelemetryBuilder.cs +++ b/src/Elastic.OpenTelemetry/ElasticOpenTelemetryBuilder.cs @@ -4,7 +4,6 @@ using System.Diagnostics; using System.Diagnostics.Tracing; -using System.Reflection; using Elastic.OpenTelemetry.Configuration; using Elastic.OpenTelemetry.Diagnostics; using Elastic.OpenTelemetry.Diagnostics.Logging; @@ -16,9 +15,6 @@ using Microsoft.Extensions.Logging; using OpenTelemetry; using OpenTelemetry.Logs; -using OpenTelemetry.Metrics; -using OpenTelemetry.Trace; -using static Elastic.OpenTelemetry.Configuration.ElasticOpenTelemetryOptions; namespace Elastic.OpenTelemetry; @@ -169,10 +165,9 @@ internal static partial class LoggerMessages [LoggerMessage(EventId = 2, Level = LogLevel.Information, Message = "No Elastic defaults were enabled.")] public static partial void LogNoElasticDefaults(this ILogger logger); - [LoggerMessage(EventId = 1, Level = LogLevel.Information, Message = "ElasticOpenTelemetryBuilder {Signal} skipped, configured to be disabled")] + [LoggerMessage(EventId = 3, Level = LogLevel.Information, Message = "ElasticOpenTelemetryBuilder {Signal} skipped, configured to be disabled")] public static partial void LogSignalDisabled(this ILogger logger, string signal); - [LoggerMessage(EventId = 1, Level = LogLevel.Information, Message = "Elastic defaults for {Signal} skipped, configured to be disabled")] + [LoggerMessage(EventId = 4, Level = LogLevel.Information, Message = "Elastic defaults for {Signal} skipped, configured to be disabled")] public static partial void LogDefaultsDisabled(this ILogger logger, string signal); - } diff --git a/src/Elastic.OpenTelemetry/Resources/HostDetector.cs b/src/Elastic.OpenTelemetry/Resources/HostDetector.cs index aef3b39..00bd2a6 100644 --- a/src/Elastic.OpenTelemetry/Resources/HostDetector.cs +++ b/src/Elastic.OpenTelemetry/Resources/HostDetector.cs @@ -15,7 +15,7 @@ using Elastic.OpenTelemetry.SemanticConventions; using Microsoft.Extensions.Logging; using OpenTelemetry.Resources; -#if NETFRAMEWORK || NET6_0_OR_GREATER +#if NETFRAMEWORK || NET8_0_OR_GREATER using Microsoft.Win32; #endif @@ -145,7 +145,7 @@ private static IEnumerable GetFilePaths() // this type only exists in .NET 5+ private string? GetMachineIdWindows() { -#if NETFRAMEWORK || NET6_0_OR_GREATER +#if NETFRAMEWORK || NET8_0_OR_GREATER try { using var subKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Cryptography", false); diff --git a/tests/AutoInstrumentation.IntegrationTests/AutoInstrumentation.IntegrationTests.csproj b/tests/AutoInstrumentation.IntegrationTests/AutoInstrumentation.IntegrationTests.csproj index 4fab745..fc33a18 100644 --- a/tests/AutoInstrumentation.IntegrationTests/AutoInstrumentation.IntegrationTests.csproj +++ b/tests/AutoInstrumentation.IntegrationTests/AutoInstrumentation.IntegrationTests.csproj @@ -1,7 +1,7 @@ - + - net8.0 + net9.0 enable enable Elastic.OpenTelemetry.AutoInstrumentation.IntegrationTests @@ -10,7 +10,7 @@ - + diff --git a/tests/AutoInstrumentation.IntegrationTests/ExampleApplicationContainer.cs b/tests/AutoInstrumentation.IntegrationTests/ExampleApplicationContainer.cs index 4914e20..8f40078 100644 --- a/tests/AutoInstrumentation.IntegrationTests/ExampleApplicationContainer.cs +++ b/tests/AutoInstrumentation.IntegrationTests/ExampleApplicationContainer.cs @@ -50,7 +50,6 @@ public ExampleApplicationContainer() .WithLogger(ConsoleLogger.Instance) .WithOutputConsumer(_output) .Build(); - } public async Task InitializeAsync() diff --git a/tests/AutoInstrumentation.IntegrationTests/PluginLoaderTests.cs b/tests/AutoInstrumentation.IntegrationTests/PluginLoaderTests.cs index 20fc496..625bc6d 100644 --- a/tests/AutoInstrumentation.IntegrationTests/PluginLoaderTests.cs +++ b/tests/AutoInstrumentation.IntegrationTests/PluginLoaderTests.cs @@ -11,7 +11,6 @@ namespace Elastic.OpenTelemetry.AutoInstrumentation.IntegrationTests; public class PluginLoaderTests(ExampleApplicationContainer exampleApplicationContainer) : IPartitionFixture { - [NotWindowsCiFact] public async Task ObserveDistributionPluginLoad() { @@ -22,9 +21,7 @@ public async Task ObserveDistributionPluginLoad() .And.Contain("Elastic Distribution of OpenTelemetry .NET:") .And.Contain("ElasticOpenTelemetryBuilder initialized") .And.Contain("Added 'Elastic.OpenTelemetry.Processors.ElasticCompatibilityProcessor'"); - } - } public class NotWindowsCiFact : FactAttribute diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index d7dfa3f..795712b 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -22,17 +22,17 @@ - + - + - + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/tests/Elastic.OpenTelemetry.EndToEndTests/Elastic.OpenTelemetry.EndToEndTests.csproj b/tests/Elastic.OpenTelemetry.EndToEndTests/Elastic.OpenTelemetry.EndToEndTests.csproj index e78b0c3..8b64754 100644 --- a/tests/Elastic.OpenTelemetry.EndToEndTests/Elastic.OpenTelemetry.EndToEndTests.csproj +++ b/tests/Elastic.OpenTelemetry.EndToEndTests/Elastic.OpenTelemetry.EndToEndTests.csproj @@ -1,7 +1,7 @@ - + - net8.0 + net9.0 enable enable false @@ -11,12 +11,12 @@ - + - - - - + + + + diff --git a/tests/Elastic.OpenTelemetry.Tests/Elastic.OpenTelemetry.Tests.csproj b/tests/Elastic.OpenTelemetry.Tests/Elastic.OpenTelemetry.Tests.csproj index af48afc..7caa3d0 100644 --- a/tests/Elastic.OpenTelemetry.Tests/Elastic.OpenTelemetry.Tests.csproj +++ b/tests/Elastic.OpenTelemetry.Tests/Elastic.OpenTelemetry.Tests.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 enable enable false @@ -10,8 +10,8 @@ - - + +