Skip to main content

Elastic Beanstalk

Applying the agent

The following explains how to apply the WhaTap agent when deploying with Elastic Beanstalk.

Note

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

  1. To release the Spring Boot result as jar, the content of .ebextensions cannot be applied. Compress the following files and deploy the zip file.

    • .elasticbeanstalk/config.yml: Automatically created under the directory where the eb command is executed
    • .ebextensions/{config_name}.config: eb configuration file
    • Procfile: File to configure the JVM command line options
    • {application}.jar: applicaion.jar file to execute
  2. Compress the WhaTap agent file to be applied to the service and then upload it to S3 (or a public downloadable path).

    • paramkey.txt
    • whatap.agent-2.0_25.jar
    • whatap.conf
    # Compressing a directory
    zip -r whatap-agent.zip agent
  3. Enter the WhaTap agent path in the .ebextension/{config_name}.config file.

    When its zip file to download exists, execute the eb command to download the file and then unzip it.

    sources:
    target directory:
    S3 path
    Example
    sources:
    /home/webapp:
    http://s3.ap-northeast-2.amazonaws.com/{bucket-name}/whatap-agent.zip
  4. Enter the JVM command with the WhaTap agent option added to create a Procfile.

    Procfile
    web: java -javaagent:${WHATAP_JAR_FILE_PATH} -Dwhatap.name=${WHATAP_NAME} -Dwhatap.okind=${WHATAP_OKIND_NAME} -Dwhatap.server.home=${APPLICAION_PATH} -Dwhatap.conf.path=${WHATAP_HOME} -jar ${APPLICAIONT}.jar
    Example
    web: java -javaagent:/home/webapp/agent/whatap.agent-X.Y.Z.jar -Dwhatap.name=bootTest -Dwhatap.okind=test -Dwhatap.server.home=/var/app/current -Dwhatap.conf.path=/home/webapp/agent -jar whatap-boot-test.jar
  5. Compress the following files: Procfile, .ebextensions, and {application}.jar.

    zip -r {application}.zip Procfile .ebextensions/{application}.jar
  6. Add the zip file path to deploy in the .elasticbeanstalk/config.yml file.

    deploy:
    artifact: /path/to/{application}.zip
  7. Execure the eb deployment command.

    eb deploy
Note

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


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

Note

For more information, see AWS Guide.

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.