Java custom settings

Updated at:

Use the Custom Settings tab to configure agent feature switches, sampling policies, and other common settings.

Prerequisites

The application must be connected to Cloud Monitor 2.0.

Procedure

  1. Log on to the Cloud Monitor 2.0 console, and select a workspace. In the left navigation pane, choose All Features > Application Observability > Application Monitoring.

  2. On the Applications page, click the name of your target application. In the top navigation bar, choose Application Settings > Custom Settings.

  3. Configure the custom parameters and click Save.

Sampling settings

In the Sampling settings section, configure sampling policies and interface names for traces. For more information, see Select a trace sampling mode (for agent versions 3.2.8 and later).

Agent switch settings

In the Agent Switch Settings section, you can enable or disable application monitoring and toggle individual agent switches.

Important

Changes to enable or disable application monitoring take effect immediately without restarting the application. If you pause application monitoring, the system can no longer monitor your application. Proceed with caution. Changes to agent switches require an application restart.

This section lists all available agent switches in a grid. You can enable or disable monitoring for specific frameworks and features as needed.

Log association settings

In the Application log association settings section, configure the log source associated with your application to automatically inject TraceId and SpanId.

  • How automatic TraceId and SpanId injection works: When enabled, the agent automatically injects TraceId and SpanId into your logs without modifying the log configuration file.

    Effect:

    As shown in the following examples, TraceId and SpanId are automatically printed in logs for log4j, log4j2, and logback without any changes to the log configuration files.

    # log4j
    2024-01-12 17:13:41 INFO  [TraceId:B3f21xxx SpanId:xxx] This is a simple trace log
    2024-01-12 17:13:41 INFO  [TraceId:B3f21xxx SpanId:xxx] This is a log with exception
    
    # log4j2
    2024-01-12 17:14:06 INFO  [TraceId:B3f21xxx SpanId:xxx] This is a log4j2 annotation
    2024-01-12 17:14:06 INFO  [TraceId:B3f21xxx SpanId:xxx] This is a log4j2 exception
    
    # logback
    2024-01-12 17:14:45 INFO  [TraceId:B3f21xxx SpanId:xxx] This is a simple trace log
    2024-01-12 17:14:45 INFO  [TraceId:B3f21xxx SpanId:xxx] This is a log with exception
  • Add TraceId to Log MDC: By default, agent versions 4.x and later do not support obtaining the TraceId by using org.slf4j.MDC.get(“EagleEye-TraceID”). If you still need to use this method, you can enable this switch.

Arthas monitoring

In the Arthas Monitoring section, you can enable or disable the Arthas diagnostics feature and specify the IP addresses where it should be active. For more information, see Arthas diagnostics.

Continuous profiling settings

In the Continuous profiling settings section, enable or disable the main switch, as well as the CPU Hotspot, Memory Hotspot, and Code Hotspot features. You can also specify the IP addresses or CIDR blocks where these settings apply. For more information, see continuous profiling.

Data desensitization settings

In the Data Masking Settings section, you can configure desensitization rules. The agent then desensitizes data such as JVM system parameters, Kubernetes YAML files, method input parameters, and Arthas environment and system variables during collection. In the desensitization rules, elements are separated by commas. Each element represents a case-insensitive regular expression. For example, password is equivalent to the regular expression .*password.*.

When the agent collects data, it filters data keys against these expressions. If a key matches a rule, the agent treats it as sensitive and masks its value. For example, if you set the rule to licenseKey, information with the key -Darms.licenseKey is desensitized.

After you enable IP desensitization, the agent automatically desensitizes information involving IP addresses, such as endpoint addresses on various pages in the application monitoring console. This process does not affect how monitoring data is displayed.

API call settings

In the Interface call settings section, configure the slow call threshold, exception whitelist, HTTP status code whitelist, and invalid interface call filtering.

  • Slow call threshold: Defaults to 500 ms. An interface call is marked as slow if its response time exceeds this threshold.

  • HTTP Status Code Whitelist:

    By default, HTTP status codes of 400 or greater are considered errors. To exclude specific status codes from being classified as errors, add them to this whitelist.

    This setting affects only the HTTP frameworks currently supported by Application Monitoring.

    Affected data: HTTP server/client error count metrics (arms_http_requests_error_count, arms_http_client_requests_error_count, and arms_app_requests_error_count), and Span status.

    Affected features: The error counts on the Entity Details, Provided Services, and Dependencies tabs, as well as span statuses and error alerts on the Trace Explorer page.

    Format: Enter individual status codes. Separate multiple codes with a comma (,). Wildcard matching is not supported.

    Example: 403,502

    Default: None

  • Invalid Interface Call Filtering:

    To hide certain calls from the Provided Services tab, enter the interface names to filter. The agent stops reporting observability data for these interfaces.

    Note
    • For Java agent versions earlier than 4.2.0, this feature applies only to interfaces that appear in Provided Services.

    • For Java agent versions 4.2.0 and later, this feature applies to any LocalRootSpan.

    Affected data: All metrics and spans for the specified interfaces are ignored.

    Affected features: All metrics for the corresponding interfaces on the Entity Details, Provided Services, and Dependencies tabs; the number of spans; and the call volume, error count, and slow call alerts for these interfaces on the Trace Explorer page.

    Format: Use strings or AntPath expressions to match the full names of invalid interfaces. Separate multiple rules with a comma (,). The default AntPath expressions are provided for backward compatibility and should not be deleted. Append new rules after the existing ones.

    Example: /api/test/*,/api/playground/create

    Default: /**/*.jpg,/**/*.png,/**/*.js,/**/*.jpeg,/**/*.pdf,/**/*.xlsx,/**/*.txt,/**/*.docs,/**/*.gif,/**/*.csv

  • Record Upstream Interface Name in Interface Call Metrics and Record Upstream Application Name in Interface Call Metrics:

    Purpose: Controls whether interface metrics include the upstream application and interface that initiated the call. This primarily affects upstream and downstream link data on the Provided Services tab. If an application has many upstream callers, recording this information significantly increases metric volume and can lead to higher costs.

    Effect: After you disable these options, the upstream data drops to zero.

  • Record Original Status Code in Interface Call Metrics:

    Purpose: Records the original response code in HTTP interface metrics.

    Effect:

    When enabled, the original HTTP response codes (such as 200, 301, 404, or 500) are displayed in HTTP interface metrics, allowing for more precise analysis of interface calls.

Database call settings

In the Database call settings section, configure the slow SQL query threshold and maximum length of collected SQL statements. You can also specify whether to display variable binding values and constant values in SQL, and whether to record the size of MySQL query return values.

  • Display Variable Binding Values in SQL: Captures variable values bound to PreparedStatement parameters. This setting takes effect immediately without an application restart.

    The agent records variable values bound to PreparedStatement parameters and stores them in the attributes of the database access span. The key is db.bindvalue, and the value is a comma-separated list of the variable values.

    • This setting is supported by all JDBC-based frameworks supported by Cloud Monitor 2.0.

    • Supported database variable types: Boolean, Byte, Short, Int, Long, Float, Double, BigDecimal, and Date.

    • Enabling this switch incurs additional overhead proportional to the number of variables in the SQL statement. In official stress test scenarios with one variable, this switch adds less than 0.5% CPU overhead and negligible memory overhead.

    The following shows the effect of enabling this switch:

    A new db.bindvalue entry is added to the Attributes list on the span details page. Its value contains the parameter values bound during SQL execution.

  • Display constant values in SQL: This option only truncates SQL statements without additional processing and takes effect without an application restart. When different SQL statements contain different constant values, the statements may become divergent and be aggregated into {ARMS_OTHERS}. We do not recommend enabling this option.

Trace context propagation protocol settings

In the Trace context propagation protocol settings section, select a trace context propagation protocol based on your requirements.

By default, the Cloud Monitor 2.0 agent selects a trace context propagation protocol based on whether the request header contains a specific protocol header. For more information, see Trace context propagation protocol selection policy.

You can select a preferred protocol on this page. After you save the setting, the agent prioritizes detecting the request header defined by that protocol. For example, if you set Jaeger as the preferred protocol, the agent checks for context headers in the following order: Jaeger, EagleEye, W3C, SkyWalking, and then Zipkin.

You can also enforce a specific protocol. For example, if you enforce the Jaeger protocol, the agent only detects request headers defined by Jaeger. If the header is not found, the agent does not check other protocols and instead generates a new trace context.

Purpose:

Select a preferred or enforced trace context propagation protocol for the following use cases:

  • A request carries trace contexts in multiple formats, and the default parsing order does not meet your requirements. You want to specify a preferred protocol. For example, if a request carries both W3C and Zipkin trace contexts, the agent parses the W3C context by default. You can set the propagation protocol to Zipkin to prioritize parsing the Zipkin context instead.

  • A request carries a trace header, but you do not want to reuse it and prefer to generate a new trace context using a different protocol. For example, if a request carries a Zipkin trace context, the agent parses it by default. You can set the propagation protocol to W3C and the propagation mode to enforced. This causes the agent to ignore the Zipkin context and generate a new one based on the W3C specification. Note: If you do not set the propagation mode to enforced, the agent still attempts to parse the Zipkin context after failing to parse the W3C context first.

Effect:

After configuration, each LocalRootSpan in a trace will contain an attribute with the key trace.protocol.type and a value indicating the trace protocol used for that trace.

Agent collection settings

In the Agent collection settings section, set the maximum number of traces collected per second, the maximum QPS threshold, and the agent log level.

  • Collect Traces: Controls whether trace data is reported. Enabled by default. If disabled, trace data is no longer reported.

  • Maximum Number of Spans Collected by the Agent per Second: The maximum spans the agent can report per second. For performance reasons, the actual effective threshold may deviate from the configured value by up to 5%. Spans exceeding this limit are not reported.

  • Maximum Agent QPS Threshold: The maximum requests the agent can process per second. For performance reasons, the actual effective threshold may deviate from the configured value by up to 5%. Requests exceeding this threshold are not monitored, meaning no spans or metrics are generated and TraceId-based log association does not work for these requests.

  • Collect Data for Internal Calls Without an Entry Point: In Cloud Monitor 2.0, HTTP services, RPC services, scheduled tasks, and message consumption are considered entry points. Calls made within the business logic of these entry points, such as database calls or outbound HTTP requests, are considered internal calls with an entry point. Conversely, scheduled calls such as HTTP calls, database calls, NoSQL calls, message sending, or RPC calls that are initiated from a JDK thread pool are considered internal calls without an entry point. In agent versions 4.2.2 and later, you can filter out this data with a single click. For example, the Lettuce framework periodically runs commands to maintain a healthy connection with the Redis server. These are internal calls without an entry point. After you disable this setting, the related data is no longer collected.

  • Agent Log Level: Adjusts the logging level of the agent for troubleshooting purposes.

Advanced exception filtering settings

In the Advanced exception filtering settings section, configure exception collection rules.

  • Collect Plugin Exceptions: Specifies whether to collect exceptions thrown by plugins.

  • Stack Depth for Differentiating Similar Exceptions: Defaults to 2. This stack depth identifies exceptions of the same type. Modifying this setting may cause unexpected statistical behavior. Proceed with caution.

  • Exception Filter Whitelist:

    To hide certain exceptions from the Exception Analysis tab, enter their fully qualified class names. These exceptions are excluded from error counts and hidden from the Exception Analysis page.

    Affected data: Exception count metrics (arms_exception_requests_count_raw, arms_exception_requests_seconds_raw) and exception information in Spans.

    Affected features: The metrics for the corresponding exceptions on the Exception Analysis tab, the exception information in spans on the Trace Explorer page, and the exception count alerts for the corresponding exceptions.

    Format: Use the fully qualified class names of the exceptions to be filtered. Separate multiple exception names with a comma (,).

    Example: java.lang.InterruptedException,java.lang.IndexOutOfBoundsException

    Default: None

  • Inherit from Parent Class for Exception Filtering: When enabled, if a collected exception is a subclass of an exception class configured in the exception filter whitelist, it will also be filtered.

    Effect: Exceptions that meet the filter conditions will not appear in the Cloud Monitor 2.0 console.

  • Filter by Exception Message: After configuration, if the message field of a specified exception type meets the configured conditions, it will also be filtered.

    • Exception name: Specifies the exception to which the filter applies.

    • Message condition: The condition for the exception message, which can be startsWith, endsWith, or contains.

    • Message keyword: The keyword string.

    Effect: Exceptions that meet the filter conditions will not appear in the Cloud Monitor 2.0 console.

Pool monitoring settings

In the Pooled resource monitoring settings section, configure collection rules for thread pools and connection pools.

  • Thread Pool and Connection Pool Monitoring: Monitors thread pool metrics for frameworks such as Tomcat, Dubbo, and HSF. You must upgrade the agent to the latest version.

  • Thread pool thread name pattern extraction strategy: By default, this feature replaces all numeric characters in the names of running threads within a thread pool with *. You can also configure it to replace only the ending characters of the thread names with *. For example, if an application starts multiple Dubbo Providers that use different listening ports, the default strategy will cause their thread pools to be aggregated into a single pool because the same thread name template is extracted. In this case, you can adjust the strategy to differentiate between the thread pools.

    Effect: For a typical Tomcat thread pool, the default name pattern is http-nio-*-exec-*. After changing the policy, the name pattern might become http-nio-9099-exec-*.

  • Filter by Thread Pool Use Case and Filter by Thread Pool Name Pattern: Filters and prevents the reporting of monitoring metrics for certain thread pools based on their use case and name pattern.

    Note

    This setting is effective only for Java agent versions 4.2.0 and later.

    • Thread pool use case: Refers to the scenario where the thread is used. Currently supported use cases include Tomcat, Vert.x, Undertow, Dubbo, Jetty, AliyunJavaAgent, and default. AliyunJavaAgent represents thread pools used by the agent, while default represents other unclassified thread pools.

    • Thread pool name pattern: Refers to the name pattern obtained after processing the thread names in the thread pool. For example, http-nio-*-exec-* is typically derived by replacing the numeric parts of the actual thread name with an *.

    Affected data: thread pool metrics

    Affected features: The Thread Pool Monitoring tab and alerts configured based on thread pool monitoring metrics.

    Format:

    • Filter by thread pool use case: The use cases displayed on the Thread Pool Monitoring tab. Separate multiple use cases with a comma (,).

    • Filter by thread pool name pattern: The thread name patterns displayed on the Thread Pool Monitoring tab. Separate multiple patterns with a comma (,). This is an exact match and does not support pattern rules.

    Example:

    • Filter by thread pool use case: AliyunJavaAgent,Jetty

    • Filter by thread pool name pattern: Catalina-utility-*,DubboServerHandler-*-thread-*

    This means that all thread pool data for the AliyunJavaAgent use case will not be reported. For other use cases, if the thread pool name pattern is Catalina-utility-*, its data will not be reported.

    Default: None

Span attributes settings

  • Record Attributes Defined in the OpenTelemetry Specification: The OpenTelemetry Specification defines standard attributes for spans of each plugin type. To reduce data volume, the Cloud Monitor 2.0 agent does not record all of these attributes by default. Enable this option to record them as needed. For a list of attributes added by each framework, see the OpenTelemetry Specification.

    Enabling this switch adds the highlighted attributes.

    For example, after you enable this option, attributes such as http.request.method, url.scheme, url.path, server.address, and server.port are added to HTTP server spans.

  • Attach Application Tags to Spans: Controls which spans include the tags you have assigned to the application on the Applications page. By default, all spans include application tags. To reduce data usage, you can choose to attach tags only to entry spans. Entry spans typically include HTTP server, RPC server, MQ message consumption, and scheduled task spans.

    You can configure an application tag to be attached to an entry Span. For example, your application can have a tag such as test1:value1.

    For an entry span, the corresponding tag attribute is visible.

    For non-entry Spans, their attributes do not contain test1:value.

Advanced settings

In the Advanced Settings section, configure interfaces to filter and the maximum length of method stacks.

  • Quantile Statistics: Enables or disables quantile statistics.

  • Call chain compression: Specifies whether to simplify repetitive calls, such as those in a for loop.

  • Maximum Display Length of Request Input Parameters: Defaults to 512 characters. The maximum supported length is 2,048 characters.

  • Include TraceId in HTTP Response: For HTTP requests only, returns the eagleeye-traceid field in the response header.

  • JVM GC Trigger Root Cause: When enabled, allows you to view the root cause of JVM garbage collection (GC) events. You can view monitoring details on the JVM monitoring page. For descriptions of GC trigger causes, see GC-related metrics.

Copy settings to other applications

To apply the same settings to other applications, copy the configuration.

Copy a single setting to other applications

  1. In the corresponding configuration section, click Bulk copy to other applications.

  2. If the Current settings not saved dialog box appears, click OK to save the current application's settings, and then click Save and bulk copy to other applications.

  3. In the dialog box that appears, select the applications where the setting will take effect, and then click OK.

Copy all settings to other applications

  1. At the bottom of the page, click Save and bulk copy to other applications.

  2. If the Current settings not saved dialog box appears, click OK to save the current application's settings, and then click Save and bulk copy to other applications.

  3. In the dialog box that appears, select the applications where the settings will take effect, and then click OK.

Custom configuration templates

Save the current settings as a custom configuration template. This template becomes the default configuration for new applications.

  1. At the bottom of the page, click Save current application settings as custom configuration template.

  2. If the Current settings not saved dialog box appears, click OK to save the current application's settings, and then click Save current application settings as custom configuration template.

  3. In the dialog box that appears, click Confirm.