Skip to main content

IBM BlueMix

Applying the agent

The following explains how to apply the WhaTap agent when deploying with IBM BlueMix.

IBM BlueMix provides the WebSphere Liberty environment with the container. Liberty is a lightweight environment different from WebSphere Application Server, and it is similar to how Spring Boot works.

Note

In the Platform as a Service (PaaS) environment, including the WhaTap agent settings, deployment is performed to the target application.

The following is an example of the configuration environment. These files are created in the local development environment when configuring the environment according to Guide.

whatap@vmwas01:/apps/bluemix/java-helloworld$ ls -alrt
Total 64
drwxrwxr-x 3 whatap whatap 4096 10/29 13:13 ..
-rw-rw-r-- 1 whatap whatap 1079 10/29 13:13 .classpath
-rw-rw-r-- 1 whatap whatap 1184 10/29 13:13 .project
-rw-rw-r-- 1 whatap whatap 39 10/29 13:13 .gitignore
-rw-rw-r-- 1 whatap whatap 151 10/29 13:13 CONTRIBUTING.md
drwxrwxr-x 2 whatap whatap 4096 10/29 13:13 .settings
-rw-rw-r-- 1 whatap whatap 2823 10/29 13:13 pom.xml
-rw-rw-r-- 1 whatap whatap 122 10/29 13:13 manifest.yml
-rw-rw-r-- 1 whatap whatap 3522 10/29 13:13 README.md
-rw-rw-r-- 1 whatap whatap 11323 10/29 13:13 LICENSE
drwxrwxr-x 3 whatap whatap 4096 10/29 13:13 src
drwxrwxr-x 2 whatap whatap 4096 10/29 13:13 target
drwxrwxr-x 8 whatap whatap 4096 10/29 13:13 .git
drwxrwxr-x 6 whatap whatap 4096 10/29 15:26 .
  1. In ${APP_HOME}, create the src/main/resources/whatap-agent/ directory and then copy jar files and conf files.

    $ mkdir -p src/main/resources/whatap-agent/
    $ cp /apps/whatap/whatap.agent.tracer-1.5.4.jar src/main/resources/whatap-agent/
    $ cp /apps/whatap/whatap.conf src/main/resources/whatap-agent/
  2. Add options in the ${APP_HOME}/manifest.yml file. Because it is a yml file, write it with according to spacing and indentation standards.

    ---
    applications:
    - name: sample-java-helloworld
    random-route: true
    memory: 256M
    path: target/JavaHelloWorldApp.war
    # Add from here.
    env:
    JAVA_OPTS: "-javaagent:/{APPLICATION_DIR}/WEB-INF/classes/whatap-agent/whatap.agent-X.Y.Z.jar -Dorg.osgi.framework.bootdelegation=whatap.* "
Note

In case of Java 17 or later, add the following options for reflection.


--add-opens=java.base/java.lang=ALL-UNNAMED

Note
  • The whatap.conf configuration is applied the same as in non-PaaS environments. Because it may be difficult to identify the agent name after application, apply the agent name that suits the situation.
  • For more information about the agent naming, see the following.

Viewing the heap histogram

WhaTap's Java Monitoring provides the function to view the status of heap occupancy objects in the JVM memory (sizes for each object in heap memory). In APP > Instance performance analysis, select the Heap histogram tab.

Java versions 6 to 8 support basic functions without the JVM options. However, for some Java versions, the JVM options must be applied as follows:

  • Java 9 to Java 15

    -Djdk.attach.allowAttachSelf=true
    example
    java -javaagent:{WHATAP_HOME}/whatap.agent-X.Y.Z.jar -Djdk.attach.allowAttachSelf=true -jar {application.jar}
  • Java 16 or later

    -Djdk.attach.allowAttachSelf=true
    --add-opens=jdk.attach/sun.tools.attach=ALL-UNNAMED
    example
    java -javaagent:{WHATAP_HOME}/whatap.agent-X.Y.Z.jar -Djdk.attach.allowAttachSelf=true --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=jdk.attach/sun.tools.attach=ALL-UNNAMED -jar {application.jar}
Note

It does not support Java 5 or earlier and IBM Java.

Starting the monitoring

Once the application server is restarted after configuring all settings, the agents start collecting data. See the following.