Install - vFunction Distributed and Dynatrace .NET Framework Agents running on a Windows x64 Host
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. This Datadog Multiplexer includes a configuration file that allows you to define two additional .NET Agents to run simultaneously on the Application without conflict.
At a high level, you’ll need to:
- Download and install the two .NET Agents you want to run simultaneously
- Download the Datadog Multiplexer
- Configure the Datadog Multiplexer for the two .NET Agents you want to run simultaneously
- Add the vendor-specific environment variables for the two .NET Agents you want to run
- Add the generic .NET Agent environment variables to run the Datadog Multiplexer
- Restart the Application
Installation Steps
Install the vFunction Distributed Agent
Take the following steps to install the vFunction Distributed Agent and configure it to send traces to the vFunction Server:
- Gather the vFunction Server UI’s UUID for the vFunction Distributed Application
- 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
- Download the OpenTelemetry .NET AutoInstrumentation ZIP. Note that, as an alternative, PowerShell Modules can be downloaded to accomplish this same goal
- Extract the downloaded opentelemetry-dotnet-instrumentation-windows.zip to a location on the Application’s filesystem, such as C:\otel.
- Create User Environment Variables for the User that runs the Application. Note that this can be done manually in the UI or via PowerShell. Both workflows are outlined below:
Setting User Environment Variables Manually in the UI
- On the machine where the Application runs, open the Windows Start Menu and search for, “environment variables”
- Select the search results to edit the environment variables
- On the System Properties dialog box, make sure the Advanced tab is selected
- Select the Environment Variables button at the bottom of this page
- In the Environment Variables dialog box, find the top section for User variables
- Click the New… button and create the following Variables and Values
Note that the Variable Names below are accurate but the Values are not. Use the values relevant to where the OpenTelemetry Instrumentation ZIP was extracted, such as C:\otel
| OTEL_DOTNET_AUTO_INSTALL_DIR | C:\otel |
| DOTNET_ADDITIONAL_DEPS | C:\otel\AdditionalDeps |
| DOTNET_SHARED_STORE | C:\otel\store |
| DOTNET_STARTUP_HOOKS | C:\otel\net\OpenTelemetry.AutoInstrumentation.StartupHook.dll |
| OTEL_DOTNET_AUTO_HOME | C:\otel |
| OTEL_EXPORTER_OTLP_PROTOCOL | http/protobuf |
| OTEL_EXPORTER_OTLP_ENDPOINT | https://vfunction.mycompany.com/api/unauth/otlp as an example |
| OTEL_TRACES_EXPORTER | otlp |
| OTEL_METRICS_EXPORTER | none |
| OTEL_LOGS_EXPORTER | none |
| OTEL_EXPORTER_OTLP_HEADERS | 93af7f38-0000-0000-0000-bd9516798497 as an example |
Some additional flags can be added if the Services talks to a SQL Server or an Oracle Database. These are optional Environment Variables.
| Optional for Microsoft SQL Server: OTEL_DOTNET_AUTO_SQLCLIENT_SET_DBSTATEMENT_FOR_TEXT | true |
| Optional for Oracle: OTEL_DOTNET_AUTO_ORACLEMDA_SET_DBSTATEMENT_FOR_TEXT | true |
Setting User Environment Variables via PowerShell
- On the machine where the Application runs, open PowerShell and run the following commands. Note the comments to modify the Values for some of the Keys
# The Keys below have Values that are going to be environmentally-specific
# Such as C:\otel and vfunction.mycompany.com and the App's VF UUID
# Review and modify this list
[System.Environment]::SetEnvironmentVariable('OTEL_DOTNET_AUTO_INSTALL_DIR', 'C:\otel', [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable('DOTNET_ADDITIONAL_DEPS', 'C:\otel\AdditionalDeps', [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable('DOTNET_SHARED_STORE', 'C:\otel\store', [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable('DOTNET_STARTUP_HOOKS', 'C:\otel\net\OpenTelemetry.AutoInstrumentation.StartupHook.dll', [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable('OTEL_DOTNET_AUTO_HOME', 'C:\otel', [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable('OTEL_EXPORTER_OTLP_ENDPOINT', 'https://vfunction.mycompany.com/api/unauth/otlp as an example', [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable('OTEL_EXPORTER_OTLP_HEADERS', '93af7f38-0000-0000-0000-bd9516798497 as an example', [System.EnvironmentVariableTarget]::User)
# The Keys below have Values that do not need to be modified
[System.Environment]::SetEnvironmentVariable('OTEL_EXPORTER_OTLP_PROTOCOL', 'http/protobuf', [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable('OTEL_TRACES_EXPORTER', 'otlp', [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable('OTEL_METRICS_EXPORTER', 'none', [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable('OTEL_LOGS_EXPORTER', 'none', [System.EnvironmentVariableTarget]::User)
Configure the Multiplexer for OpenTelemetry and Dynatrace
Take the following steps to download and configure the Multiplexer for OpenTelemetry and Dynatrace:
- Download the DataDog .NET Multiplexer
- Move the .NET Multiplexer to filesystem of the Application to, for example, C:\multiplexer\DataDog.Trace.ClrProfiler.Native.dll
- In the same location, such as C:\multiplexer, create loader.conf with the details below
#Profiler
####### Replace C:\otel with the location where the OpenTelemetry ZIP was unzipped
PROFILER;{918728DD-259F-4A6A-AC2B-B85E1B658318};win-x64;C:\otel\win-x64\OpenTelemetry.AutoInstrumentation.Native.dll
#CUSTOM
####### Replace <version> with the actual installed version of Dynatrace
CUSTOM;{B7038F67-52FC-4DA2-AB02-969B3C1EDA03};win-x64;C:\Program Files\dynatrace\oneagent\agent\bin\<version>\windows-x86-64\oneagentdotnet.dll
- Create User Environment Variables for the User that runs the Application. Note that this can be done manually in the UI or via PowerShell. Both workflows are outlined below:
Setting User Environment Variables Manually in the UI
- On the machine where the Application runs, open the Windows Start Menu and search for, “environment variables”
- Select the search results to edit the environment variables
- On the System Properties dialog box, make sure the Advanced tab is selected
- Select the Environment Variables button at the bottom of this page
- In the Environment Variables dialog box, find the top section for User variables
- Click the New… button and create the following Variables and Values
Note that the Variable Names below are accurate but the Values are not. Use the values relevant to where the Multiplexer DLL and loader.conf were placed, such as C:\multiplexer
| COR_ENABLE_PROFILING | 1 |
| COR_PROFILER | {846F5F1C-F9AE-4B07-969E-05C26BC060D8} |
| COR_PROFILER_PATH_64 | C:\multiplexer\DataDog.Trace.ClrProfiler.Native.dll |
Dynatrace also has a System Hook that enforces their Agent. To stop this from running, we need to set the following additional variables:
| COMPlus_ReadyToRun | 0 |
| DT_AGENTACTIVE | true |
| DT_DISABLE_AGENT | true |
Setting User Environment Variables via PowerShell
On the machine where the Application runs, open PowerShell and run the following commands. Note the comments to modify the Values for some of the Keys
# The Key below has a Value that is environmentally-specific, C:\multiplexer
# Review and modify the Value as needed
[System.Environment]::SetEnvironmentVariable('COR_PROFILER_PATH_64', 'C:\multiplexer\DataDog.Trace.ClrProfiler.Native.dll', [System.EnvironmentVariableTarget]::User)
# The Keys below have Values that do not need to be modified
[System.Environment]::SetEnvironmentVariable('COR_ENABLE_PROFILING', '1', [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable('COR_PROFILER', '{846F5F1C-F9AE-4B07-969E-05C26BC060D8}', [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable('COMPlus_ReadyToRun', '0', [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable('DT_AGENTACTIVE', 'true', [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable('DT_DISABLE_AGENT', 'true', [System.EnvironmentVariableTarget]::User)
- Restart the Application
- Confirm that the .NET Application runs as expected
- Confirm that Dynatrace is profiling the .NET Application as expected
- Start Learning in the vFunction Server UI and confirm tracing information is captured as expected