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:
- The Datadog Multiplexer as the primary .NET Agent
- The vFunction Agent in the TRACER slot of the loader.conf
- The OpenTelemetry Agent in the CUSTOM slot of the loader.conf
Installation Steps
1. Gather information about the running App Service
- Open the App from the Azure Portal
- From the left-hand sidebar, open Development Tools > Advanced Tools > Go to launch the Kudu Console
- On the Menu Bar, open the Process explorer
- In the Process Explorer table, click the Properties button next to the w3wp.exe process
- 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
- 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
- Download the vFunction .NET Windows Agent ZIP
- 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
- Retrieve the vFunction UI’s Monolithic Application UUIDs:
- Log into the vFunction Server’s UI in a browser
- In the top-left corner, click the dropdown and select the relevant Application
- In the top-center menu bar, click the “Learning” tab
- On the left-side, click the “Select Controllers” link
- On the left-side, click the “Install Controller” link
- 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
- 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
- Download the OpenTelemetry .NET Auto-instrumentation ZIP
- In the Kudu Console’s Debug Console > PowerShell editor, create an otel directory
- Go into the newly created C:\home\otel directory
- 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
- Open the App from the Azure Portal
- From the left-hand sidebar, open Development Tools > Extensions
- Click Add in the top-center menu bar
- Click the Search for an extension to install dropdown under the right-hand Add site extension popup
- Type Datadog in the Filter items text box
- Select .NET Datadog APM (VERSION)–Datadog. Note that the VERSION listed will define the folder path at a later step
- Click Add in the bottom-right pop up
5. Modify the Datadog loader.conf
- In the Kudu Console’s Debug Console > PowerShell editor, navigate to C:\home\SiteExtensions\Datadog.AzureAppServices.DotNet\vDATADOG_VERSION\Tracer\win-x64
- 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
- Click the Save button in the top-left corner
- Navigate to C:\home\SiteExtensions\Datadog.AzureAppServices.DotNet\vDATADOG_VERSION\Tracer\win-x86
- 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
- Click the Save button in the top-left corner
6. Set the Environment Variables for functionality
- Gather the vFunction Server UI’s UUID for Distributed Application UUIDs
- Log into the vFunction Server UI
- In the top-left corner, click the dropdown
- Click Add Application from the dropdown menu
- Type a name for the Application in the Application Name text field
- Toggle the slider to Distributed
- Click the blue Create button
- In the dialog box that launches, toggle the tabs to .NET
- 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
- Open the App from the Azure Portal
- From the left-hand sidebar, open Settings > Environment variables
- Select Advanced edit from the top-center menu bar
- 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
}
- Click OK on the bottom of the Environment Variables Popup
- Click Apply on the bottom of the Environment Variables list
- On the left-hand sidebar, go to Overview
- 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
- Confirm that C:\home\vfunction\logs\instances\default-dotnet\vfagent.net.log is written
- 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
- In the vFunction Server UI for the Distributed App, confirm that at least one Agent is Up on the Learning page and Start Learning
- If any issues arise: