.NET agent
The Traceable .NET agent is an in-app tracing agent that collects telemetry data from your .NET application and forwards it to the Traceable Platform Agent (TPA). The TPA then processes and sends this data to the Traceable platform for security analysis, observability, and runtime protection.
This topic walks you through the support matrix, prerequisites, installation steps, configuration options, upgrade and uninstallation procedures, and troubleshooting guidelines.
Before You Begin
Ensure the following requirements are met before installing the .NET agent:
You are using **.**NET Core 6, 7, 8, and 9.
Your application is not built on .NET Framework. .NET Framework-based applications are not supported.
You have access to modify environment variables or update the application startup files.
You have access to the deployed Traceable Platform Agent (TPA) endpoint (for example,
http://agent.traceableai:5442). For a TLS connection, the port would be5443.You have permission to install NuGet packages (for manual instrumentation).
The underlying OS is supported if you plan to use blocking or sampling features.
Support Matrix
Component
Versions Supported
Notes
ASP.NET Core
6, 7, 8, 9
Full support for tracing and blocking
gRPC (Core)
2.53.0 and later
Supports gRPC server instrumentation
HttpClient
All .NET Core 6, 7, 8, 9 versions
Supported by default
RestSharp
Same as HttpClient
Wrapper over HttpClient
Support for request blocking
Traceable provides request-blocking support on the following operating system versions. You can install the Traceable .NET agent on other operating systems and continue to collect telemetry data. However, request blocking is not supported on any other operating system.
Debian 10+
Ubuntu 18.04+
Amazon Linux 2+
CentOS 7+
Installation Options and Steps
Traceable provides two options for instrumenting your .NET application. Choose the method that best suits your deployment setup and control preferences.
Option A – Auto Instrumentation
Auto-instrumentation allows you to trace your application without modifying the code. This method works by setting environment variables that hook into the application startup.
Steps
Download the agent binaries for your runtime
Replace
<rid>with your Runtime Identifier (for example,win-x64,linux-x64) and<framework>with your .NET version (for example,net8.0).This command fetches the pre-compiled Traceable .NET agent specific to your environment.
Extract the contents of the downloaded ZIP file
This unzips the agent package into a folder named traceable, which contains binaries and setup scripts.
Run the installation script to set the required environment variables
On Windows:
On Linux:
These scripts configure three essential environment variables that enable the agent to hook into .NET runtime:
DOTNET_STARTUP_HOOKS: Specifies the startup hook assembly.DOTNET_SHARED_STORE: Points to shared dependencies for auto instrumentation.DOTNET_ADDITIONAL_DEPS: Includes additional dependency declarations.Example values:
Restart your application
The .NET runtime reads the environment variables during application startup. A restart is required for instrumentation to begin.
Option B – Manual Instrumentation (SDK-based)
Manual instrumentation provides more control and requires a minor code change. This method is preferred if you are already managing dependencies via csproj.
Steps
Add the Traceable .NET SDK package
This command pulls the Traceable SDK from NuGet and adds it to your project file (.csproj).
Register the Traceable agent in your
Startup.csorProgram.csFor example in
Startup.cs,This enables Traceable to start capturing telemetry and context-aware request data.
(Optional) If you want to control the position of Traceable’s Middleware, then
Startup.csorProgram.csfile can be updated likeDo either Step 2 or Step 3, not both.
You can choose whether Traceable runs before or after specific middleware (for example, CORS, Authentication), depending on what you want to capture.
Configuration Variables
You can configure the .NET agent using either a config.yaml file or environment variables. Environment variables always take precedence over values set in the YAML file.
Following is a sample config.yaml file:
Upgrade
To upgrade to the latest version of the .NET agent:
Auto instrumentation: Download the latest binary package and re-run the
install.ps1orinstall.shscript.Manual instrumentation: Update the version in your
.csprojfile or run:Then execute:
Uninstall
Manual instrumentation:
Remove any related code (such as
AddTraceableAgent) fromStartup.csorProgram.cs.Auto instrumentation: Delete the installed binaries and remove related environment variables from your shell or system configuration.
Troubleshoot
If no data appears in the Traceable platform after setup:
Check if logs are being generated. Traceable logs are written to the application logger or the
stdout.Verify the platform agent endpoint is reachable.
Look for startup logs confirming agent initialization.
Common Issues
Problem
Troubleshooting Tip
No response body captured
Ensure your app sets Content-Type: application/json on responses.
No request body captured
Ensure incoming requests include a Content-Type header.
Status code not reported
Make sure the app returns an explicit HTTP status code.
Env variables not persisting
Add them to .bashrc, .profile, or systemd service configuration.
Last updated
Was this helpful?