Built-in Java runtimes support the ARMS application monitoring extension
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. |
|
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 |
|
|
java11 |
|
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_KEYto 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.
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
-
Log on to the Function Compute console. In the left-side navigation pane, click Functions.
-
In the top navigation bar, select a region. On the Functions page, click the function that you want to manage.
-
On the function details page, click the Configurations tab.
-
Find Advanced Settings and click Modify on the right. In the Advanced Settings panel, find the Layer section and edit it. Choose , 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. -
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.jarandFC_EXTENSIONS_ARMS_LICENSE_KEY=yourLicensekey. For more information, see Step 2: Set environment variables. -
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.
-
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 , and then click the name of the target application to view detailed monitoring information. For more information, see Application Overview.