Install - vFunction Monolithic and OpenTelemetry Agents on Linux .NET Core Agent running on a Container



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 Wizard

To help with the installation process, vFunction offers an Installation Wizard. This Wizard provides additional information about the Prerequisites as well as steps for deploying the vFunction Agent to your environment.

Please contact support@vfunction.com or your vFunction Contact(s) for the password to start using this Wizard.


Installation

  1. Download the vFunction .NET Linux Agent, e.g. vfunction-controller-sudo-less-installation.v4.0.1585.tgz
  2. Download the Multiplexer Agent
  3. Create the Multiplexer’s Configuration file, named loader.conf
#Profiler
### Replace $USERNAME with the actual filesystem location, such as "vfunction"
PROFILER;{918728DD-259F-4A6A-AC2B-B85E1B658318};linux-x64;/home/$USERNAME/.otel-dotnet-auto/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so

#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
  1. Modify the Application’s Dockerfile to add workflows that install the Multiplexer, OpenTelemetry Agent and vFunction Agent
FROM almalinux:9

######### OTEL Workflow #########

ENV OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
### Set $VF_SERVER_ADDRESS as URL for vFunction Server Login, such as "http://10.0.0.1" or "https://vfunction.org.com"
ENV OTEL_EXPORTER_OTLP_ENDPOINT=$VF_SERVER_ADDRESS/api/unauth/otlp
ENV OTEL_TRACES_EXPORTER=otlp
ENV OTEL_METRICS_EXPORTER=none
ENV OTEL_LOGS_EXPORTER=none
### Set $VF_APP_ID taken from VF Server UI's "Installation Instructions" link in the Learning Tab, such as "47a10489-0000-0000-bc6e-579477ed6f40"
ENV OTEL_EXPORTER_OTLP_HEADERS=X-VF-APP=$VF_APP_ID
### Set $MY_SERVICE for this component of your Application, such as "Receipt Handler"
ENV OTEL_SERVICE_NAME=$MY_SERVICE

RUN curl -sSfL https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/latest/download/otel-dotnet-auto-install.sh -O && \
  sh ./otel-dotnet-auto-install.sh && \
  chmod +x $HOME/.otel-dotnet-auto/instrument.sh

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

### Set $ARTIFACT_REPOSITORY as the location where files will be stored for the Build process
### 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 #########

# 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"
### Set $REPLACE_BASE_DIR to where the various components will be installed, such as "/home/charlotteLee"
ENV VF_AGENT_CONF_LOCATION=$REPLACE_BASE_DIR/vfunction/etc/sysconfig/vfunction/agent/instances/default-dotnet/conf.json
ENV DOTNET_TailCallOpt=0

### Set $ARTIFACT_REPOSITORY as the location where files will be stored for the Build process
### Set $REPLACE_BASE_DIR to where the various components will be installed, such as "/home/charlotteLee"
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/

### Set $REPLACE_BASE_DIR to where the various components will be installed, such as "/home/charlotteLee"
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 -n && \
      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", ". $HOME/.otel-dotnet-auto/instrument.sh;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. Build the Dockerfile
  4. Run the Docker Container
  5. Start Learning in the VF Server UI for both the Monolithic and Distributed Applications
  6. Test the Application to confirm functionality and validate learning results