Skip to content

.NET Intrusive Monitoring Agent Guide

Instrument IIS-hosted .NET apps at runtime with the OpenTelemetry tracing agent.

7 min read Updated SS MR

Introduction#

The .NET tracing agent is an OpenTelemetry agent that instruments .NET applications at runtime, enabling centralised tracing without requiring code change for IIS-hosted applications. It attaches a native profiler to the IIS (Internet Information Services) worker process (w3wp.exe) to collect trace data and send it to an OpenTelemetry Collector (otel-collector) using the OTLP/gRPC protocol. It captures application performance telemetry—such as request traces, dependencies, and service metrics—without requiring code changes or SDKs.

Each instrumented server communicates with the OTel collector to provide visibility into request latency, error rates, and the overall health of the .NET applications.

Architecture#

.NET Intrusive Monitoring Agent architecture
.NET Intrusive Monitoring Agent architecture

Prerequisites#

Ensure the following prerequisites are met:

Note: Supported OS – Windows server only.

  • Windows Server 2016 or later (recommended: 2019, 2022, or 2025).
  • IIS v10.0.
  • .NET v5, v6, v7, or v8.
  • PowerShell v5.1.
  • Admin privileges (for installation, configuration, and uninstallation).
  • HEAL (OTel Collector) IP & Port.

Installation of the .NET Tracing Agent#

Follow the steps below to install the .NET tracing agent:

Note:
* Ensure the user has the admin privileges.
* Avoid the C: drive and install the .NET agent in any other drive.

  1. Place the latest .NET agent build in the specific folder.

    For example:

    Latest .NET agent build placed in the folder
    .NET agent build folder

  2. In Windows PowerShell, navigate to the directory where the .NET agent build is present.

    cd <path>\healagent directory
    

    For example:

    2a.png

    Navigating to the healagent directory in PowerShell

    Expected output:

    Expected output of the cd command

  3. Ensure the build files are present in the directory:

    ls
    

    For example:

    Listing the build files with ls

  4. Execute the command below to install the .NET tracing agent:

    .\install.sh
    

    For example:

    Running .\install.sh

    Expected output:

    * Processing:

    Installation processing output

    * End message:

    Installation end message

Configuration of the .NET Tracing Agent#

Follow the steps to configure the agent:

Note: Ensure the user has the admin privileges.

1. The .NET tracing agent uses system-level environment variables, so IIS worker processes automatically load the profiler.

For example: Set the environment variables in Windows as follows:

OTEL_TRACES_EXPORTER=otlp
OTEL_EXPORTER_OTLP_ENDPOINT=http://192.0.2.70:4317
OTEL_EXPORTER_OTLP_PROTOCOL=grpc
OTEL_SERVICE_NAME=WebTestApp
AGENT_UID=1
INSTANCE_UID=2
Optional logging vars:
OTEL_LOG_LEVEL=info|debug
OTEL_DOTNET_AUTO_LOG_DIRECTORY=C:\Logs\OpenTelemetry

Variable values:

  • OTEL_EXPORTER_OTLP_ENDPOINT: Replace with your collector.
  • OTEL_EXPORTER_OTLP_PROTOCOL: grpc or http/protobuf, depending on your collector.
  • OTEL_SERVICE_NAME: Service name visible in traces.
  • OTEL_LOG_LEVEL: info/debug (use debug for troubleshooting).

2. After setting variables, restart IIS or the affected application pools to apply changes.

Warning: Notify the application team to perform the restart once the downtime is approved.

For example:

Restarting IIS / application pools

Expected output:

Expected output after restart

Deployment Validation#

Follow the steps below to validate the deployment:

1. Verify whether the agent is installed correctly or not:

Test-Path "C:\Program Files\OpenTelemetry .NET AutoInstrumentation"

Expected output:

Test-Path expected output

The output should be True.

2. Generate traffic: Access the application and confirm that log data is sent.

For example: http://IP:Port.

3. Validate data:

  • Confirm that traces appear in Jaeger or your selected backend.

    For example: Jaeger data

    Jaeger data
    Jaeger data

  • Review logs in the following path:

    For example:

    C:\Logs\OpenTelemetry
    

    Expected output:

    OTel data

    OTel data
    OTel data

.NET v8 OOB Support#

This section provides the details to support the .NET v8 module via the HEAL Component agent.

Pre-requisites#

Ensure the following requirement is met on the target system:

1. The dotnet-counters tool must be installed on the target Windows machine before deployment begins.

DB Changes#

Follow the steps below to perform the DB changes:

1. On the primary server, navigate to the migration directory as follows:

/<a1home_path>/Appsone_Service/migrate-db/appsone

a. Copy the SQLs in this migration directory:

20260324132032-add-dotnet-8-version.down.sql
20260324132032-add-dotnet-8-version.up.sql

2. Navigate to the migrate-db folder and execute the following migration command:

env 'MIGRATION-DIR=./appsone' SUBNAME=//<mysql_IP>:3307/appsone username=dbadmin password='<password>' java -
jar migrate-db-0.1.1.jar --migrate

Note: Verify that the migration completes without errors before proceeding to next Step.

3. Once the migration is successful, create a new component instance in the HEAL Control Center specifying the .NET version 8.

i. Log in to HEAL Control Center.

CC Login page
CC Login page

ii. Navigate as follows:

Select the required Account (1) > Setup (2) > Topology (3) > SDM (4).

CC — Account > Setup > Topology > SDM
CC main page

iii. In the SDM page, click on Component Instances (5) > Add (6).

Component Type and Component Version fields
Component Type and Component Version fields

iv. While creating the component_instance, pass the following mandatory attributes:

a. Component Type: DOTNET APPLICATION.
b. Component Version: 8.x.

Process Name field
Process Name field

c. Process Name: Name of the application process running under .NET 8.

Dotnet Counter Path in Control Center
Dotnet Counter Path in Control Center

d. Dotnet Counter Path: The full absolute path to the dotnet-counters executable.

To obtain the dotnet-counters path, log in to the Windows command prompt and execute the following command.

where dotnet-counters

Expected output:

C:\Users\abc\.dotnet\tools\dotnet-counters.exe

For example:

where dotnet-counters expected output
where dotnet-counters expected output

Copy the complete path and add it to the DotNet Counter Path in Control Center.

e. Click Save.
4. Deploy and configure ComponentAgent in the target Windows machine.
5. Unzip the “ca_dotnet_scripts.zip” file.
6. Navigate to the component-agent producers folder.
7. Copy all the scripts and replace them with the existing scripts.
8. Start the agent for data collection.

HEAL UI#

To view the .NET v8 KPI details in HEAL UI, navigate as below:

i. Log in to the HEAL UI.

HEAL UI Login page
HEAL UI Login page

ii. Select the required Account (1) > Services (2) > Applications (3) > Click on DotNetCounter8 (4).

HEAL UI — Services > Applications > DotNetCounter8
Heal UI Dashboard

(5) Click on dotnet_counter_srv as below:

Service Details — Behaviour – Component section
Service Details — Behaviour – Component section

iii. In the service details page, the .NET categories are displayed under the Behaviour – Component section.

Categories list
Categories list

iv. Click on the required category to view the respective KPIs as below:

a. Category: NETCLRExceptions

NETCLRExceptions category
KPI Name Description
Exceptions Thrown This counter displays the total number of exceptions thrown since the start of the application
Exceptions Thrown Per Sec This counter displays the number of exceptions thrown per second. These include both .NET exceptions and unmanaged exceptions that get converted into .NET exceptions

b. Category: NETCLRJit

NETCLRExceptions KPIs

KPI Name Description
IL Bytes Jitted Per Sec Displays the number of Microsoft intermediate language (MSIL) bytes that are just-in-time (JIT) compiled per second.
IL Bytes Jitted Displays the total number of Microsoft intermediate language (MSIL) bytes compiled by the just-in-time (JIT) compiler since the application started.
Methods Jitted Displays the total number of methods just-in-time (JIT) compiled since the application started.
Percent Time in JIT Displays the percentage of elapsed time spent in just-in-time (JIT) compilation since the last just-in-time (JIT) compilation phase.
Time spent in JIT Total time spent by the Just-In-Time compiler converting IL code to native machine code.

c. Category: NETCLRLoading

NETCLRLocksAndThread category

KPI Name Description
Assemblies Displays the current number of assemblies loaded across all application domains in the currently running application.

d. Category: NETCLRLocksAndThread

NETCLRLocksAndThread KPIs
KPI Name Description
Contentions Per Sec The rate at which threads in the runtime attempt to acquire a managed lock unsuccessfully
Current Queue Length This counter displays the total number of threads currently waiting to acquire some managed lock in the application
Queue Length Per Sec This counter displays the number of threads per second waiting to acquire some lock in the application
ThreadPool Completed Work Item Total number of work items that have been processed and completed by the .NET thread pool since the application started.
ThreadPool Queue Length Number of work items currently waiting in the thread pool queue to be processed.
ThreadPool Thread Total number of threads currently active and managed by the .NET thread pool.
Total Contentions This counter displays the total number of times threads in the CLR have attempted to acquire a managed lock unsuccessfully

e. Category: NETCLRMemory

NETCLRMemory KPIs
KPI Name Description
Allocated Bytes Per Sec This counter displays the rate of bytes per second allocated on the GC heap.
Bytes in All Heap Displays the sum of the Gen 1 Heap Size, Gen 2 Heap Size, and Large Object Heap Size counters.
Gen0 GC (Byte) This counter displays the number of times the generation 0 objects are garbage collected since the start of the application
Gen0 Heap Size This counter displays the maximum bytes that can be allocated in generation 0 (Gen 0)
Gen1 Collections This counter displays the number of times the generation 1 objects are garbage collected since the start of the application
Gen1 Heap Size Displays the current number of bytes in generation 1.
Gen2 Collections This counter displays the number of times the generation 2 objects are garbage collected since the start of the application
Gen2 Heap Size Displays the current number of bytes in generation 2.
Large Object Heap Size This counter displays the current size of the Large Object Heap in bytes
Percent Time in GC Displays the percentage of elapsed time that was spent performing a garbage collection since the last garbage collection cycle.
Time paused by GC The total time the application’s execution was paused due to garbage collection.
Total Committed Bytes This counter displays the amount of virtual memory currently committed by the Garbage Collector
Working Set Amount of physical memory currently used by the application process.

Network category

6. Category: Network

Network KPIs
KPI Name Description
Bytes Received The cumulative total number of bytes received by all Socket objects within the AppDomain since the process started.
Bytes Sent The cumulative number of bytes sent by all Socket objects within the AppDomain since the process started
Connections Established The cumulative total number of Socket objects for stream sockets that were ever connected within the AppDomain since the process started

Troubleshooting#

If telemetry is not visible:

  • Verify that profiler DLLs exist in the installation directory.
  • Confirm that environment variables are set at the machine scope.
  • Ensure that Register-OpenTelemetry for IIS was executed after setting variables.
  • Restart IIS or the affected application pools.
  • Check for other profilers (only one CLR profiler is allowed).
  • Validate connectivity to the otel-collector by executing the below command:

    Test-NetConnection -ComputerName 192.xyz.xy.xyz -Port 4317
    

    Test-NetConnection output

    The TcpTestSucceeded value should be True.

Uninstallation of the .NET Tracing Agent#

Follow the steps below to uninstall the .NET tracing agent:

Note: Ensure the user has the admin privileges.

1. Navigate to the directory where the .NET agent folder is present.

cd <path>\healagent directory

For example:

Expected output of the cd command

Expected output:

Navigating to the healagent directory in PowerShell

2. Execute the command below to uninstall the .NET tracing agent:

.\uninstall.sh

Confirm uninstallation by entering Y

a. Confirm by entering Y.

Uninstallation processing output

b. Processing:

Uninstallation end message

c. End message:

Uninstallation completed