This folder contains the source code for the Datadog .NET APM Tracer. The .NET Tracer automatically instruments supported libraries out-of-the-box and also supports custom instrumentation to instrument your own code.
Configure the Datadog Agent for APM as described in our documentation. For automatic instrumentation, install and enable the .NET Tracer as described in our documentation.
The Datadog .NET APM Tracer allows you to manually instrument your application (in addition to automatic instrumentation). To use it, please follow the NuGet package documentation
You can develop the tracer on various environments.
- Visual Studio 2022 (v17) or newer
- Workloads
- Desktop development with C++
- .NET desktop development
- Optional: ASP.NET and web development (to build samples)
- Individual components
- When opening a solution, Visual Studio will prompt you to install any missing components. The prompt will appear in the "Solution Explorer". A list of all recommended components can be found in our .vsconfig-file.
- Workloads
- .NET 7.0 SDK
- Optional: .NET 7.0 x86 SDK to run 32-bit tests locally
- Optional: ASP.NET Core Runtimes to run tests locally
- Optional: nuget.exe CLI v5.3 or newer
- Optional: WiX Toolset 3.11.1 or newer to build Windows installer (msi)
- WiX Toolset Visual Studio Extension to build installer from Visual Studio
- Optional: Docker for Windows to build Linux binaries and run integration tests on Linux containers.
- Requires Windows 10 (1607 Anniversary Update, Build 14393 or newer)
Microsoft provides evaluation developer VMs with Windows and Visual Studio pre-installed.
This repository uses Nuke for build automation. To see a list of possible targets run:
.\build.cmd --help
For example:
# Clean and build the main tracer project
.\build.cmd Clean BuildTracerHome
# Build and run managed and native unit tests. Requires BuildTracerHome to have previously been run
.\build.cmd BuildAndRunManagedUnitTests BuildAndRunNativeUnitTests
# Build NuGet packages and MSIs. Requires BuildTracerHome to have previously been run
.\build.cmd PackageTracerHome
# Build and run integration tests. Requires BuildTracerHome to have previously been run
.\build.cmd BuildAndRunWindowsIntegrationTests
The recommended approach for Linux is to build using Docker. You can use this approach for both Windows and Linux hosts. The build_in_docker.sh script automates building a Docker image with the required dependencies, and running the specified Nuke targets. For example, on Linux:
# Clean and build the main tracer project
./build_in_docker.sh Clean BuildTracerHome
# Build and run managed unit tests. Requires BuildTracerHome to have previously been run
./build_in_docker.sh BuildAndRunManagedUnitTests
# Build and run integration tests. Requires BuildTracerHome to have previously been run
./build_in_docker.sh BuildAndRunLinuxIntegrationTests
Alternatively, on Windows:
./build_in_docker.ps1 BuildTracerHome BuildAndRunLinuxIntegrationTests
You can use Rider and CLion, or Visual Studio Code to develop on macOS. When asked to select a solution file select Datadog.Trace.OSX.slnf
. If using CLion for the native code make sure to select "Let CMake decide" for the generator.
Building and testing can be done through the following Nuke targets:
# Clean and build the main tracer project
./build.sh Clean BuildTracerHome
# Build and run managed and native unit tests. Requires BuildTracerHome to have previously been run
./build.sh BuildAndRunManagedUnitTests BuildAndRunNativeUnitTests
# Build NuGet packages and MSIs. Requires BuildTracerHome to have previously been run
./build.sh PackageTracerHome
# Start IntegrationTests dependencies.
docker-compose up StartDependencies.OSXARM64
# Build and run integration tests. Requires BuildTracerHome to have previously been run
./build.sh BuildAndRunOsxIntegrationTests
# Build and run integration tests filtering on one framework, one set of tests and a sample app.
./build.sh BuildAndRunOsxIntegrationTests --framework "net6.0" --filter "rabbit" --SampleName "Samples.Rabbit"
# Stop IntegrationTests dependencies.
docker-compose down
Troubleshooting tips for build errors:
- Try deleting the
cmake-build-debug
andobj_*
directories. - Verify your xcode developer tools installation with
xcode-select --install
. You may need to repeat this process after an operating system update.
- Implementing an automatic instrumentation
- Duck typing: usages, best practices, and benchmarks
- Datadog.Trace NuGet package README
Datadog APM
- Datadog APM
- Datadog APM - Tracing .NET Core Applications
- Datadog APM - Tracing .NET Framework Applications
Microsoft .NET Profiling APIs
OpenTracing