WSO2 API Microgateway Startup Settings

You can instrument WSO2 API Microgateway by adding the Java Agent to JVM arguments in the executable file of the gateway. Perform the following steps based on your environment to attach the Java Agent.

Note: Java Agent supports only the HTTP1 protocol for entry and exit.

Add the Java Agent in Linux or macOS

  1. Open the executable file named "gateway" at <MGW_HOME>/bin in a text editor.
  2. In java_cmd_gateway () under $JAVA_OPTS, add :
    -javaagent:/path_to_appagent/javaagent.jar
  3. Save the executable and start the gateway.

Add the Java Agent in Docker

  1. Navigate to the docker container in which the microgateway is running using the following command:
    docker exec -it <container_id> /bin/bash
  2. Open the executable file named "gateway" at wso2/bin inside the docker container in a text editor.
  3. In java_cmd_gateway () under $JAVA_OPTS, add :
    -javaagent:/path_to_appagent/javaagent.jar
  4. Save the gateway file.
  5. Fetch the process id of Java process running inside the container using the following command:
    ps -eaf | grep java
  6. Kill the process <process_ID>:
    kill -9 <process_ID>
  7. Start the gateway again by running the jar:
    wso2/bin/gateway <executable_jar>

Add the Java Agent in Windows

  1. Open the executable file named "gateway" at <MGW_HOME>/bin in a text editor.
  2. In runTools under "SET JAVA_CMD", after "%JAVA_OPTS% ^" add the following:
    -javaagent:/path_to_appagent/javaagent.jar
  3. Save the executable and start the gateway.