Built-in Java runtimes support the ARMS application monitoring extension

Updated at:

Connect a function that uses a built-in Java runtime to Application Real-Time Monitoring Service (ARMS) application monitoring, so that you can monitor and trace the function.

The Java runtime supports two versions: Java 8 and Java 11. If you use a custom runtime, see Custom runtimes support the ARMS Application Monitoring extension.

Background information

After Function Compute integrates with the ARMS application monitoring platform, you can use the platform to monitor and trace target functions. Obtain related information, such as instance-level observability, distributed tracing information, Java virtual machine metrics, code-level profiling information, and application security information. For more information, see What is ARMS?.

Feature

Description

Instance-level observability

Aggregates a wide range of host monitoring metrics by function instance, such as CPU, memory, and requests.

Distributed tracing

The ARMS agent automatically discovers the topology between functions and their upstream and downstream components, as well as the related metrics. View related information, such as databases, Redis, and MQ, in the ARMS monitoring platform.

Java virtual machine metrics

The ARMS agent automatically collects monitoring data from Java virtual machine applications. View the number of garbage collection (GC) events, heap information, and thread stack information in the ARMS monitoring platform.

Code-level profiling

View code-level profiling information generated during function execution, such as the time consumed by each method and exceptions.

Application Security

Based on Runtime Application Self-Protection (RASP) technology, Application Security can provide applications with security protection at runtime and defend against most attack techniques exploited by unknown vulnerabilities.

Connect a built-in Java runtime to ARMS

ARMS application monitoring is an internal extension. Connecting a built-in Java runtime to ARMS application monitoring mainly involves the following two parts:

Use a public layer to obtain the ARMS agent

The Function Compute platform provides an ARMS agent that supports two Java versions: Java 8 and Java 11.

Runtime

Public layer ARN

java8

acs:fc:{region}:official:layers/ArmsAgent4x/versions/1

java11

acs:fc:{region}:official:layers/ArmsAgent4x/versions/1

Configure environment variables

{
  "FC_EXTENSIONS_ARMS_LICENSE_KEY": "xxx",
  "JAVA_TOOL_OPTIONS": "-javaagent:/opt/ArmsAgent/arms-bootstrap-1.7.0-SNAPSHOT.jar"
}
  • Set the environment variable FC_EXTENSIONS_ARMS_LICENSE_KEY to the License Key information. For more information, see Obtain License Key information.

  • Set the environment variable JAVA_TOOL_OPTIONS. The ARMS agent JAR in the official public layer is located at /opt/ArmsAgent/arms-bootstrap-1.7.0-SNAPSHOT.jar.

Important

Function Compute charges fees for the waiting period from the end of an invocation to the freeze. The billing policy is the same as the billing logic of the instance invocation phase. For more information, see Billing overview.

Prerequisites

  • An event function that uses a built-in runtime is created, and the runtime environment is Java 8 or Java 11. For more information, see Create an event-triggered function.

  • The ARMS service is activated. For more information, see Activate ARMS.

Procedure

  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 function that you want to manage.

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

  4. Find Advanced Settings and click Modify on the right. In the Advanced Settings panel, find the Layer section and edit it. Choose + Add Layer > Add Layer by ARN, and add an ArmsAgent layer that is compatible with the selected Java language. Modify the value of {region} in the ARN, and then click Deploy.

  5. In the Advanced Settings panel, find the Environment Variables section and edit it, and add the environment variables JAVA_TOOL_OPTIONS=-javaagent:/opt/ArmsAgent/arms-bootstrap-1.7.0-SNAPSHOT.jar and FC_EXTENSIONS_ARMS_LICENSE_KEY=yourLicensekey. For more information, see Step 2: Set environment variables.

  6. After you update the configuration and deploy the code, your function is added to ARMS application monitoring. ARMS monitoring also charges fees for your service. For more information, see Billing overview.

Important
  • After your function is connected to the ARMS monitoring platform, make sure that the platform and the function are in the same region before you view the monitoring information.

  • To ensure that the function runs as expected, make sure that the memory size in your function configuration is greater than 512 MB (ARMS occupies approximately 300 MB of memory).

Result verification

After you connect your function to the ARMS application monitoring platform, you can view the connected function in the ARMS console.

You can also log on to the ARMS console , and in the left-side navigation pane, choose Application Monitoring > Application List, and then click the name of the target application to view detailed monitoring information. For more information, see Application Overview.