From 5093ee834689cb084dbe9d0fa8f7cc08781a2b1f Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Tue, 12 Dec 2023 14:47:31 +0100 Subject: [PATCH 1/4] Fix attaching profiler to GitHub releases (#2236) --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 178eb067e..d25a1a2c1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -66,7 +66,7 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - gh release upload ${{ github.ref_name }} "build/output/ElasticApmAgent_*.zip" "build/output/elastic_apm_profiler_*.zip" + gh release upload ${{ github.ref_name }} "build/output/ElasticApmAgent_${{ steps.bootstrap.outputs.agent-version }}.zip" "build/output/elastic_apm_profiler_${{ steps.bootstrap.outputs.agent-version }}-linux-x64.zip" - if: ${{ success() }} uses: elastic/apm-pipeline-library/.github/actions/slack-message@current @@ -114,7 +114,7 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} continue-on-error: true #continue for now until we see it working in action run: | - gh release upload ${{ github.ref_name }} "build/output/elastic_apm_profiler_*.zip" + gh release upload ${{ github.ref_name }} "build/output/elastic_apm_profiler_${{ steps.bootstrap.outputs.agent-version }}-win-x64.zip" post-release: needs: [ 'release-windows'] From 506e6731ccc789c0cdab4f2fb4672252ab7692fc Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Tue, 12 Dec 2023 14:47:48 +0100 Subject: [PATCH 2/4] Disable IIS test reporting on main for now while IIS tests are not running (#2238) --- .github/workflows/test-windows-iis-reporter.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test-windows-iis-reporter.yml b/.github/workflows/test-windows-iis-reporter.yml index b370fa2ee..ea123af45 100644 --- a/.github/workflows/test-windows-iis-reporter.yml +++ b/.github/workflows/test-windows-iis-reporter.yml @@ -12,6 +12,11 @@ jobs: report: runs-on: ubuntu-latest name: IIS Test Summary + # disable IIS on CI for now. + # Run locally and started failing randomly on github actions + # Could be because of plethora of reasons including no disk space + # Requires longer investigation + if: ${{ false }} steps: - uses: elastic/apm-pipeline-library/.github/actions/test-report@current with: From fd4ba0ce7f2c9c801d0b4d0ac2f245af770fe064 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Tue, 12 Dec 2023 16:01:18 +0100 Subject: [PATCH 3/4] Move StartupHooks over to netstandard2.0 (#2239) * Move StartupHooks over to netstandard2.0 * dotnet format --- build/scripts/Build.fs | 6 +-- .../Elastic.Apm.StartupHook.Loader.csproj | 38 ++++++++++--------- .../ElasticApmAgentStartupHook.csproj | 6 ++- .../StartupHookLogger.cs | 24 ++++++------ 4 files changed, 39 insertions(+), 35 deletions(-) diff --git a/build/scripts/Build.fs b/build/scripts/Build.fs index 25eda918f..0f50b0f7f 100644 --- a/build/scripts/Build.fs +++ b/build/scripts/Build.fs @@ -218,7 +218,7 @@ module Build = agentDir.Create() // copy startup hook to root of agent directory - !! (Paths.BuildOutput "ElasticApmAgentStartupHook/netcoreapp2.2") + !! (Paths.BuildOutput "ElasticApmAgentStartupHook/netstandard2.0") |> Seq.filter Path.isDirectory |> Seq.map DirectoryInfo |> Seq.iter (copyDllsAndPdbs agentDir) @@ -231,14 +231,14 @@ module Build = |> Seq.iter (copyDllsAndPdbs (agentDir.CreateSubdirectory(sprintf "%i.0.0" getCurrentApmDiagnosticSourceVersion.Major))) // assemblies compiled against older version of System.Diagnostics.DiagnosticSource - !! (Paths.BuildOutput (sprintf "Elastic.Apm.StartupHook.Loader_%i.0.0/netcoreapp2.2" oldDiagnosticSourceVersion.Major)) + !! (Paths.BuildOutput (sprintf "Elastic.Apm.StartupHook.Loader_%i.0.0/netstandard2.0" oldDiagnosticSourceVersion.Major)) ++ (Paths.BuildOutput (sprintf "Elastic.Apm_%i.0.0/netstandard2.0" oldDiagnosticSourceVersion.Major)) |> Seq.filter Path.isDirectory |> Seq.map DirectoryInfo |> Seq.iter (copyDllsAndPdbs (agentDir.CreateSubdirectory(sprintf "%i.0.0" oldDiagnosticSourceVersion.Major))) // assemblies compiled against 6.0 version of System.Diagnostics.DiagnosticSource - !! (Paths.BuildOutput (sprintf "Elastic.Apm.StartupHook.Loader_%i.0.0/netcoreapp2.2" oldDiagnosticSourceVersion.Major)) //using old version here, because it the netcoreapp2.2 app can't build with diagnosticsource6 + !! (Paths.BuildOutput (sprintf "Elastic.Apm.StartupHook.Loader_%i.0.0/netstandard2.0" oldDiagnosticSourceVersion.Major)) //using old version here, because it the netcoreapp2.2 app can't build with diagnosticsource6 ++ (Paths.BuildOutput (sprintf "Elastic.Apm_%i.0.0/net6.0" diagnosticSourceVersion6.Major)) |> Seq.filter Path.isDirectory |> Seq.map DirectoryInfo diff --git a/src/startuphook/Elastic.Apm.StartupHook.Loader/Elastic.Apm.StartupHook.Loader.csproj b/src/startuphook/Elastic.Apm.StartupHook.Loader/Elastic.Apm.StartupHook.Loader.csproj index 109cdb28d..19d9afedc 100644 --- a/src/startuphook/Elastic.Apm.StartupHook.Loader/Elastic.Apm.StartupHook.Loader.csproj +++ b/src/startuphook/Elastic.Apm.StartupHook.Loader/Elastic.Apm.StartupHook.Loader.csproj @@ -1,23 +1,25 @@ - - - netcoreapp2.2 - false - + + netstandard2.0 + false + - - - - - - - + + + + + + + + + + + + + + StartupHookLogger.cs + + - - - StartupHookLogger.cs - - - diff --git a/src/startuphook/ElasticApmAgentStartupHook/ElasticApmAgentStartupHook.csproj b/src/startuphook/ElasticApmAgentStartupHook/ElasticApmAgentStartupHook.csproj index 6ffb43834..5c79c06d5 100644 --- a/src/startuphook/ElasticApmAgentStartupHook/ElasticApmAgentStartupHook.csproj +++ b/src/startuphook/ElasticApmAgentStartupHook/ElasticApmAgentStartupHook.csproj @@ -1,9 +1,11 @@ - - netcoreapp2.2 + netstandard2.0 ElasticApmAgentStartupHook false ElasticApmStartupHook + + + diff --git a/src/startuphook/ElasticApmAgentStartupHook/StartupHookLogger.cs b/src/startuphook/ElasticApmAgentStartupHook/StartupHookLogger.cs index 290b6e59d..7bbf532ef 100644 --- a/src/startuphook/ElasticApmAgentStartupHook/StartupHookLogger.cs +++ b/src/startuphook/ElasticApmAgentStartupHook/StartupHookLogger.cs @@ -46,19 +46,19 @@ public static StartupHookLogger Create() public void WriteLine(string message) { - if (_enabled) + if (!_enabled) + return; + + try + { + var log = $"[{DateTime.Now:u}] {message}"; + Console.Out.WriteLine(log); + Console.Out.Flush(); + File.AppendAllLines(_logPath, new[] { log }); + } + catch { - try - { - var log = $"[{DateTime.Now:u}] {message}"; - Console.Out.WriteLine(log); - Console.Out.Flush(); - File.AppendAllLines(_logPath, new[] { log }); - } - catch - { - // if we can't log a log message, there's not much that can be done, so ignore - } + // if we can't log a log message, there's not much that can be done, so ignore } } } From ebd4be9af95962e94ebf72ef2aca9b7a58a42c07 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 13 Dec 2023 11:52:29 +0100 Subject: [PATCH 4/4] Add release notes for 1.25.2 (#2240) --- CHANGELOG.asciidoc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 9afcb6630..fd7d625cb 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -23,6 +23,19 @@ endif::[] [[release-notes-1.x]] === .NET Agent version 1.x +[[release-notes-1.25.2]] +==== 1.25.2 + +This release fixes a bug in `Elastic.Apm.AspNetCore` when using ` UseElasticApm()` not correctly setting status codes. +The bug was not present in the more commonly used `Elastic.Apm.NetCoreAll` since it uses a `DiagnosticListener` approach. +With this release we ensure both packages use the exact same `DiagnosticListener` mechanism to instrument ASP.NET Core. + +===== Bug fixes + +{pull}2213[#2213] Remove ApmMiddleWare, only use DiagnosticSource listener for ASP.NET Core. +{pull}2239[#2239] Move StartupHooks over to netstandard2.0. + + [[release-notes-1.25.1]] ==== 1.25.1