Monitoring .NET and .NET Core based applications
You can monitor .NET and .NET Core based applications by using the .NET sensor. The .NET sensor is automatically deployed and installed after you install the Instana agent. To view metrics that are related to .NET and .Net Core based applications in the Instana UI, you must set up .Net and .NET Core tracing for your environment.
For information about how to monitor .Net Framework by using the .NET sensor, see Monitoring .NET Framework.
- Supported information
- Collecting metrics
- Setting up .NET tracing
- Enabling AutoProfile™
- OpenTelemetry Integration
- Troubleshooting
- Known issues
Supported information
The .NET sensor supports the following operating systems and runtimes.
Supported operating systems
Instana supports monitoring .NET and .NET Core based applications on the following operating systems:
- Linux®
- Windows®
For more information about the supported versions of Windows and Linux operating systems, see Windows agent requirements and Linux agent requirements.
Supported runtimes
Instana supports monitoring applications that run on .Net 5.0 and later.
.NET 9 instrumentation is supported. However, profiling is currently unsupported due to tech limitations.
Support for .NET Core 2.0 and later is deprecated.
.NET refers to the implementation of .NET that is recommended for all new development: .NET 5 (and .NET Core) and later versions. .NET and .NET Core naming conventions are not used in this document. Instead, the new .NET naming convention is used for consistency.
Runtime | Availability |
---|---|
.NET Core Runtime >= 2.0 and >= 3.0 | Deprecated |
.NET Core Runtime >= 5.0 | GA |
Supported libraries and frameworks for tracing
HTTP-Server | Support policy | Version |
---|---|---|
ASP.NET Core | Deprecated | 1.0.4, 1.1.7, 2.0.1, 2.2.0, and all .NET or .NET Core versions as system library |
ServiceStack | On demand | 5.11.0, 6.10.0, 6.11.0, 8.0.0, 8.1.0, 8.1.2, 8.2.0, 8.2.2, 8.3.0, 8.4.0, 8.5.2, and 8.6.0 |
HTTP-Client | Support policy | Version |
---|---|---|
HttpClient | 45 days | All .NET or .NET Core versions as system library and 4.3.4 |
HttpWebRequest | 0 day | All .NET or .NET Core versions as system library |
RestSharp | 45 days | 106.11.4, 106.11.5, 106.11.7, 106.12.0, 106.13.0, 106.15.0, 107.0.1, 107.0.2, 107.0.3, 107.1.0, 107.1.1, 107.1.2, 107.2.0, 107.2.1, 107.3.0, 108.0.0, 108.0.1, 108.0.2, 108.0.3, 109.0.0, 109.0.1, 110.0.0, 110.1.0, 110.2.0, 111.0.0, 111.3.0, 111.4.0, 111.4.1, and 112.1.0 |
Databases | Support policy | Version |
---|---|---|
ADO drivers | ||
Aerospike | On demand | 3.8.0, 3.9.4–3.9.16.2, 4.0.0–7.3.0, 7.4.0, 8.0.0, and 8.0.1 |
Cassandra | 45 days | 3.4.0, 3.7.0, 3.21.0, and 3.22.0 |
Couchbase | 45 days | 3.2.4, 3.4.8, 3.4.10, 3.5.2, 3.6.0, 3.6.2, 3.6.3, 3.6.4, 3.6.5, 3.6.6, and 3.7.0 |
Elasticsearch | 45 days | 7.13.1, 7.13.2, 7.14.0, 7.14.1, 7.15.0, 7.15.1, 7.15.2, 7.16.0, 7.17.0, 7.17.1, 7.17.2, 7.17.3, 7.17.4, and 7.17.5 |
Redis Service Stack | On demand | 5.0.0, 6.0.0 - 8.0.0, 8.4.0, 8.5.2, and 8.6.0 |
Redis Stack Exchange | 45 days | 1.2.6, 2.0.519, 2.1.28, 2.2.88, 2.5.61, 2.6.122, 2.7.4, 2.8.16, 2.8.22, 2.8.24, and 2.8.31 |
PostgreSQL (NpgSql) | 45 days | 5.0.4, 5.0.5–5.0.16, 6.0.0, 6.0.1, 6.0.2, 6.0.3, 6.0.4, 6.0.5, 6.0.6, 6.0.7, 6.0.8, 6.0.9, 7.0.0, 7.0.1, 7.0.2, 7.0.4, 8.0.3, 8.0.4, 8.0.5, 9.0.2, and 9.0.3 |
Azure Cosmos Client | 45 days | 3.1.1, 3.3.1, 3.4.1, 3.5.1, 3.6.0, 3.7.0–3.13.0, 3.15.0, 3.15.1, 3.16.0, 3.17.0, 3.17.1, 3.18.0, 3.19.0, 3.20.0, 3.20.1, 3.21.0, 3.22.0, 3.22.1, 3.23.0, 3.24.0, 3.25.0, 3.26.0, 3.26.1, 3.26.2, 3.27.0, 3.27.1, 3.27.2, 3.28.0, 3.29.0, 3.30.0, 3.30.1, 3.31.0, 3.31.1, 3.31.2, 3.32.3, 3.33.0, 3.35.0, 3.35.1, 3.35.2, 3.35.3, 3.36.0, 3.37.0, 3.38.0, 3.39.0, 3.40.0, 3.41.0, 3.42.0, 3.43.0, 3.43.1, 3.44.0, 3.44.1, 3.45.0, 3.46.1, 3.47.0, 3.47.1, 3.47.2, and 3.48.0 |
Azure DocumentDB Core | 45 days | 2.5.1, 2.9.0, 2.9.1, 2.9.2, 2.9.3, 2.9.4, 2.10.0, 2.10.1, 2.10.3, 2.11.0, 2.11.1, 2.11.2, 2.11.3, 2.11.4, 2.11.5, 2.11.6, 2.12.0, 2.13.0, 2.13.1, 2.14.0, 2.14.1, 2.15.0, 2.16.0, 2.16.1, 2.16.2, 2.17.0, 2.18.0, 2.19.0, 2.20.0, 2.21.0, and 2.22.0 |
MongoDB | 45 days | 2.4.4, 2.10.3, 2.11.3, 2.12.5, 2.13.3, 2.14.1, 2.15.1, 2.16.1, 2.17.1, 2.18.0, 2.19.2–2.21.0, 2.21.0 - 2.28.0, 2.29.0, 2.30.0, 3.0.0, 3.1.0, 3.2.0, 3.2.1, and 3.3.0 |
Google Cloud Storage | 45 days | 3.3.0, 4.6.0, 4.7.0, 4.8.0, 4.9.0, 4.10.0, and 4.11.0 |
AWSSDK.DynamoDBv2 | 45 days | 3.7.0, 3.7.0.20, 3.7.201.7, 3.7.303.18, 3.7.303.20, 3.7.400.6, 3.7.402, 3.7.404.13, and 3.7.405.2, 3.7.405.4, 3.7.405.8, 3.7.405.10, 3.7.405.13, 3.7.405.15, 3.7.405.19, 3.7.405.23, 3.7.405.26, 3.7.405.29, 3.7.405.32, 3.7.405.38, 3.7.406.1, 3.7.406.5, 3.7.406.6, and 3.7.406.14 |
IBM DB2 (Windows) | Deprecated | 3.1.0.400, 3.1.0.500, and 3.1.0.600 |
IBM DB2 (Linux) | Deprecated | 3.1.0.500 |
AWS S3 | 45 days | 3.7.0.28, 3.7.203.11, 3.7.309, 3.7.309.3, 3.7.402.2, 3.7.405.2, 3.7.411.1, 3.7.411.4, 3.7.411.6, 3.7.412.2, 3.7.412.5, 3.7.413.1, 3.7.413.4, 3.7.414.2, 3.7.415.1, 3.7.415.4, 3.7.415.8, 3.7.415.10, 3.7.415.16, 3.7.415.18, 3.7.415.22, 3.7.415.23, and 3.7.416.2 |
Memcached | On demand | 2.16.0 |
MySql.Data | 45 days | 8.0.18, 8.0.19, 8.0.20, 8.0.21, 8.0.22, 8.0.23, 8.0.24, 8.0.25, 8.0.26, 8.0.27 - 8.1.0, 8.2.0, 8.3.0, 8.4.0, 9.0.0, 9.1.0, and 9.2.0 |
MySqlConnector | 45 days | 1.3.9, 2.0.0, 2.1.13, 2.2.7, 2.3.0, 2.3.4, 2.3.6, 2.3.7, and 2.4.0 |
System.Data.SqlClient | 45 days | 4.8.2, 4.8.3, 4.8.4, 4.8.5, 4.8.6, and 4.9.0 |
Messaging | Support policy | Version |
---|---|---|
Azure Queue Storage | 45 days | 12.8.0, 12.9.0, 12.10.0, 12.11.0, 12.11.1, 12.12.0, 12.13.0, 12.13.1, 12.14.0, 12.15.0, 12.16.0, 12.17.0, 12.17.1, 12.18.0, 12.19.0, 12.19.1, 12.20.0, 12.21.0, and 12.22.0 |
RabbitMQ | 45 days | 5.2.0, 6.2.2, 6.2.3, 6.2.4, 6.3.0, 6.3.1, 6.4.0, 6.5.0, 6.6.0, 6.7.0, and 6.8.1, 7.0.0, 7.1.0, 7.1.1, and 7.1.2 |
gRPC | 45 days | 2.31.0, 2.57.0, 2.62.0, 2.63.0, 2.64.0, 2.65.0, 2.66.0, 2.67.0, and 2.70.0 |
Google Cloud PubSub | 45 days | 2.1.0, 3.12.0, 3.13.0, 3.14.0, 3.15.0, 3.16.0, 3.18.0, 3.21.0, and 3.22.0 |
Confluent Kafka | 45 days | 1.5.3, 1.6.2, 1.6.3, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0, 1.9.2, 1.9.3, 2.0.2, 2.1.0, 2.1.1, 2.2.0, 2.3.0, 2.4.0, 2.5.0, 2.5.2, 2.5.3, 2.6.0, 2.6.1, 2.8.0, and 2.9.0 |
AWSSDK.SQS | 45 days | 3.7.0, 3.7.200.37, 3.7.301.32, 3.7.400.4, 3.7.400.10, 3.7.400.11, and 3.7.400.31, 3.7.400.71, 3.7.400.77, 3.7.400.78, 3.7.400.82, 3.7.400.85, 3.7.400.86, 3.7.400.89, 3.7.400.92, 3.7.400.96, 3.7.400.99, 3.7.400.102, 3.7.400.105, 3.7.400.111, 3.7.400.113, 3.7.400.117, 3.7.400.118, and 3.7.400.126 |
AWSSDK.SimpleNotificationService | 45 days | 3.7.1.10, 3.7.200.36, 3.7.301.50, 3.7.301.52, 3.7.400.6, 3.7.400.38, 3.7.400.71, 3.7.400.77, 3.7.400.78, 3.7.400.82, 3.7.400.85, 3.7.400.86, 3.7.400.88, 3.7.400.92, 3.7.400.96, 3.7.400.99, 3.7.400.102, 3.7.400.105, 3.7.400.111, 3.7.400.113, 3.7.400.117, 3.7.400.118, and 3.7.400.126 |
Logging | Support policy | Version |
---|---|---|
ILogger based log-solutions | 45 days | 2.0.0, 3.0.0, 3.1.0, 5.0.0, 6.0.0, 7.0.0, 8.0.0, 8.0.1, 9.0.0, 9.0.1, 9.0.2, 9.0.3, and 9.0.4 |
NLog | 45 days | 4.5.11, 4.7.10, 5.0.1, 5.1.1, 5.2.4, 5.2.8, 5.3.2, 5.3.3, 5.3.4, and 5.4.0 |
Serilog | 45 days | 2.8.0, 2.9.0, 2.10.0, 2.11.0, 2.12.0, 3.0.0, 3.0.1, 4.0.0, 4.0.1, 4.0.2, and 4.2.0 |
Serverless | Support policy | Version |
---|---|---|
Azure Functions for .NET Core 3.1 | 45 days | 5.0.1, 5.1.0, 5.1.1, 5.1.2, 5.1.3, 5.2.0, 5.2.1, 5.3.1, 5.3.2, and 5.3.3 |
Azure Functions for .NET 6, 7, and 8 | 45 days | 1.20.0, 1.22.0, 1.23.0, and 2.0.0 |
Amazon.Lambda.Core | 45 days | 2.1.0, 2.2.0, 2.3.0, 2.4.0, 2.5.0, and 2.5.1 |
To prevent creating spans for logs with lower level than the configured level, set the environment variable INSTANA_LOG_LEVEL_CAPTURE
to WARN*
, ERROR
, or OFF
(to disable).
The default value is WARN
.
ORM | Support policy | Version |
---|---|---|
Entity Framework | 45 days | 2.0.0, 3.0.0, 5.0.0, 6.0.0, 6.0.7, 6.0.12, 6.0.22, 6.0.29, 7.0.0., 7.0.5, 7.0.11, 7.0.18, 8.0.0, 8.0.2, 8.0.4, 8.0.6, 8.0.7, 8.0.8, 8.0.10, 9.0.0, 9.0.1, 9.0.2, 9.0.3, and 9.0.4 |
PostgreSQL EntityFramework Core (NpgSql) | 45 days | 3.1.3, 5.0.10, 6.0.6, 6.0.7, 6.0.8, 7.0.0, 7.0.1, 7.0.3, 7.0.4, 7.0.11, 7.0.18, 8.0.0, 8.0.2, 8.0.4, 8.0.8, 9.0.2, 9.0.3, and 9.0.4 |
Schedulers / Task-Management | Support policy | Version |
---|---|---|
Hangfire | 45 days | 1.7.19, 1.8.5, 1.8.12, 1.8.14, 1.8.15, 1.8.17, and 1.8.18 |
Collecting metrics
Metrics collection is supported only on Windows.
Tracked Configuration | Metrics |
---|---|
Name | GC Activity |
Version | Memory Usage |
Arguments | Thread-locks |
Contention | |
Exceptions |
Health signatures
For every sensor, health signatures are evaluated continuously against incoming metrics and are used to raise issues or incidents depending on user impact.
Built-in events trigger issues or incidents based on failing health signatures on entities, and custom events trigger issues or incidents based on the thresholds of an individual metric of any given entity.
For information about built-in events for the .NET sensor, see Built-in events reference.
Retrieving metrics for .NET applications on Linux
Instana supports retrieving metrics for .NET applications that run on Linux. To enable Instana to retrieve metrics for a .Net application running on Linux, deploy the application with Instana.Tracing.Core
nuget-package 1.1.34
or later versions.
You can use the same package for tracing.
Ensure that the package is added, and the application is published.
When the packages are distributed through NuGet.org, you don't need to compile the project that is to be instrumented. You can restore the project by using the nuget.exe
file, if available.
Alternatively, you can download the necessary NuGet packages from Instana.Tracing.Core and Instana.Tracing.Core.Rewriter.Linux or Instana.Tracing.Core.Rewriter.Alpine, and then extract them.
After extraction, point the environment variables to the extracted files as shown in the following steps.
For the application to report metrics to a running agent, set the following environment variable:
DOTNET_STARTUP_HOOKS=[path-to-your-app]/Instana.Tracing.Core.dll
After you set the DOTNET_STARTUP_HOOKS
environment variable, look for the following output in your application:
INSTANA Agent for .NET Core applications installed. Running on 3.1.1
The version string varies depending on the .NET version that you are running.
Setting up .NET tracing
Setting up .NET tracing for your environment is covered in the following sections.
Enabling Instana AutoTrace on .NET
On .NET Core sensor 1.0.56 and later, .NET tracer supports host autotracing on Windows and Linux systems except containers. After you start the agent, start the application. During the discovery startup, the sensor automatically enables the
tracing. You don't need to manually inject the NuGet package and compile the application. During the discovery process, the instana_dotnet_global_env.sh
file is created. This file contains the environment variables that are
required for for .NET Core tracing.
See the following example for the contents of the instana_dotnet_global_env.sh
file:
export CORECLR_ENABLE_PROFILING="1"
export CORECLR_PROFILER_PATH="/opt/instana/agent/data/repo/com/instana/core-clr-extension/1.286.3/core-clr-extension-1.286.3/{glibc/muslc}/CoreProfiler.so"
export CORECLR_PROFILER="{cf0d821e-299b-5307-a3d8-b283c03916dd}"
export DOTNET_STARTUP_HOOKS="/opt/instana/agent/data/repo/com/instana/core-clr-extension/1.286.3/core-clr-extension-1.286.3/{glibc/muslc}/Instana.Tracing.Core.dll"
To enable Instana AutoTrace on .NET applications, modify the agent configuration file configuration.yaml
as shown in the following example:
# netcore Tracing
com.instana.plugin.netcore:
tracing:
enabled: true
Restart the agent to apply the configuration changes.
Enabling .NET tracing manually
Before any application is actively instrumented and traced by the extension, provide the environment settings that .NET needs to load the profiling component. If sensor and tracing are enabled for your host, add the NuGet package for Instana tracing to your application, and set up the appropriate environment variables.
Ensure that diagnostics are enabled for .NET. The environment variables COMPlus_EnableDiagnostics
and DOTNET_EnableDiagnostics
must be set to 1. If these environment variables are disabled, the rewriter cannot attach
to the process. Therefore, calls cannot be rewritten and traces cannot be generated.
Instana supports non and self-contained .NET applications. The self-contained applications require Instana.Tracing.Core
NuGet-package 1.1.34 or later versions. Specify the following environment variable:
DOTNET_STARTUP_HOOKS=[path-to-your-app]/Instana.Tracing.Core.dll
To enable .Net tracing on different platforms, see Enabling .NET tracing on different platforms.
Configuring Kafka trace correlation headers
You can configure the format for Kafka trace correlation headers that are used by the .NET tracer with the INSTANA_KAFKA_HEADER_FORMAT
environment variable. Valid values are binary
, string
, or both
.
Do not disable Kafka trace correlation entirely with INSTANA_KAFKA_TRACE_CORRELATION=false
.
Another alternative is to configure the Kafka trace correlation options at the level of the Instana host agent.
For more information, see Kafka Header Migration.
Ignoring processes
You can exclude specific processes from .NET tracing by configuring an environment variable.
To ignore monitoring of certain processes in Windows, complete the following steps:
-
Add the
INSTANA_REWRITER_BACKOFF
environment variable on the host level. -
Set its value to a list of pool names or process names that is separated by semicolons as shown in the following example:
INSTANA_REWRITER_BACKOFF=my_pool_1;process_1;my_pool_2
-
Restart the IIS services with the
iisreset
command so that IIS can load a new environment.
Disabling manual tracing for .NET
To disable tracing for .NET applications, change the configuration file back to its initial state or set the corresponding flag to false
.
The following example shows the configuration.yaml
file with .NET tracing disabled:
# netcore Tracing
com.instana.plugin.netcore:
tracing:
enabled: false
Restart the agent for the configuration changes to take effect.
Due to the nature of how the Profiling API works, disabling tracing in the agent does not remove or detach the profiler from processes that are started when tracing was enabled (for example, worker-processes). To make sure the profiler is not loaded into the application, restart the host-process.
Enabling AutoProfile™
For .NET users, AutoProfile™ is available for .NET applications that run on both Linux and Windows.
Enabling AutoProfile™ on Linux
To enable AutoProfile™, add the following settings to your agent's configuration.yml
file:
com.instana.plugin.netcore:
profiling:
enabled: true
You can also enable AutoProfile™ by setting the environment variable INSTANA_AUTO_PROFILE
to true.
Enabling AutoProfile™ on Windows
To enable AutoProfile™, complete the following steps:
- Add the following settings to your agent's
configuration.yml
file:com.instana.plugin.netcore: profiling: enabled: true
- Set the environment variable
INSTANA_AUTO_PROFILE
to true.
For more information, see Analyze Profiles.
OpenTelemetry Integration
Instana provides additional .NET components for integrating with OpenTelemetry.
Troubleshooting
See the following commonly observed issues with .Net monitoring and their solutions:
Environment variable contains an invalid value
Monitoring issue type: netcore_env_var_invalid_value
Incorrect values are set for one or more environment variables that are required for activating Instana .NET tracing. Depending on the missing environment variables, you can see only some metrics but not traces in the Instana dashboards for your .NET application. For the environment variables and values that are required for tracing your .NET applications with Instana, see Enabling .NET tracing manually.
The environment variables might contain wrong values if another APM tool is present. In terms of hooking into the .NET runtime, various APM tools use a similar mechanism. If Instana detects another APM tool, an error message is displayed in the Instana UI.
For Instana to trace your .NET application, turn off the other APM agent. To turn off an APM tool, refer to the documentation of the APM tool.
Sensor not connected
Monitoring issue type: netcore_sensor_not_connected
If the Instana host agent does not receive the acknowledgment from the .NET process that it is instrumented with Instana, check whether the following errors occurred:
The host agent might not detect any reason.
To troubleshoot the issue, complete the following steps:
- Verify whether the tracer is installed.
- Verify whether the tracer can connect to the host agent.
Verify that the tracer is installed
Check your application logs for the following entry:
Error getting agent-info, make sure the agent is running and reachable:One or more errors occurred. (Connection refused)
This line indicates that the tracer is installed and running. You can see several entries with the following text:
Process Announcement:One or more errors occurred. (Connection refused)
If you do not see entries with the text in the example, ensure that the following prerequisites are met:
- .NET tracing is enabled in the
configuration.yaml
file of the host agent. - All the required steps in the Tracing documentation are followed.
If your .NET application is running on Kubernetes, try Instana AutoTrace webhook, which automatically and transparently adds .NET instrumentation to your pods.
If you are unable to fix the issue with other troubleshooting steps listed, try the following tips to resolve networking issues:
Verify that the tracer can connect to the host agent
If .NET tracer is installed, verify that .NET process can connect to the host agent on the same host on port 42699. For more information on network visibility, see Network requirements for the Instana host agent.
In containerized platforms, network visibility issues between the containers of the application and Instana host agent might occur. Due to some overlay network setup, the container of the application might not connect to the Instana agent container on the same host.
.NET tracer might be using the wrong IP address or DNS name to communicate with the Instana agent. You can set .NET tracer to use a specific network address by using the INSTANA_AGENT_HOST
environment variable.
In some instances, if you have set up your networking, the issue might not be with the network address, but the issue might be related to the port that is used by the tracer.
If the host agent listen on a different port other than 42699, remap the port for the tracer by using the INSTANA_AGENT_PORT
environment variable.
If you are unable to troubleshoot the issues, open a support case.
Check IL-Rewriter
When IL-Rewriter is loaded into your application, it writes three characteristic lines to the output of your application. If you encounter issues, check whether you can see the following lines in the application logs:
Initializing Instana IL-Rewriter for .NET Core
Logging path is not set
Loading configuration-file /app/instana_tracing/instrumentation.json
The paths may differ depending on your setup, but these lines should be at the very beginning of the output of your app (since the Rewriter will be loaded before your actual app by the runtime)
If these lines do not appear:
*make sure all of the CORECLR
environment-variables are available to your application
Known issues
Application Insights for ASP.NET Core and Instana .NET Core monitoring
Due to some limitations of Application Insights for ASP.NET Core, you can face insufficient data on Application Insights when Instana .NET Core monitoring is running in parallel. If you want to use Application Insights and Instana in parallel, you must disable W3C trace context propagation by disabling injecting of W3C header by Instana. To disable injecting W3C header, set the environment variable INSTANA_W3C_DISABLE_INJECT_HEADERS=1
.