Skip to content

Commit 81656b9

Browse files
nr-ahemsathtippmar-nrnrcventura
authored
docs: Update agent development and integration testing documentation (#3063)
* WIP * Fix profiler build and local testing documentation Also fix issue with linux profiler build docker-compose file where it would bomb out if a certain env var wasn't set, for a debug version of the profiler that isn't really relevant most of the time. * Update docs/integration-tests.md Co-authored-by: Marty T <[email protected]> * Add a note for extra clarity --------- Co-authored-by: Marty T <[email protected]> Co-authored-by: Chris Ventura <[email protected]>
1 parent 6737414 commit 81656b9

File tree

3 files changed

+34
-29
lines changed

3 files changed

+34
-29
lines changed

docs/development.md

+23-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Development
22

33
## Requirements
4-
* [Visual Studio 2019](https://visualstudio.microsoft.com/downloads/)
4+
* [Visual Studio 2022](https://visualstudio.microsoft.com/downloads/)
55
* Workloads
66
* .NET desktop development
77
* Desktop development with C++
88
* Individual components
99
* C++ ATL for v142 build tools (x86 & x64)
1010
* Optional installs:
11-
* [Docker Desktop for Windows](https://hub.docker.com/editions/community/docker-ce-desktop-windows/) for building the native Linux binaries.
12-
* [WiX Toolset 3.11](https://wixtoolset.org/releases/) and the WiX Toolset Visual Studio 2019 Extension for building the Windows MSI installer.
11+
* [Docker Desktop for Windows](https://docs.docker.com/desktop/setup/install/windows-install/) for building the native Linux binaries, as well as running containerized integration tests.
12+
* [HeatWave](https://www.firegiant.com/heatwave/) is a Visual Studio extension that enables building the [agent MSI installer solution](../src/Agent/MsiInstaller/MsiInstaller.sln).
1313

1414
## Building
1515

@@ -26,6 +26,7 @@ To get started quickly, this is the only solution you need to build. Building th
2626
| .NET Core | Windows | x64 | src/Agent/newrelichome_x64_coreclr |
2727
| .NET Core | Windows | x86 | src/Agent/newrelichome_x86_coreclr |
2828
| .NET Core | Linux | x64 | src/Agent/newrelichome_x64_coreclr_linux |
29+
| .NET Core | Linux | arm64 | src/Agent/newrelichome_arm64_coreclr_linux |
2930

3031
These home directories can be used to run and test the agent in your development environment.
3132

@@ -51,9 +52,9 @@ CORECLR_PROFILER_PATH=path\to\home\directory\NewRelic.Profiler.dll
5152

5253
### Profiler.sln
5354

54-
The Profiler.sln builds the native profiler component of the .NET agent. The profiler implements interfaces defined by the unmanaged [.NET Profiling API](https://docs.microsoft.com/en-us/dotnet/framework/unmanaged-api/profiling/) that enable the agent to attach to and monitor a .NET process.
55+
The Profiler.sln builds the native profiler component of the .NET agent. The profiler implements interfaces defined by the unmanaged [.NET Profiling API](https://docs.microsoft.com/en-us/dotnet/framework/unmanaged-api/profiling/) that enable the agent to attach to and monitor a .NET process. See [the profiler README](../src/Agent/NewRelic/Profiler/README.md) for more details.
5556

56-
As mentioned above, this solution does not need to be built if you will only be working with the agent's managed C# code. Pre-built versions of the profiler for both Windows (x86 and x64) and Linux (x64) are checked into the repository (src/Agent/_profilerBuild) and are used for creating the home directories built by the FullAgent.sln. These pre-built versions are for development purposes only, and should be updated if you do work on the profiler.
57+
As mentioned above, this solution does not need to be built if you will only be working with the agent's managed C# code. The profiler is [available as a NuGet package](https://www.nuget.org/packages/NewRelic.Agent.Internal.Profiler) and is referenced by the full agent solution from NuGet [here](https://github.com/newrelic/newrelic-dotnet-agent/blob/1f446c282811a0f2ccd71a088b35397a29d961a0/src/Agent/NewRelic/Home/Home.csproj#L16).
5758

5859
You can use a Powershell [script](../src/Agent/NewRelic/Profiler/build/build.ps1) to build the profiler.
5960

@@ -78,6 +79,23 @@ build.ps1 -Platform linux
7879
build.ps1
7980
```
8081

82+
#### Local profiler testing
83+
84+
In order to integrate local profiler changes with local builds of the FullAgent solution:
85+
86+
1. First, build the FullAgent solution from Visual Studio (creating the various agent home dirs in `src/Agent`).
87+
2. Build the profiler for all platforms and architectures: `build.ps1` (which places the profiler artifacts in `src/Agent/_profilerBuild`)
88+
3. Copy the relevant profiler .dll (Windows) or .so (Linux) to the appropriate agent home folder on your system, overwriting the version pulled from NuGet:
89+
```
90+
# Example shown for the Windows 64-bit profiler, testing with the Windows CoreCLR (.NET Core/.NET) version of the agent
91+
copy C:\workspace\newrelic-dotnet-agent\src\Agent\_profilerBuild\x64-Release\NewRelic.Profiler.dll C:\workspace\newrelic-dotnet-agent\src\Agent\newrelichome_x64_coreclr\
92+
93+
# Example shown for the Linux profiler and Linux
94+
copy C:\workspace\newrelic-dotnet-agent\src\Agent\_profilerBuild\linux-x64-release\libNewRelicProfiler.so C:\workspace\newrelic-dotnet-agent\src\Agent\newrelichome_x64_coreclr_linux\
95+
```
96+
97+
Note that if you rebuild the agent solution after copying locally-build profiler files to the agent home dirs, the profiler files will be overwritten with the NuGet package version, and you'll need to copy the local profile files to the home dirs again.
98+
8199
## Testing
82100

83101
* Unit tests use the NUnit framework and are contained in the solutions. Run them using the Visual Studio Test Explorer.

docs/integration-tests.md

+10-21
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ These tests execute against valid New Relic accounts and test a variety of featu
88

99
## Testing on Windows with Visual Studio
1010

11-
Visual Studio 2022 or greater preferred.
11+
Visual Studio 2022 or greater required.
1212

13-
Visual Studio 2019 may work with .NET 6 additionally installed.
13+
All generally available and supported .NET runtimes should be installed (e.g. .NET 8 and .NET 9 as of March 2025)
1414

1515
### Additional install requirements
1616

@@ -22,8 +22,8 @@ Install the "ASP.NET and web development" workload in the "Web & Cloud" category
2222

2323
Depending on which version of Visual Studio you are using, you may have to install some or all of the following:
2424

25-
* .NET 6
26-
* .NET 7
25+
* .NET 8
26+
* .NET 9
2727
* .NET Framework 4.7.1 targeting pack
2828
* .NET Framework 4.8.0 targeting pack
2929
* .NET Framework 4.8.1 targeting pack
@@ -196,7 +196,7 @@ See the test secrets section above on configuring an appropriate account.
196196

197197
#### Selenium tests
198198

199-
We currently have one test that executes a JavaScript ajax request via Selenium. This requires Internet Explorer to be installed and does not yet work with Edge.
199+
We currently have one test that executes a JavaScript ajax request via Selenium. This requires Chrome to be installed.
200200

201201
* NewRelic.Agent.IntegrationTests.BasicInstrumentation.BasicAspWebService.Test
202202

@@ -226,7 +226,7 @@ For more on metric normalization rules see: https://docs.newrelic.com/docs/new-r
226226

227227
#### W3C validation tests
228228

229-
The W3C validation tests requiring installing Python 3.x and a dependency. See the "Python and dependencies" section above.
229+
The W3C validation tests requiring installing Python 3.x and a dependency (`aiohttp`). See the "Python and dependencies" section above.
230230

231231
#### Distributed Tracing tests
232232

@@ -259,20 +259,9 @@ We recommend using [WSL](https://docs.microsoft.com/en-us/windows/wsl/about) to
259259

260260
### Linux system setup
261261

262-
You will need to install the .NET SDKs for .NET Core 3.1, .NET 5, .NET 6, and .NET 7.
262+
You will need to install the .NET SDKs for currently available and supported .NET runtimes (e.g. .NET 8 and .NET 9 as of March 2025).
263263

264-
```
265-
sudo apt-get update -q -y && sudo apt-get install -q -y curl
266-
sudo mkdir -p /usr/share/dotnet
267-
268-
sudo curl -sSL https://builds.dotnet.microsoft.com/dotnet/Sdk/3.1.414/dotnet-sdk-3.1.414-linux-x64.tar.gz | sudo tar -xzC /usr/share/dotnet
269-
sudo curl -sSL https://builds.dotnet.microsoft.com/dotnet/Sdk/5.0.401/dotnet-sdk-5.0.401-linux-x64.tar.gz | sudo tar -xzC /usr/share/dotnet
270-
sudo curl -sSL https://builds.dotnet.microsoft.com/dotnet/Sdk/6.0.100/dotnet-sdk-6.0.100-linux-x64.tar.gz | sudo tar -xzC /usr/share/dotnet
271-
sudo curl -sSL https://builds.dotnet.microsoft.com/dotnet/Sdk/7.0.100/dotnet-sdk-7.0.100-linux-x64.tar.gz | sudo tar -xzC /usr/share/dotnet
272-
273-
sudo ln -sf /usr/share/dotnet/dotnet /usr/bin/dotnet
274-
dotnet --list-sdks
275-
```
264+
See Microsoft's documentation for how to install the required SDKs for your particular Linux distro and hardware platform: https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual
276265

277266
### Set up test secrets
278267

@@ -285,12 +274,12 @@ Refer to the section above in the Windows setup instructions regarding configuri
285274
As previously mentioned, the agent solution needs to be built on Windows. If you are using an Ubuntu VM in WSL, you can use this workflow to run the agent integration tests on Linux:
286275

287276
1. Build the FullAgent.sln in Visual Studio.
288-
2. Copy the agent repo to the Ubuntu VM. The VM's filesystem can be accessed from the Windows host using this path: `\\wsl$\Ubuntu-20.04` (replace `Ubuntu-20.04` with the name of your VM if it's different).
277+
2. Copy the agent repo to the Ubuntu VM. The VM's filesystem can be accessed from the Windows host using this path: `\\wsl$\Ubuntu-24.04` (replace `Ubuntu-24.04` with the name of your VM if it's different).
289278
3. In the VM, from the shell:
290279

291280
```
292281
cd {DOTNET_AGENT_REPO_PATH}/tests/Agent/IntegrationTests/IntegrationTests
293-
sudo dotnet test -f netcoreapp3.1 -c Release --filter RuntimeFramework=NetCore
282+
sudo dotnet test -f net9.0 -c Release --filter RuntimeFramework=NetCore
294283
```
295284

296285
For more details on how to use dotnet test, see https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-test.

src/Agent/NewRelic/Profiler/docker-compose.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3.4'
2-
31
services:
42

53
build:
@@ -17,7 +15,7 @@ services:
1715
privileged: true
1816
volumes:
1917
- .:/profiler
20-
- $CORECLR_NEW_RELIC_HOME:/agent
18+
- ${CORECLR_NEW_RELIC_HOME:-/workspace/src/Agent/NewRelic/newrelichome_x64_coreclr_linux}:/agent
2119
working_dir: /profiler/linux/
2220
build_arm64:
2321
platform: linux/arm64/v8

0 commit comments

Comments
 (0)