Extract business parameters for your Java application
Cloud Monitor 2.0 extracts specific attributes from traces non-intrusively, capturing parameters from requests and responses to help pinpoint root causes and track request details. You can configure extraction rules and define custom errors based on the extracted parameters.
The business parameter extraction rules involve reflection and serialization/deserialization processes, which may introduce overhead to your application. For more information about the overhead, see Overhead.
Prerequisites
Agent version 4.1.0 or later is installed for your application. For more information, see Server-side applications. If the agent version is earlier than 4.1.0, this feature does not work even if configured.
Agent versions 4.2.0 and later support multiple API match rules and parameter extraction rules in a single business parameter extraction rule. For agent versions between 4.1.0 and 4.2.0, only the first match rule takes effect.
On the parameter rule configuration page, click Add Rule to create a rule. For example, you can configure two rules. For the first rule, set Applicable interfaces to Starts with /api/book, set Text encoding type to UTF-8, select body as the parameter source, and enter #this.data.code in the Ognl expression field. For the second rule, set Applicable interfaces to Starts with /api/stationery, set Text encoding type to UTF-8, select body as the parameter source, and enter #this.responseCode in the Ognl expression field. Below each rule, you can click + Add Parameter to add more extraction rules.
Procedure
Log on to the Cloud Monitor 2.0 console, and select a workspace. In the left navigation pane, choose .
On the Applications page, click the target application. Then, in the top navigation bar, choose .
Enable the Extract Business Parameters switch, set the Maximum Characters for Extraction, and then click Save.
In the Business Parameter Extraction Rules section, create, view, and modify rules for the current application.
The Cloud Monitor 2.0 Application Monitoring agent dynamically detects rule changes and extracts business parameters based on all enabled rules.
The rules list displays the following columns: Attribute name, Parameter extraction type, Matching rule, Extracted parameter, Enabled, and Actions (Edit, Delete). Click Add Rule at the top to create rules, or search for rules by name or parameter extraction type. At the bottom, you can perform batch operations such as Batch Delete and Batch copy to other applications.
Attribute name: The name of the span attribute for the value extracted by this rule. By default, the name starts with biz. followed by multiple words. Each word can contain only uppercase and lowercase letters, digits, hyphens (-), and underscores (_). Adjacent words must be separated by a period (.). A maximum of 10 words is allowed.
In the Custom Error Settings section, configure custom error rules to define errors based on extracted business parameter values.
Enable the Custom Error Code switch, and click + Add Matching Rule to add a rule. For example, you can set Attribute to
biz.resp.body, the condition to Greater than, and the value to200. Alternatively, you can set Attribute tobiz.exception, the condition to Greater than, and the value to0. After you complete the configuration, click Save.
Supported parameter types and sources
The ARMS agent dynamically detects rule changes and extracts parameters based on all enabled rules. The following table lists the supported parameter types, sources, and framework requirements.
Parameter type | Parameter source | Supported framework | Remarks |
HTTP server request | Header, Cookie, Parameter | Tomcat 7.0.4+, Jetty 8.0.0+, Undertow 1.4.0.Final+ | The ARMS agent calls the |
HTTP server request | Body | Spring MVC 4.2.0+ | The class must be annotated with @Controller and the method must be annotated with @RequestBody. |
HTTP server response | Header, Cookie | Tomcat 7.0.4+, Jetty 8.0.0+, Undertow 1.4.0.Final+ | - |
HTTP server response | Body | Spring MVC 4.2.0+ | The class must be annotated with @Controller and the method must be annotated with @ResponseBody. |
HTTP client request | Header, Parameter | Apache HttpClient 2.0+, OkHTTP 2.2+ | - |
HTTP client response | Header | Apache HttpClient 2.0+, OkHTTP 2.2+ | - |
Exception information | Message | - | The class must inherit java.lang.Exception. |
Configure custom error code matching
If an extracted parameter value matches a custom error code rule, the span is marked as failed. Failed spans increment the arms_$callType_requests_error_count metric, which you can use for alerting.
The sampling policy does not affect data collection for custom error codes. Failed spans that are not sampled are still counted.
For service access types and available dimensions, see Application monitoring metrics.
Create a custom error code rule
In the Customizing Error Settings section, turn on the Custom error code switch.
Click Add matching rules.
Select an extraction rule and configure the filter condition.
After you turn on the Custom error code switch, add matching rules: a span is marked as an error when the value of the
biz.resp.bodyattribute is greater than 200, and when the value of thebiz.exceptionattribute is greater than 0.Click Save. The rule takes effect within 1 to 2 minutes without an application restart.
Verify a custom error code rule
After you configure a rule, check the Trace Explorer page for failed spans that match the rule conditions.
Confirm the attribute name and condition used by the rule.
On the Trace Explorer page, filter for failed spans.
On the Trace Explorer page, use the quick filter area on the left to filter for spans whose status is error. The resulting query condition is
serviceName="arms-custom-extraction-demoextracted" AND statusCode IN (2, 3) AND spanName="/api/v1/http_server/body". In this example, the query returns 3,642 error calls, each with a duration of 0 ms and an error status.Click a trace and check whether the attribute value matches the rule condition. In the following example, the
biz.resp.bodyattribute value is 670, which is greater than 499 (the threshold specified by the error matching rule).On the Overview page, verify that the error count is correctly reflected in the error dashboard.

Performance overhead
Business parameter extraction adds CPU and memory overhead due to serialization/deserialization and Java reflection. The following benchmark quantifies the impact.
Test environment:
Pod specifications: 1 core, 2 GB memory
5 HTTP interfaces at 2,000 QPS each
240 custom parameters extracted per 100 calls: 20 regex, 40 JsonPath, and 40 OGNL expressions
Item | Feature disabled (baseline) | Feature enabled | Increase |
CPU | 0.230 c | 0.257 c | +0.027 c |
Memory (20 minutes after startup) | 575 MB | 693 MB | +118 MB |
Response time | 101 ms | 101 ms | +0 ms |
Extraction involves Java reflection and serialization/deserialization, which increase CPU and memory usage. For interfaces with strict latency requirements, write parameters to headers or use the OpenTelemetry SDK instead.