See MongoDB Collections as Database Tables in the vFunction Server UI
Overview of the Issue
In vFunction Java Agent version 4.5 and later, vFunction introduced the ability to see MongoDB Collections as a Resource in the vFunction Server UI. The Collections are mapped to Database Tables and can be see in the Resources Report as well as in the per-Domain Resources.
Configuration Steps
Take the following steps to configure vFunction for MongoDB Collections used by Java Applications. Note that the instructions below are written for a Linux-based Sudoless vFunction installation. Please consult the vFunction Customer Success Team for Windows-specific or Linux Sudo-specific instructions:
- SSH to the Application Server running the vFunction Agent
- Edit the $VFUN_BASE_DIR/vfunction/etc/sysconfig/vfunction/installation/instances/default-java/installation.yaml
### BEFORE
agent:
override_properties:
# - key=value
### AFTER
agent:
override_properties:
- com.vfunction.runtime.config.aop.xml.db.tracking.jdbcdriver.enabled=false
- com.vfunction.runtime.config.aop.xml.db.tracking.enabled=false
- com.vfunction.runtime.config.aop.xml.otel.jdbc.enabled=true
- com.vfunction.runtime.config.aop.xml.otel.mongodb.enabled=true
- Run the vFunction Agent Installation or Upgrade Script
### REPLACE $VFUN_BASE_DIR with the location where the vFunction Installation TGZ was unpacked
### INSTALLATION
bash $VFUN_BASE_DIR/vfunction/opt/vfunction/controller-installation/install.sh -i default-java
### UPGRADE
bash $VFUN_BASE_DIR/vfunction/opt/vfunction/controller-installation/upgrade.sh -i default-java
- Modify the JVM Startup Parameters to refer to the Opentelemetry Java Agent in addition to the existing vFunction Startup Parameters that were previously added. See the example below from a Spring Boot Application:
### REPLACE $VFUN_BASE_DIR with the location where the vFunction Installation TGZ was unpacked
### BEFORE
-agentpath:$VFUN_BASE_DIR/vfunction/opt/vfunction/agent/libJVMTIAgent.so=conf=$VFUN_BASE_DIR/vfunction/etc/sysconfig/vfunction/agent/instances/default-java/native-conf.json -javaagent:$VFUN_BASE_DIR/vfunction/opt/vfunction/agent/runtime-agent.jar=ConfigLocation=$VFUN_BASE_DIR/vfunction/etc/sysconfig/vfunction/agent/instances/default-java/vfunction-runtime-override.properties -Dcom.vfunction.logging.logFile=$VFUN_BASE_DIR/vfunction/var/log/vfunction/instances/default-java/vfagent.log
### AFTER
-agentpath:$VFUN_BASE_DIR/vfunction/opt/vfunction/agent/libJVMTIAgent.so=conf=$VFUN_BASE_DIR/vfunction/etc/sysconfig/vfunction/agent/instances/default-java/native-conf.json -javaagent:$VFUN_BASE_DIR/vfunction/opt/vfunction/agent/runtime-agent.jar=ConfigLocation=$VFUN_BASE_DIR/vfunction/etc/sysconfig/vfunction/agent/instances/default-java/vfunction-runtime-override.properties -Dcom.vfunction.logging.logFile=$VFUN_BASE_DIR/vfunction/var/log/vfunction/instances/default-java/vfagent.log -javaagent:$VFUN_BASE_DIR/vfunction/opt/vfunction/controller-installation/stuff/agent/opentelemetry/opentelemetry-javaagent.jar
- Restart the Application
- Start Learning in the vFunction Server UI
- In the Monolithic Application, test Endpoints that interact with MongoDB Collections
- Stop Learning
- Confirm that the MongoDB Collections are displayed in the vFunction Server UI’s Analysis > Show Resources Report as Table-RO and / or Table-RW entries