All Products
Search
Document Center

Application Real-Time Monitoring Service:Install the ARMS agent for a Java application in Function Compute

Last Updated:Mar 11, 2026

When you run Java functions on Function Compute, you need visibility into application performance, distributed traces, and JVM health. Application Real-Time Monitoring Service (ARMS) integrates with Function Compute as an internal extension, giving you:

  • Instance-level observability

  • Distributed tracing

  • Java Virtual Machine (JVM) metrics

  • Code-level profiling

  • Application security insights

The following steps show how to add the ARMS agent to a custom runtime function.

Important

The ARMS agent consumes approximately 300 MB of memory at runtime. Make sure your function has at least 512 MB of memory allocated. The 10-second post-invocation freeze window required for data reporting is billed at the standard invocation rate. For details, see Function Compute billing.

Supported runtimes and requirements

RequirementDetails
RuntimeCustom runtime with Java 8, Java 11, or Java 17. The built-in Java 8 runtime is also supported.
JDK versionMust be supported by ARMS Application Monitoring. See Java components and frameworks supported by ARMS.
Heap memoryGreater than 256 MB
Function memoryAt least 512 MB (ARMS consumes ~300 MB)
RegionARMS and Function Compute must be in the same region. Cross-region monitoring is not supported.

To create a function with a custom runtime, see Create a function.

Step 1: Get a license key

Call the DescribeTraceLicenseKey API operation in OpenAPI Explorer to retrieve your ARMS license key. Save this key for use in Step 3.

Step 2: Add the ARMS agent layer

Function Compute provides official common layers that bundle the ARMS agent for each supported Java version.

Java versionCompatible runtimeCommon layer ARN
Java 8 / Java 11Custom runtimesacs:fc:{region}:official:layers/ArmsAgent273x/versions/2
Java 17Custom runtimesacs:fc:{region}:official:layers/ArmsAgent273x_JDK17/versions/1

Replace {region} with the region ID of your function, such as cn-hangzhou.

To add the layer in the Function Compute console:

  1. Log on to the Function Compute console. In the left-side navigation pane, click Functions.

  2. In the top navigation bar, select a region. On the Functions page, click the target function.

  3. On the function details page, click the Configurations tab.

  4. In the left-side navigation pane, click Layers, then click Modify.

  5. In the Layers panel, choose + Add Layer > Add Official Common Layer, and select the ARMS agent layer that matches your Java version.

Step 3: Configure environment variables

Set the following environment variables for your function:

VariableValueDescription
FC_EXTENSION_ARMStrueEnables the ARMS extension in Function Compute.
FC_EXTENSIONS_ARMS_LICENSE_KEYYour ARMS license keyAuthenticates the ARMS agent. Get this key from Step 1.
Important

Setting FC_EXTENSION_ARMS=true causes the function instance to freeze 10 seconds after each invocation completes. This gives the ARMS agent time to report collected data. Billing continues at the standard rate during this 10-second window. For details, see Function Compute billing.

To set these variables in the Function Compute console:

  1. On the function details page, click the Configurations tab.

  2. In the left-side navigation pane, click Environment Variables, then click Modify.

  3. Add FC_EXTENSION_ARMS=true and FC_EXTENSIONS_ARMS_LICENSE_KEY=<your-license-key>.

For more details, see Configure environment variables.

Step 4: Create a bootstrap script

The ARMS agent attaches to your Java process through JVM startup parameters. Create a bootstrap file to pass these parameters when the function starts.

The following table describes the required JVM parameters:

ParameterDescription
-javaagent:/opt/ArmsAgent/arms-bootstrap-1.7.0-SNAPSHOT.jarPath to the ARMS agent JAR provided by the common layer.
-Darms.licenseKey=${FC_EXTENSIONS_ARMS_LICENSE_KEY}ARMS license key, read from the environment variable set in Step 3.
-Darms.appName=${appName}Application name as it appears in the ARMS console. Defaults to FC:{FunctionName}.
-Dfc.instanceId=$HOSTNAME@`hostname -i`Unique identifier for the function instance.

Example bootstrap script:

#!/bin/bash
set -eo pipefail

# Set the ARMS application name.
# Defaults to FC:{FunctionName} if the FC_FUNCTION_NAME variable exists.
appName="FC:Custom_Java_Arms_Demo"
if [ -n "${FC_FUNCTION_NAME}" ]; then
    appName="FC:${FC_FUNCTION_NAME}"
fi

echo "appName: ${appName}"
params=" "

# Build the ARMS JVM parameters.
if [[ -n "${FC_EXTENSIONS_ARMS_LICENSE_KEY}" ]]; then
    echo "FC_EXTENSIONS_ARMS_LICENSE_KEY: ${FC_EXTENSIONS_ARMS_LICENSE_KEY}"
    params+="-Dfc.instanceId=$HOSTNAME@`hostname -i` "
    params+="-javaagent:/opt/ArmsAgent/arms-bootstrap-1.7.0-SNAPSHOT.jar "
    params+="-Darms.licenseKey=${FC_EXTENSIONS_ARMS_LICENSE_KEY} "
    params+="-Darms.appName=${appName} "
else
    echo "The environment FC_EXTENSIONS_ARMS_LICENSE_KEY does not exist, please set the FC_EXTENSIONS_ARMS_LICENSE_KEY environment!"
    exit 1
fi

# Launch the application. Replace the JAR path with your own.
echo "params: ${params}"
exec java $params \
    -Dserver.port=9000 \
    -jar /code/target/demo-0.0.1-SNAPSHOT.jar

Replace /code/target/demo-0.0.1-SNAPSHOT.jar with the path to your application JAR file.

Deploy the bootstrap file

  1. In the WebIDE on the function code page, create a file named bootstrap with the content above.

  2. Open the terminal in WebIDE and run chmod +x bootstrap to make the file executable.

  3. Click Deploy.

For more details, see Use a bootstrap script as startup commands.

Step 5: Verify the integration

After deployment, invoke the function at least once to trigger data collection, then confirm that ARMS is receiving data:

  1. Log on to the ARMS console.

  2. In the left-side navigation pane, choose Application Monitoring > Applications.

  3. Find the application whose name matches the appName value from your bootstrap script. The default is FC:{FunctionName}.

  4. Click the application name to view traces, JVM metrics, and other monitoring data.

For details on the monitoring dashboard, see Application overview.

Billing

ARMS integration with Function Compute incurs charges from two services:

ServiceChargeDetails
ARMSApplication monitoring feesARMS billing overview
Function Compute10-second post-invocation freeze window, billed at the standard invocation rateFunction Compute billing