Install - vFunction Monolithic and AppDynamics Agents on Linux .NET Core Agent running on a Container using a Dockerfile



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:

  1. Download and install the two .NET Agents you want to run simultaneously
  2. Download the Datadog Multiplexer
  3. Configure the Datadog Multiplexer for the two .NET Agents you want to run simultaneously
  4. Add the vendor-specific environment variables for the two .NET Agents you want to run
  5. Add the generic .NET Agent environment variables to run the Datadog Multiplexer
  6. Restart the Application

.NET Core Compatibility

vFunction supports C# .NET Core version 3.x and .NET 6.x, 7.x and 8.x applications.


Installation

  1. Download the vFunction .NET Linux Agent
  2. Download the AppDynamics Agent Binaries ZIP
  3. Download the Multiplexer Agent
  4. Create the Multiplexer’s Configuration file, named loader.conf
#Profiler

#Tracer
### Replace $BASE_DIR with the actual filesystem location, such as "/tmp"
TRACER;{cd7d4b53-96c8-4552-9c11-6e41df8eab8a};linux-x64;$BASE_DIR/vfunction/opt/vfunction/agent/libvfagent.net.so

#Custom
CUSTOM;{57e1aa68-2229-41aa-9931-a6e93bbc64d8};linux-x64;/opt/appdynamics/dotnet/libappdprofiler.so
  1. Modify the Application’s existing Dockerfile to add the Multiplexer, AppDynamics and the vFunction Agent
FROM almalinux:9

######### AppDynamics Workflow #########

RUN mkdir -p /opt/appdynamics/dotnet
ADD $ARTIFACT_REPOSITORY/appdynamics/libappdprofiler.so /opt/appdynamics/dotnet/
ADD $ARTIFACT_REPOSITORY/appdynamics/libappdprofiler_glibc.so /opt/appdynamics/dotnet/
ADD $ARTIFACT_REPOSITORY/appdynamics/libappdprofiler_musl.so /opt/appdynamics/dotnet/
ADD $ARTIFACT_REPOSITORY/appdynamics/AppDynamics.Agent.netstandard.dll /opt/appdynamics/dotnet/

# It is possible to configure .NET agent using AppDynamicsConfig.json configuration file instead of environment variables
# ADD AppDynamicsConfig.json /opt/appdynamics/dotnet/

# Or, use Env Vars for configuration
# Configure connection to the controller
#ENV APPDYNAMICS_CONTROLLER_HOST_NAME=controller.saas.appdynamics.com
#ENV APPDYNAMICS_CONTROLLER_PORT=443
#ENV APPDYNAMICS_CONTROLLER_SSL_ENABLED=true
#ENV APPDYNAMICS_AGENT_ACCOUNT_NAME=account-name
#ENV APPDYNAMICS_AGENT_ACCOUNT_ACCESS_KEY=access-key

# Configure application identity in AppDynamics
#ENV APPDYNAMICS_AGENT_APPLICATION_NAME="My Application"
#ENV APPDYNAMICS_AGENT_TIER_NAME="Sample Tier"
#ENV APPDYNAMICS_AGENT_REUSE_NODE_NAME=true
#ENV APPDYNAMICS_AGENT_REUSE_NODE_NAME_PREFIX="Instance"

######### Multiplexer Workflow #########

### Set $REPLACE_BASE_DIR to where the various components will be installed, such as "/home/charlotteLee"

COPY $ARTIFACT_REPOSITORY/datadog/Datadog.Trace.ClrProfiler.Native.so $REPLACE_BASE_PATH/datadog/Datadog.Trace.ClrProfiler.Native.so
COPY $ARTIFACT_REPOSITORY/datadog/loader*.conf $REPLACE_BASE_PATH/datadog/loader.conf

######### vFunction Workflow #########

### Set $REPLACE_BASE_DIR to where the various components will be installed, such as "/home/charlotteLee"

# See descriptions in https://kb.vfunction.com/installations/configurable-settings/mono-dynamic-agent/dotnet/linux
ENV VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_NAME="CHANGE_ME"
ENV VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_HOST="CHANGE_ME"
ENV VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_ORG_ID="CHANGE_ME"
ENV VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_APP_ID="CHANGE_ME"
ENV VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_CLIENT_ID="CHANGE_ME"
ENV VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_CLIENT_SECRET="CHANGE_ME"
ENV VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_INSTANCE_ID="CHANGE_ME"

ENV VF_AGENT_CONF_LOCATION=$REPLACE_BASE_DIR/vfunction/etc/sysconfig/vfunction/agent/instances/default-dotnet/conf.json
ENV DOTNET_TailCallOpt=0

COPY $ARTIFACT_REPOSITORY/vfunction/vfunction-controller-sudo-less-installation*.tgz $REPLACE_BASE_PATH/vfunction-controller-sudo-less-installation.tgz
COPY $ARTIFACT_REPOSITORY/vfunction/installation.yaml $REPLACE_BASE_PATH/

RUN cd $REPLACE_BASE_PATH && tar -xvzf $REPLACE_BASE_PATH/vfunction-controller-sudo-less-installation.tgz && \
      rm -f $REPLACE_BASE_PATH/vfunction-controller-sudo-less-installation.tgz && \
      mv $REPLACE_BASE_PATH/installation.yaml $REPLACE_BASE_PATH/vfunction/etc/sysconfig/vfunction/installation/instances/default-dotnet/ && \
      bash $REPLACE_BASE_PATH/vfunction/opt/vfunction/controller-installation/install.sh -i default-dotnet && \
      chmod -R 777 $REPLACE_BASE_PATH/vfunction

######### Start the Container #########

### Set $REPLACE_BASE_DIR to where the various components will be installed, such as "/home/charlotteLee"
### Set RUN_APP as workflow to start the application, such as "dotnet run"

CMD ["/bin/bash", "-c", "export CORECLR_PROFILER_PATH=$REPLACE_BASE_PATH/datadog/Datadog.Trace.ClrProfiler.Native.so;export CORECLR_ENABLE_PROFILING=1;export CORECLR_PROFILER={846F5F1C-F9AE-4B07-969E-05C26BC060D8};$RUN_APP"]
  1. On the Docker Build Machine, create a directory for vFunction. Add the vfunction-controller-sudo-less-installation.tgz to this folder
  2. On the Docker Build Machine, create a directory for Datadog. Add the Datadog.Trace.ClrProfiler.Native.so and loader.conf to this folder
  3. On the Docker Build Machine, create a directory for AppDynamics. Add the AppDynamics.Agent.netstandard.dll, libappdprofiler.so, libappdprofiler_glibc.so and libappdprofiler_musl.so to this folder
  4. Build the Dockerfile
  5. Run the Docker Container
  6. Start Learning in the VF Server UI for both the Monolithic and Distributed Applications
  7. Test the Application to confirm functionality and validate learning results