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.


Swith the Database Tracking Mechanism

Take the following steps to switch the Database Tracking Mechanism:

  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 sample location: /etc/sysconfig/vfunction/installation/instances/default-java/installation.yaml
  • Linux Sudoless sample location: /tmp/vfunction/etc/sysconfig/vfunction/installation/instances/default-java/installation.yaml
  • Windows sample location: C:\vfunction\config\installation\instances\default-java\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 sample upgrade flow: sudo bash /opt/vfunction/controller-installation/upgrade.sh -i default-java
  • Linux Sudoless sample upgrade flow: bash /tmp/vfunction/opt/vfunction/controller-installation/upgrade.sh -i default-java
  • Windows sample upgrade flow: powershell -NoProfile -ExecutionPolicy unrestricted -Command “C:\vfunction\controller-installation\upgrade.ps1 -instance default-java”
  1. Restart the JVM
  2. If an issue occurs with the alternative vFunction DB Tracking mechanism in place, use the OpenTelemetry Java Agent to gather DB Tracking details by opening the installation.yaml associated with the instance. NOTE: If an OpenTelemetry Agent already exists in the environment and is used to profile the Java Application, follow these steps to modify the existing configuration
  3. Modify the agent.override_properties setting:
### Before
agent:
  override_properties:
#    -key=value


### After
agent:
  override_properties:
    - 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=true
  1. Run the upgrade.sh script
  • Linux Sudo sample upgrade flow: sudo bash /opt/vfunction/controller-installation/upgrade.sh -i default-java
  • Linux Sudoless sample upgrade flow: bash /tmp/vfunction/opt/vfunction/controller-installation/upgrade.sh -i default-java
  • Windows sample upgrade flow: powershell -NoProfile -ExecutionPolicy unrestricted -Command “C:\vfunction\controller-installation\upgrade.ps1 -instance default-java”
  1. Add the following JVM arguments in addition to what previously existed:
### Replace $PATH_TO with the actual location of the file

-javaagent:$PATH_TO/opt/vfunction/controller-installation/stuff/agent/opentelemetry/opentelemetry-javaagent.jar
  1. Restart the JVM
  2. If an issue occurs with the both the alternative vFunction DB Tracking mechanism and the OpenTelemetry Java Agent for gathering DB Tracking details, disable DB Tracking in the installation.yaml:
### Before
agent:
  override_properties:
#    - key=value


### After
agent:
  override_properties:
    - com.vfunction.runtime.config.aop.xml.db.tracking.enabled=false
    - com.vfunction.runtime.config.aop.xml.db.tracking.jdbcdriver.enabled=false
  1. Run the vFunction upgrade script
  • Linux Sudo sample upgrade flow: sudo bash /opt/vfunction/controller-installation/upgrade.sh -i default-java
  • Linux Sudoless sample upgrade flow: bash /tmp/vfunction/opt/vfunction/controller-installation/upgrade.sh -i default-java
  • Windows sample upgrade flow: powershell -NoProfile -ExecutionPolicy unrestricted -Command “C:\vfunction\controller-installation\upgrade.ps1 -instance default-java”
  1. Restart the JVM