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:
- SSH or RDP to the VM running the Application where the vFunction Agent is installed
- 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
- Modify the agent.disable_jdbc settings:
### Before
agent:
disable_jdbc: false
### After
agent:
disable_jdbc: true
- 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"
- Restart the JVM
Driver Tracking
Take the following steps to switch the Database Tracking Mechanism:
- SSH or RDP to the VM running the Application where the vFunction Agent is installed
- 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
- 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
- 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"
- Restart the JVM
OpenTelemetry Tracking
Take the following steps to switch the Database Tracking Mechanism:
- SSH or RDP to the VM running the Application where the vFunction Agent is installed
- 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
- 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
- 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"
- 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
- Restart the JVM