Install vFunction and OpenTelemetry Agents on .NET Framework Application running on Azure App Services via the Datadog Multiplexer



Overview

Microsoft .NET Applications have a limitation that only one Agent can be hooked into the Application at a time.

To work around this limitation, the Datadog Multiplexer can be used as the Base Agent. The Datadog Multiplexer includes a configuration file, the loader.conf, that allows additional .NET Agents to run simultaneously on the Application without conflict. The steps below configure:

  1. The Datadog Multiplexer as the primary .NET Agent
  2. The vFunction Agent in the TRACER slot of the loader.conf
  3. The OpenTelemetry Agent in the CUSTOM slot of the loader.conf

Installation Steps


1. Gather information about the running App Service
  1. Open the App from the Azure Portal
  2. From the left-hand sidebar, open Development Tools > Advanced Tools > Go to launch the Kudu Console
  3. On the Menu Bar, open the Process explorer
  4. In the Process Explorer table, click the Properties button next to the w3wp.exe process
  5. Look for the quote-enclosed string after the flag -ap for the w3wp.exe process. This is the AGENT_APPLICATION_NAME used in the vFunction Monolithic Agent installation
  6. The full path to the w3wp.exe process dictates whether this is a 32-bit or 64-bit process, e.g. C:\Windows\System32 or C:\Windows\SysWOW64. This is the the AGENT_ARCHITECTURE used in the vFunction Monolithic Agent installation
  • x86 = C:\Windows\System32
  • x64 = C:\Windows\SysWOW64

2. Install the vFunction Monolithic Agent
  1. Download the vFunction .NET Windows Agent ZIP
  2. In the Kudu Console’s Debug Console > PowerShell editor, drag-and-drop the vFunction Controller Windows Installation ZIP into the right side of C:\home\ so it is automatically unzipped into a vfunction directory
  3. Retrieve the vFunction UI’s Monolithic Application UUIDs:
  1. Log into the vFunction Server’s UI in a browser
  2. In the top-left corner, click the dropdown and select the relevant Application
  3. In the top-center menu bar, click the “Learning” tab
  4. On the left-side, click the “Select Controllers” link
  5. On the left-side, click the “Install Controller” link
  6. In the dialog box, find the YAML-formatted text box that contains the following details. You’ll need these details at a later stage below:
controller:
  name: {display name for this controller}
  host: $your_VF_Server_address
  org_id: 93af7f38-0000-0000-0000-bd9516798497
  app_id: 9fb228fc-0000-0000-0000-db8e83427e14
  client_id: caeadcd1-0000-0000-0000-9c9b37a9e119
  client_secret: 68cb85eb-0000-0000-0000-fb9e7f1d9240
  1. Add the Environment Variables for the vFunction Dynamic Agent and install the Agent
### Replace the $CHANGE_ME values with the Required Configuration Settings. For detailed Settings explanations, see:
### https://kb.vfunction.com/installations/configurable-settings/mono-dynamic-agent/dotnet/windows
powershell -NoProfile -ExecutionPolicy unrestricted -Command "
New-Item -Path Env:\VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_NAME -Value '$CHANGE_ME';
New-Item -Path Env:\VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_HOST -Value '$CHANGE_ME';
New-Item -Path Env:\VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_APP_ID -Value '$CHANGE_ME';
New-Item -Path Env:\VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_ORG_ID -Value '$CHANGE_ME';
New-Item -Path Env:\VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_CLIENT_ID -Value '$CHANGE_ME';
New-Item -Path Env:\VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_CLIENT_SECRET -Value '$CHANGE_ME';
New-Item -Path Env:\VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_TAG -Value '$CHANGE_ME';
New-Item -Path Env:\VF_CONTROLLER_DEFAULT_DOTNET_AGENT_VERSION -Value 'framework';
New-Item -Path Env:\VF_CONTROLLER_DEFAULT_DOTNET_AGENT_APPLICATION_NAME -Value '$CHANGE_ME_FROM_GATHER_INFORMATION_ABOUT_THE_APP_SERVICE';
New-Item -Path Env:\VF_CONTROLLER_DEFAULT_DOTNET_AGENT_ARCHITECTURE -Value '$CHANGE_ME_FROM_GATHER_INFORMATION_ABOUT_THE_APP_SERVICE';
New-Item -Path Env:\VF_CONTROLLER_DEFAULT_DOTNET_AGENT_ENABLE_REJIT -Value 'true';
C:\home\vfunction\controller-installation\install.ps1 -instance default-dotnet -scriptMode true -runAsServices false"

3. Install the OpenTelemetry Agent
  1. Download the OpenTelemetry .NET Auto-instrumentation ZIP
  2. In the Kudu Console’s Debug Console > PowerShell editor, create an otel directory
  3. Go into the newly created C:\home\otel directory
  4. Drag-and-drop the OpenTelemetry .NET Windows Instrumentation ZIP into the right side of C:\home\otel so it is automatically unzipped

4. Install the Datadog Multiplexer
  1. Open the App from the Azure Portal
  2. From the left-hand sidebar, open Development Tools > Extensions
  3. Click Add in the top-center menu bar
  4. Click the Search for an extension to install dropdown under the right-hand Add site extension popup
  5. Type Datadog in the Filter items text box
  6. Select .NET Datadog APM (VERSION)–Datadog. Note that the VERSION listed will define the folder path at a later step
  7. Click Add in the bottom-right pop up

5. Modify the Datadog loader.conf
  1. In the Kudu Console’s Debug Console > PowerShell editor, navigate to C:\home\SiteExtensions\Datadog.AzureAppServices.DotNet\vDATADOG_VERSION\Tracer\win-x64
  2. Edit the loader.conf so only the values below are listed
#Profiler

#Tracer
TRACER;{cd7d4b53-96c8-4552-9c11-6e41df8eab8a};win-x64;C:\\home\\vfunction\\agent\\vfagent.net.dll

#Custom
PROFILER;{918728DD-259F-4A6A-AC2B-B85E1B658318};win-x64;C:\\home\\otel\\win-x64\\OpenTelemetry.AutoInstrumentation.Native.dll
  1. Click the Save button in the top-left corner
  2. Navigate to C:\home\SiteExtensions\Datadog.AzureAppServices.DotNet\vDATADOG_VERSION\Tracer\win-x86
  3. Edit the loader.conf so only the values below are listed
#Profiler

#Tracer
TRACER;{cd7d4b53-96c8-4552-9c11-6e41df8eab8a};win-x64;C:\\home\\vfunction\\agent\\vfagent.net.x86.dll

#Custom
PROFILER;{918728DD-259F-4A6A-AC2B-B85E1B658318};win-x64;C:\\home\\otel\\win-x86\\OpenTelemetry.AutoInstrumentation.Native.dll
  1. Click the Save button in the top-left corner

6. Set the Environment Variables for functionality
  1. Gather the vFunction Server UI’s UUID for Distributed Application UUIDs
  1. Log into the vFunction Server UI
  2. In the top-left corner, click the dropdown
  3. Click Add Application from the dropdown menu
  4. Type a name for the Application in the Application Name text field
  5. Toggle the slider to Distributed
  6. Click the blue Create button
  7. In the dialog box that launches, toggle the tabs to .NET
  8. In the text box with OTEL Environment Variables, find the OTEL_EXPORT_OTLP_ENDPOINT and OTEL_EXPORTER_OTLP_HEADER. These will be used at a later stage of the installation
  1. Open the App from the Azure Portal
  2. From the left-hand sidebar, open Settings > Environment variables
  3. Select Advanced edit from the top-center menu bar
  4. Add the following JSON values as Environment Variables
### Replace VERSION with the Datadog Tracer's Version in the Folder Path
{
    "name": "COMPlus_TailCallOpt",
    "value": "0",
    "slotSetting": false
},
{
    "name": "COR_ENABLE_PROFILING",
    "value": "1",
    "slotSetting": false
},
{
    "name": "COR_PROFILER",
    "value": "{846F5F1C-F9AE-4B07-969E-05C26BC060D8}",
    "slotSetting": false
},
{
    "name": "COR_PROFILER_PATH_32",
    "value": "C:\\home\\SiteExtensions\\Datadog.AzureAppServices.DotNet\\VERSION\\Tracer\\win-x86\\Datadog.Trace.ClrProfiler.Native.dll",
    "slotSetting": false
},
{
    "name": "COR_PROFILER_PATH_64",
    "value": "C:\\home\\SiteExtensions\\Datadog.AzureAppServices.DotNet\\VERSION\\Tracer\\win-x64\\Datadog.Trace.ClrProfiler.Native.dll",
    "slotSetting": false
},
{
    "name": "VF_AGENT_CONF_LOCATION",
    "value": "C:\\home\\vfunction\\config\\agent\\instances\\default-dotnet\\conf.json",
    "slotSetting": false
},
{
    "name": "OTEL_DOTNET_AUTO_INSTALL_DIR", 
	"value": "C:\\home\\otel",
	"slotSetting": false
},
{
    "name": "DOTNET_ADDITIONAL_DEPS", 
	"value": "C:\\home\\otel\\AdditionalDeps",
	"slotSetting": false
},
{
    "name": "DOTNET_SHARED_STORE", 
	"value": "C:\\home\\otel\\store",
	"slotSetting": false
},
{
    "name": "DOTNET_STARTUP_HOOKS", 
	"value": "C:\\home\\otel\\net\\OpenTelemetry.AutoInstrumentation.StartupHook.dll",
	"slotSetting": false
},
{
    "name": "OTEL_DOTNET_AUTO_HOME", 
	"value": "$C:\\home\\otel",
	"slotSetting": false
},
{
    "name": "OTEL_EXPORTER_OTLP_ENDPOINT", 
	"value": "${OTEL_ENDPOINT_FROM_STEP_1}",
	"slotSetting": false
},
{
    "name": "OTEL_EXPORTER_OTLP_HEADERS", 
	"value": "X-VF-APP=${Distributed_App_UID_FROM_STEP_1}",
	"slotSetting": false
},
{
    "name": "OTEL_EXPORTER_OTLP_PROTOCOL", 
	"value": "http/protobuf",
	"slotSetting": false
},
{
    "name": "OTEL_TRACES_EXPORTER", 
	"value": "otlp",
	"slotSetting": false
},
{
    "name": "OTEL_METRICS_EXPORTER", 
	"value": "none",
	"slotSetting": false
},
{
    "name": "OTEL_LOGS_EXPORTER", 
	"value": "none",
	"slotSetting": false
}
  1. Click OK on the bottom of the Environment Variables Popup
  2. Click Apply on the bottom of the Environment Variables list
  3. On the left-hand sidebar, go to Overview
  4. Click Restart on the top-center menu bar to restart the App Services with the hooked Datadog Multiplexer funneling information to the vFunction Monolithic and OpenTelemetry Agents

Confirm Functionality

  1. Confirm that C:\home\vfunction\logs\instances\default-dotnet\vfagent.net.log is written
  2. In the vFunction Server UI for the Monolithic App, confirm that the Agent is Status: Up on the Learning > Select Controllers page and Start Learning
  3. In the vFunction Server UI for the Distributed App, confirm that at least one Agent is Up on the Learning page and Start Learning
  4. If any issues arise: