Setting Up RUM with .NET
  • 22 Sep 2021
  • 2 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Setting Up RUM with .NET

  • Dark
    Light
  • PDF

This document details how to enable RUM for the APM Profiler in your .NET application running on Linux or Windows.

Prerequisites

1. Install the Latest Version of the Agent and Profiler

Required Agent Versions
  • Windows Agent v4.32+
  • Linux Agent v2.31+
  • .NET Profiler 1.4.5+

If you are running the .NET Legacy profiler, please update to the V2 profiler.

2. Enable RUM

Follow the RUM Getting Started guide to Enable RUM on your account .

3. Setup APM for your Application

Follow the .NET Getting Started Guide to configure the profiler for your specific setup. The profiler will need to be properly configured for RUM to function.

4. Configure the RUM Key

In order to identify the data coming from your application pages is tied to your account, you need to make your RUM Key available to your application. This setting is passed to your application via an environment variable, RETRACE_RUM_KEY.

Windows
Add the RETRACE_RUM_KEY to the machine Environment Variables. Its value is the RUM Key available in the Retrace RUM configuration screen.

Linux
Set the RETRACE_RUM_KEY environment variable so that it is available to the application when it launches. This will vary based on how the application is launched (e.g. via systemd or command line).

5. Inject Script into Page

The .NET profiler supports two methods to inject the script into your HTML pages. If you are using ASP.Net MVC or WebForm, you can try to enable auto injection of the script into your application. If this method does not work or you are using an unsupported UI framework, you can inject the script via an API method that you add to your page templates.

Automatic Injection
Automatic Injection is enabled by setting the environment variable RETRACE_RUMV2_ENABLED to the value of ‘true”.

Manual Injection via API
The manual injection method requires that an API call to StackifyLib is inserted into the HTML files without any quoting of the injected string. For example, in an ASP.Net application using Razor pages for the view, you would inject the output of the StackifyLib.Web.RealUserMonitoring.GetHeaderScript method into the page(s) that contain the element of the page. This is typically in the _Layout.cshtml for simple applications like this:

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	@Html.Raw(StackifyLib.Web.RealUserMonitoring.GetHeaderScript())
	<title>@ViewData["Title"]</title>
…
</head>

This API method is available in StackifyLib versions 2.2 and greater.

6. Redeploy your App

Once the previous steps to enable RUM for your account and add the code snippet to your app(s) have been completed, the last step is to deploy the changes to your application.

Viewing RUM Data

Once the following steps have been taken to set up RUM for your apps, data will be reported in the corresponding App Dashboard. To see more information related to what RUM data is presented in the App Dashboard, see the Viewing RUM Data in Retrace help doc.


Was this article helpful?