From 276d1c172fdcec3bd467b80bfae4ae9f3b1f434b Mon Sep 17 00:00:00 2001 From: Steve Gordon Date: Fri, 22 Nov 2024 17:16:24 +0000 Subject: [PATCH 1/2] Upgrade to .NET 9 SDK --- .github/.github.csproj | 2 +- .github/workflows/bootstrap/action.yml | 5 +- .github/workflows/e2e.yml | 6 +- build/build.fsproj | 2 +- build/patch-dotnet-auto-install.sh | 2 +- build/scripts/Packaging.fs | 7 +-- build/scripts/Targets.fs | 10 ++-- examples/AppHost/AppHost.csproj | 6 +- .../AppHost/Properties/launchSettings.json | 17 +++++- .../Properties/launchSettings.json | 35 +++++------- .../Example.AutoInstrumentation/Dockerfile | 6 +- .../distribution.Dockerfile | 2 +- .../Example.Console/Example.Console.csproj | 4 +- .../Example.MinimalApi.csproj | 2 +- .../Example.WorkerService.csproj | 4 +- examples/ServiceDefaults/Extensions.cs | 2 +- .../ServiceDefaults/ServiceDefaults.csproj | 4 +- global.json | 2 +- ...c.OpenTelemetry.AutoInstrumentation.csproj | 23 +++----- .../_instrument.cmd | 36 +++++++++++- .../_instrument.sh | 56 ++++++++++++++++++- .../Elastic.OpenTelemetry.csproj | 2 +- .../ElasticOpenTelemetryBuilder.cs | 1 - .../ExampleApplicationContainer.cs | 1 - .../PluginLoaderTests.cs | 3 - .../DistributedFixture/ApmUIBrowserContext.cs | 14 ++--- .../DotNetRunApplication.cs | 1 - ...Elastic.OpenTelemetry.EndToEndTests.csproj | 14 ++--- .../Elastic.OpenTelemetry.Tests.csproj | 4 +- 29 files changed, 173 insertions(+), 100 deletions(-) diff --git a/.github/.github.csproj b/.github/.github.csproj index 568bf7d..36ca014 100644 --- a/.github/.github.csproj +++ b/.github/.github.csproj @@ -1,6 +1,6 @@ - net8.0 + net9.0 False diff --git a/.github/workflows/bootstrap/action.yml b/.github/workflows/bootstrap/action.yml index 07ff848..a70b672 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: | @@ -53,6 +49,7 @@ runs: echo "AGENT_VERSION=${AGENT_VERSION}" >> $GITHUB_ENV echo "agent-version=${AGENT_VERSION}" >> $GITHUB_OUTPUT echo "major-version=$(echo ${AGENT_VERSION} | cut -d"." -f1)" >> $GITHUB_OUTPUT + dotnet --version # Setup git config - uses: elastic/oblt-actions/git/setup@v1 \ No newline at end of file diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index fa7c1dd..70e43ee 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -24,7 +24,7 @@ concurrency: env: # (keep_serverless-staging-oblt, keep_serverless-qa-oblt or serverless-production-oblt) - SERVERLESS_PROJECT: serverless-production-oblt + SERVERLESS_PROJECT: keep_serverless-qa-oblt # NOTE: if you add a new job and it's a mandatory check then # update e2e-docs.yml @@ -64,8 +64,8 @@ jobs: with: export_to_environment: true secrets: |- - E2E__BROWSEREMAIL:elastic-observability/elastic-cloud-observability-team-pro-username - E2E__BROWSERPASSWORD:elastic-observability/elastic-cloud-observability-team-pro-password + E2E__BROWSEREMAIL:elastic-observability/elastic-cloud-observability-team-qa-username + E2E__BROWSERPASSWORD:elastic-observability/elastic-cloud-observability-team-qa-password - name: End-to-end tests run: ./build.sh test --test-suite=e2e diff --git a/build/build.fsproj b/build/build.fsproj index 40a5dc5..41c071b 100644 --- a/build/build.fsproj +++ b/build/build.fsproj @@ -1,6 +1,6 @@ - net8.0 + net9.0 Exe $(NoWarn);NU1701 false diff --git a/build/patch-dotnet-auto-install.sh b/build/patch-dotnet-auto-install.sh index 4ab6ef0..ac963d7 100644 --- a/build/patch-dotnet-auto-install.sh +++ b/build/patch-dotnet-auto-install.sh @@ -47,7 +47,7 @@ case "$ARCHITECTURE" in esac test -z "$OTEL_DOTNET_AUTO_HOME" && OTEL_DOTNET_AUTO_HOME="$HOME/.otel-dotnet-auto" -test -z "$VERSION" && VERSION="v1.7.0" +test -z "$VERSION" && VERSION="v1.9.0" DOWNLOAD_DIR="${DOWNLOAD_DIR:=${TMPDIR:=$(mktemp -d)}}" diff --git a/build/scripts/Packaging.fs b/build/scripts/Packaging.fs index 5290a55..a094c01 100644 --- a/build/scripts/Packaging.fs +++ b/build/scripts/Packaging.fs @@ -134,13 +134,8 @@ let stageInstrumentationScript (stagedZips:List) = let stageInstallationBashScript () = let installScript = downloadFileInfo "otel-dotnet-auto-install.sh" let staged = installScript.CopyTo ((stageFile installScript).FullName, true) - // temporary while https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/pull/3549 is not released. - // Should be released after 1.7.0. - // We should be able to read from `staged` instead after - let patchScript = fileInfo Paths.Root <| Path.Combine("build", "patch-dotnet-auto-install.sh") - let contents = - (File.ReadAllText patchScript.FullName) + (File.ReadAllText staged.FullName) .Replace("/open-telemetry/opentelemetry-dotnet-instrumentation/", "/elastic/elastic-otel-dotnet/") .Replace("opentelemetry-dotnet-instrumentation", "elastic-dotnet-instrumentation") .Replace("v" + Software.OpenTelemetryAutoInstrumentationVersion.AsString, Software.Version.NormalizeToShorter()) diff --git a/build/scripts/Targets.fs b/build/scripts/Targets.fs index 316564b..2b9aa33 100644 --- a/build/scripts/Targets.fs +++ b/build/scripts/Targets.fs @@ -73,10 +73,12 @@ let private runTests suite _ = | Integration -> [ "--filter"; "FullyQualifiedName~.IntegrationTests" ] | E2E -> [ "--filter"; "FullyQualifiedName~.EndToEndTests" ] | Skip_E2E -> [ "--filter"; "FullyQualifiedName!~.EndToEndTests" ] - - + let settingsArg = ["-s"; "tests/.runsettings"] - let tfmArgs = if OS.Current = OS.Windows then [] else ["-f"; "net8.0"] + let tfmArgs = + if OS.Current = Windows then [] + elif suite.Equals(E2E) then ["-f"; "net8.0"] + else ["-f"; "net9.0"] exec { env (Map ["TEST_SUITE", suite.SuitName]) run "dotnet" ( @@ -87,7 +89,7 @@ let private runTests suite _ = @ ["--"; "RunConfiguration.CollectSourceInformation=true"] ) } - + let private test (arguments:ParseResults) = let arg = arguments.TryGetResult Test_Suite match arg with 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..4695bc6 100644 --- a/examples/AppHost/Properties/launchSettings.json +++ b/examples/AppHost/Properties/launchSettings.json @@ -1,15 +1,28 @@ { "$schema": "http://json.schemastore.org/launchsettings.json", "profiles": { + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:17236;http://localhost:15173", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development", + "DOTNET_ENVIRONMENT": "Development", + "DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21045", + "DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22093" + } + }, "http": { "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, - "applicationUrl": "http://localhost:15114", + "applicationUrl": "http://localhost:15173", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", "DOTNET_ENVIRONMENT": "Development", - "DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:16161" + "DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19153", + "DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20247" } } } diff --git a/examples/Example.AspNetCore.Mvc/Properties/launchSettings.json b/examples/Example.AspNetCore.Mvc/Properties/launchSettings.json index 96dfc62..8e18550 100644 --- a/examples/Example.AspNetCore.Mvc/Properties/launchSettings.json +++ b/examples/Example.AspNetCore.Mvc/Properties/launchSettings.json @@ -1,32 +1,16 @@ { - "$schema": "http://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:45954", - "sslPort": 44302 - } - }, "profiles": { "http": { "commandName": "Project", - "dotnetRunMessages": true, "launchBrowser": true, - "applicationUrl": "http://localhost:5247", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } + "dotnetRunMessages": true, + "applicationUrl": "http://localhost:5247" }, "https": { "commandName": "Project", - "dotnetRunMessages": true, "launchBrowser": true, - "applicationUrl": "https://localhost:7295;http://localhost:5247", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development", - "OTEL_RESOURCE_ATTRIBUTES": "service.name=AspNetCoreApp,service.version=1.0.0,deployment.environment=development" - } + "dotnetRunMessages": true, + "applicationUrl": "https://localhost:7295;http://localhost:5247" }, "IIS Express": { "commandName": "IISExpress", @@ -35,5 +19,14 @@ "ASPNETCORE_ENVIRONMENT": "Development" } } + }, + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:45954", + "sslPort": 44302 + } } -} +} \ No newline at end of file diff --git a/examples/Example.AutoInstrumentation/Dockerfile b/examples/Example.AutoInstrumentation/Dockerfile index 234387c..31d18c5 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 @@ -67,6 +66,7 @@ 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/distribution.Dockerfile b/examples/Example.AutoInstrumentation/distribution.Dockerfile index e965f3c..2ce6c82 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 diff --git a/examples/Example.Console/Example.Console.csproj b/examples/Example.Console/Example.Console.csproj index ff660d3..e1e708b 100644 --- a/examples/Example.Console/Example.Console.csproj +++ b/examples/Example.Console/Example.Console.csproj @@ -2,14 +2,14 @@ Exe - net8.0 + 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..e0aefbd 100644 --- a/examples/Example.WorkerService/Example.WorkerService.csproj +++ b/examples/Example.WorkerService/Example.WorkerService.csproj @@ -1,14 +1,14 @@ - 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..a142d88 100644 --- a/examples/ServiceDefaults/Extensions.cs +++ b/examples/ServiceDefaults/Extensions.cs @@ -30,7 +30,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..2d20800 100644 --- a/examples/ServiceDefaults/ServiceDefaults.csproj +++ b/examples/ServiceDefaults/ServiceDefaults.csproj @@ -10,8 +10,8 @@ - - + + diff --git a/global.json b/global.json index 42f2b94..00b67ca 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.404", + "version": "9.0.100", "rollForward": "latestFeature", "allowPrerelease": false } diff --git a/src/Elastic.OpenTelemetry.AutoInstrumentation/Elastic.OpenTelemetry.AutoInstrumentation.csproj b/src/Elastic.OpenTelemetry.AutoInstrumentation/Elastic.OpenTelemetry.AutoInstrumentation.csproj index db96356..fe9f4ad 100644 --- a/src/Elastic.OpenTelemetry.AutoInstrumentation/Elastic.OpenTelemetry.AutoInstrumentation.csproj +++ b/src/Elastic.OpenTelemetry.AutoInstrumentation/Elastic.OpenTelemetry.AutoInstrumentation.csproj @@ -1,14 +1,14 @@ - net6.0;net8.0;net462 + net8.0;net462 enable enable True - + @@ -18,31 +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/Elastic.OpenTelemetry.csproj b/src/Elastic.OpenTelemetry/Elastic.OpenTelemetry.csproj index 69f6374..9cd8688 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 diff --git a/src/Elastic.OpenTelemetry/ElasticOpenTelemetryBuilder.cs b/src/Elastic.OpenTelemetry/ElasticOpenTelemetryBuilder.cs index 7804718..d8cd735 100644 --- a/src/Elastic.OpenTelemetry/ElasticOpenTelemetryBuilder.cs +++ b/src/Elastic.OpenTelemetry/ElasticOpenTelemetryBuilder.cs @@ -170,5 +170,4 @@ internal static partial class LoggerMessages [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/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/Elastic.OpenTelemetry.EndToEndTests/DistributedFixture/ApmUIBrowserContext.cs b/tests/Elastic.OpenTelemetry.EndToEndTests/DistributedFixture/ApmUIBrowserContext.cs index ce5da3d..7090f07 100644 --- a/tests/Elastic.OpenTelemetry.EndToEndTests/DistributedFixture/ApmUIBrowserContext.cs +++ b/tests/Elastic.OpenTelemetry.EndToEndTests/DistributedFixture/ApmUIBrowserContext.cs @@ -23,7 +23,7 @@ public ApmUIBrowserContext(IConfigurationRoot configuration, string serviceName) // https://{instance}.kb.us-east-1.aws.elastic.cloud/app/apm/services?comparisonEnabled=true&environment=ENVIRONMENT_ALL&rangeFrom=now-15m&rangeTo=now&offset=1d var endpoint = configuration["E2E:Endpoint"]?.Trim() ?? string.Empty; var newBase = endpoint.Replace(".apm.", ".kb."); - KibanaAppUri = new Uri(new Uri(newBase), "app/apm"); + KibanaAppUri = new Uri($"{newBase}/app/apm"); } public Uri KibanaAppUri { get; } @@ -63,7 +63,6 @@ public async Task InitializeAsync() public string? StorageState { get; set; } - public async Task NewProfiledPage(string testName) { var page = await Browser.NewPageAsync(new() { StorageState = StorageState }); @@ -78,7 +77,6 @@ await page.Context.Tracing.StartAsync(new() return page; } - public async Task OpenApmLandingPage(string testName) { var page = await NewProfiledPage(testName); @@ -88,17 +86,17 @@ public async Task OpenApmLandingPage(string testName) public async Task WaitForServiceOnOverview(IPage page) { - var timeout = (float)TimeSpan.FromSeconds(30).TotalMilliseconds; var servicesHeader = page.GetByRole(AriaRole.Heading, new() { Name = "Services" }); await servicesHeader.WaitForAsync(new() { State = WaitForSelectorState.Visible, Timeout = timeout }); + Console.WriteLine($"Search for service name: {_serviceName}"); + //service.name : dotnet-e2e-* - var queryBar = page.GetByRole(AriaRole.Textbox, new() { Name = "Start typing to search and filter the APM page" }); + var queryBar = page.GetByRole(AriaRole.Searchbox, new() { Name = "Search services by name" }); await queryBar.WaitForAsync(new() { State = WaitForSelectorState.Visible, Timeout = timeout }); - - await queryBar.FillAsync($"service.name: {_serviceName}"); + await queryBar.FillAsync(_serviceName); await queryBar.PressAsync("Enter"); Exception? observed = null; @@ -115,6 +113,8 @@ public async Task WaitForServiceOnOverview(IPage page) } catch (Exception e) { + await page.ScreenshotAsync(new() { Path = $"squibble{i}.jpeg", FullPage = true }); + observed ??= e; await page.ReloadAsync(); } diff --git a/tests/Elastic.OpenTelemetry.EndToEndTests/DistributedFixture/DotNetRunApplication.cs b/tests/Elastic.OpenTelemetry.EndToEndTests/DistributedFixture/DotNetRunApplication.cs index 59a6f28..a12831f 100644 --- a/tests/Elastic.OpenTelemetry.EndToEndTests/DistributedFixture/DotNetRunApplication.cs +++ b/tests/Elastic.OpenTelemetry.EndToEndTests/DistributedFixture/DotNetRunApplication.cs @@ -70,7 +70,6 @@ private LongRunningArguments CreateStartArgs() { "OTEL_BSP_SCHEDULE_DELAY", "1000" }, { "OTEL_BSP_MAX_EXPORT_BATCH_SIZE", "5" }, { "OTEL_RESOURCE_ATTRIBUTES", $"service.name={_serviceName},service.version=1.0,1,deployment.environment=e2e" }, - { "ELASTIC_OTEL_LOG_DIRECTORY", LogDirectory.FullName }, { "ELASTIC_OTEL_LOG_LEVEL", "INFO" }, }, diff --git a/tests/Elastic.OpenTelemetry.EndToEndTests/Elastic.OpenTelemetry.EndToEndTests.csproj b/tests/Elastic.OpenTelemetry.EndToEndTests/Elastic.OpenTelemetry.EndToEndTests.csproj index e78b0c3..d15e5e5 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..67f5186 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,7 +10,7 @@ - + From 3a90824dbe5e068bc9a1a9432dc7442ec7646918 Mon Sep 17 00:00:00 2001 From: Steve Gordon Date: Sat, 23 Nov 2024 06:31:50 +0000 Subject: [PATCH 2/2] Update docs project --- docs/docs.csproj | 2 +- docs/get-started.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs.csproj b/docs/docs.csproj index b4ca8bf..18aece6 100644 --- a/docs/docs.csproj +++ b/docs/docs.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 False diff --git a/docs/get-started.md b/docs/get-started.md index 3007f25..dc3ebc4 100644 --- a/docs/get-started.md +++ b/docs/get-started.md @@ -84,7 +84,7 @@ host-based applications like [worker services](https://learn.microsoft.com/en-us 1. To take advantage of the OpenTelemetry SDK instrumentation for ASP.NET Core, add the following NuGet package to your project: ```xml - + ``` This package includes instrumentation to collect traces for requests handled by ASP.NET Core endpoints.