How to switch Database Tracking Mechanisms in a Java Application



Overview of the Issue

The vFunction Java Agent offers multiple workflows to track the connections to database tables. This article walks through the workflows to switch the Database Tracking mechanism if Database Tables do not appear in the Resources Report after installing the vFunction Agent and restarting the JVM.

The options below are ordered in most- to least-preferable options:


Direct Tracking

Take the following steps to switch the Database Tracking Mechanism to Direct Tracking:

  1. SSH or RDP to the VM running the Application where the vFunction Agent is installed
  2. Open the installation.yaml associated with the instance:
### Linux Sudo - Replace INSTANCE_NAME
/etc/sysconfig/vfunction/installation/instances/INSTANCE_NAME/installation.yaml

### Linux Sudoless - Replace BASE_DIR and INSTANCE_NAME
/BASE_DIR/vfunction/etc/sysconfig/vfunction/installation/instances/INSTANCE_NAME/installation.yaml

### Windows - Replace BASE_DIR and INSTANCE_NAME
BASE_DIR\vfunction\config\installation\instances\INSTANCE_NAME\installation.yaml
  1. Modify the agent.override_properties setting:
### Before
agent:
  override_properties:
#    -key=value


### After
agent:
  override_properties:
    - com.vfunction.runtime.config.aop.xml.db.tracking.direct.enabled=true
    - com.vfunction.runtime.config.aop.xml.db.tracking.enabled=false
    - com.vfunction.runtime.config.aop.xml.db.tracking.jdbcdriver.enabled=false
    - com.vfunction.runtime.config.aop.xml.otel.jdbc.enabled=false
  1. Run the upgrade.sh script
### Linux Sudo - Replace INSTANCE_NAME
sudo bash /opt/vfunction/controller-installation/upgrade.sh -i INSTANCE_NAME

### Linux Sudoless - Replace BASE_DIR and INSTANCE_NAME
bash /BASE_DIR/vfunction/opt/vfunction/controller-installation/upgrade.sh -i INSTANCE_NAME

### Windows - Replace BASE_DIR and INSTANCE_NAME
powershell -NoProfile -ExecutionPolicy unrestricted -Command "BASE_DIR\vfunction\controller-installation\upgrade.ps1 -instance INSTANCE_NAME"
  1. Restart the JVM

Driver Tracking

Take the following steps to switch the Database Tracking Mechanism to Driver Tracking (the default):

  1. SSH or RDP to the VM running the Application where the vFunction Agent is installed
  2. Open the installation.yaml associated with the instance:
### Linux Sudo - Replace INSTANCE_NAME
/etc/sysconfig/vfunction/installation/instances/INSTANCE_NAME/installation.yaml

### Linux Sudoless - Replace BASE_DIR and INSTANCE_NAME
/BASE_DIR/vfunction/etc/sysconfig/vfunction/installation/instances/INSTANCE_NAME/installation.yaml

### Windows - Replace BASE_DIR and INSTANCE_NAME
BASE_DIR\vfunction\config\installation\instances\INSTANCE_NAME\installation.yaml
  1. Confirm the agent.override_properties settings have no DB Tracking related entries:
agent:
  override_properties:
#    -key=value
  1. Confirm the agent.disable_jdbc settings is set to false:
agent:
  disable_jdbc: false
  1. Run the upgrade.sh script
### Linux Sudo - Replace INSTANCE_NAME
sudo bash /opt/vfunction/controller-installation/upgrade.sh -i INSTANCE_NAME

### Linux Sudoless - Replace BASE_DIR and INSTANCE_NAME
bash /BASE_DIR/vfunction/opt/vfunction/controller-installation/upgrade.sh -i INSTANCE_NAME

### Windows - Replace BASE_DIR and INSTANCE_NAME
powershell -NoProfile -ExecutionPolicy unrestricted -Command "BASE_DIR\vfunction\controller-installation\upgrade.ps1 -instance INSTANCE_NAME"
  1. Restart the JVM

Datasource Tracking

Take the following steps to switch the Database Tracking Mechanism to Datasource Tracking:

  1. SSH or RDP to the VM running the Application where the vFunction Agent is installed
  2. Open the installation.yaml associated with the instance:
### Linux Sudo - Replace INSTANCE_NAME
/etc/sysconfig/vfunction/installation/instances/INSTANCE_NAME/installation.yaml

### Linux Sudoless - Replace BASE_DIR and INSTANCE_NAME
/BASE_DIR/vfunction/etc/sysconfig/vfunction/installation/instances/INSTANCE_NAME/installation.yaml

### Windows - Replace BASE_DIR and INSTANCE_NAME
BASE_DIR\vfunction\config\installation\instances\INSTANCE_NAME\installation.yaml
  1. Modify the agent.disable_jdbc settings:
### Before
agent:
  disable_jdbc: false


### After
agent:
  disable_jdbc: true
  1. Run the upgrade.sh script
### Linux Sudo - Replace INSTANCE_NAME
sudo bash /opt/vfunction/controller-installation/upgrade.sh -i INSTANCE_NAME

### Linux Sudoless - Replace BASE_DIR and INSTANCE_NAME
bash /BASE_DIR/vfunction/opt/vfunction/controller-installation/upgrade.sh -i INSTANCE_NAME

### Windows - Replace BASE_DIR and INSTANCE_NAME
powershell -NoProfile -ExecutionPolicy unrestricted -Command "BASE_DIR\vfunction\controller-installation\upgrade.ps1 -instance INSTANCE_NAME"
  1. Restart the JVM

OpenTelemetry Tracking

Take the following steps to switch the Database Tracking Mechanism to OpenTelemetry Tracking:

  1. SSH or RDP to the VM running the Application where the vFunction Agent is installed
  2. Open the installation.yaml associated with the instance:
### Linux Sudo - Replace INSTANCE_NAME
/etc/sysconfig/vfunction/installation/instances/INSTANCE_NAME/installation.yaml

### Linux Sudoless - Replace BASE_DIR and INSTANCE_NAME
/BASE_DIR/vfunction/etc/sysconfig/vfunction/installation/instances/INSTANCE_NAME/installation.yaml

### Windows - Replace BASE_DIR and INSTANCE_NAME
BASE_DIR\vfunction\config\installation\instances\INSTANCE_NAME\installation.yaml
  1. Modify the agent.override_properties setting:
### Before
agent:
  override_properties:
#    -key=value


### After
agent:
  override_properties:
    - com.vfunction.runtime.config.aop.xml.otel.jdbc.enabled=true
    - com.vfunction.runtime.config.aop.xml.db.tracking.enabled=false
    - com.vfunction.runtime.config.aop.xml.db.tracking.jdbcdriver.enabled=false
  1. Run the upgrade.sh script
### Linux Sudo - Replace INSTANCE_NAME
sudo bash /opt/vfunction/controller-installation/upgrade.sh -i INSTANCE_NAME

### Linux Sudoless - Replace BASE_DIR and INSTANCE_NAME
bash /BASE_DIR/vfunction/opt/vfunction/controller-installation/upgrade.sh -i INSTANCE_NAME

### Windows - Replace BASE_DIR and INSTANCE_NAME
powershell -NoProfile -ExecutionPolicy unrestricted -Command "BASE_DIR\vfunction\controller-installation\upgrade.ps1 -instance INSTANCE_NAME"
  1. Add the following flags to the JVM Parameters of the Application
-Dotel.exporter.otlp.protocol=http/protobuf
-Dotel.instrumentation.common.default-enabled=false
-Dotel.instrumentation.jdbc.enabled=true
-Dotel.instrumentation.mongo.enabled=true

### Linux Sudo
-javaagent:opt/vfunction/controller-installation/stuff/agent/opentelemetry/opentelemetry-javaagent.jar

### Linux Sudoless - Replace BASE_DIR with the actual path where the TGZ was extracted
-javaagent:BASE_DIR/vfunction/opt/vfunction/controller-installation/stuff/agent/opentelemetry/opentelemetry-javaagent.jar

### Windows - Replace BASE_DIR with the actual path where the ZIP was extracted
-javaagent:BASE_DIR\vfunction\controller-installation\stuff\agent\opentelemetry\opentelemetry-javaagent.jar
  1. Restart the JVM