Skip to content

Latest commit

 

History

History

tracer

dd-trace-dotnet/tracer

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.

Installation and usage

Getting started

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.

Custom instrumentation

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

Development

You can develop the tracer on various environments.

Windows

Minimum requirements

Microsoft provides evaluation developer VMs with Windows and Visual Studio pre-installed.

Building from a command line

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

Linux

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

macOS

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 and obj_* directories.
  • Verify your xcode developer tools installation with xcode-select --install. You may need to repeat this process after an operating system update.

Additional Technical Documentation

Further Reading

Datadog APM

Microsoft .NET Profiling APIs

OpenTracing