All Products
Search
Document Center

Application Real-Time Monitoring Service:URL convergence

Last Updated:Dec 15, 2023

During metric collection, Application Real-Time Monitoring Service (ARMS) may encounter dimension divergence. For example, if a URL contains multiple user IDs, a new URL is generated for each user ID, and each URL corresponds to an ARMS interface. This makes monitoring more complex. To solve the problem, ARMS provides three URL convergence mechanisms.

Spring annotations-based convergence

For applications that use the Spring Web framework, ARMS attempts to extract the annotation information (such as RequestMapping) as the URL convergence rule. Sample code:

@RestController
@RequestMapping("/api/v1")
public class APIController {

    @RequestMapping("/user/{userId}/info")
    public String getUserInfo(@PathVariable("userId") String userId) {
        return "hello " + userId;
    }
}

The userId interface in the sample code is placed in the request URL as the PathVariable annotation. If the original URL is used as the interface name, the cardinality of the interface dimension is as large as the cardinality of userId. By extracting the annotation information, the interface name is converged to /api/v1/user/{userId}/info, and the cardinality of the interface dimension changes to 1. This greatly improves the monitoring efficiency.

Statistics-based convergence

For applications that do not use the Spring Web framework or scenarios where annotation extraction fails, the ARMS agent uses a statistics-based convergence mechanism. The mechanism is implemented based on the following rules:

  1. Each input value is split by using a preset delimiter, such as / or =, to identify a group of words.

  2. The number of unique words in each location (cardinality) is counted. If the cardinality exceeds the specified threshold value (default value: 1000), the word in the location is converged to * in the URL.

For example, the following URL is converged to /alertapi/console/v1/*/json.

/alertapi/console/v1/10001/json
/alertapi/console/v1/10002/json 
/alertapi/console/v1/10003/json 
......
......
/alertapi/console/v1/15000/json 

Custom configuration items

  • Main switch: Log on to the ARMS console and go to the application details page of your application. In the left-side navigation pane, click Application Settings. On the page that appears, click the Custom Configuration tab. In the URL Aggregation section, you can disable statistics-based convergence. > We recommend that you enable the feature. Otherwise, the dimensions diverge.

  • Convergence threshold: The default value is 1,000. If the cardinality exceeds the threshold value, the convergence of the word in the corresponding location is triggered. We recommend that you keep the default value.

  • Add a convergence rule: The following regular expression provides an example to show how to add a new convergence rule. The convergence threshold does not take effect on the convergence rule. If the regular expression is matched, convergence is triggered:

    /service/(.*?)/demo
  • Disable statistics-based convergence for a specific URL: The following regular expression provides an example to show how to disable statistics-based convergence for a specific URL: /api/v1/user/info:

    ^((?!/api/v1/user/info).)*$

Server-side convergence

The ARMS server has a built-in convergence mechanism. If convergence based on Spring annotations and statistics does not take effect, the ARMS server identifies the serious divergence of the URL dimension and chooses an algorithm to converge URLs and solve performance problems.

If the server-side convergence is triggered, the diverged part is replaced with {ARMS_*}.

  • If the diverged part contains only digits, it is replaced with {ARMS_NUMBER}.

  • If the diverged part contains only letters, it is replaced with {ARMS_WORD}.

  • If the diverged part contains digits and letters, it is replaced with {ARMS_ANY}.

Execution order

Convergence is implemented in the following order: Spring annotations-based convergence, statistics-based convergence, and server-side convergence. If a convergence mechanism is implemented as expected, other convergence mechanisms are not used.