Annotating-based controller layer interface real-time monitoring method and device
By weaving monitoring probes into the controller layer and using a lock-free circular buffer to handle interface call events, the problems of business intrusion and resource consumption in existing monitoring solutions are solved. This enables lightweight, real-time interface monitoring under a microservice architecture, improving the efficiency of anomaly detection and early warning.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU LINGQING INTELLIGENT CONTROL TECHNOLOGY CO LTD
- Filing Date
- 2026-05-12
- Publication Date
- 2026-08-04
AI Technical Summary
Existing technologies cannot achieve zero business intrusion, extremely low operating overhead, sub-second real-time response, and controllable multi-dimensional analysis capabilities under a microservice architecture, and cannot meet the lightweight, refined, and real-time requirements of controller layer interface monitoring.
By scanning microservice instance annotations to weave monitoring probes into the controller layer, combined with a lock-free circular buffer and predefined time windows, local storage and sliding window processing of interface call events are achieved, generating real-time aggregated snapshots or differentiated uploads of full call events, reducing system resource consumption and improving the efficiency of anomaly detection and early warning.
It achieves interface monitoring with zero business intrusion, reduces the impact on system performance, provides sub-second real-time indicator statistics and anomaly early warning efficiency, and balances the needs of lightweight daily monitoring with refined anomaly troubleshooting, while reducing network transmission and storage pressure.
Smart Images

Figure CN122507584A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of software operation monitoring, and in particular to a method and apparatus for real-time monitoring of controller layer interfaces based on annotations. Background Technology
[0002] With the widespread adoption of cloud-native and distributed microservice architectures, the controller layer of web applications, as the unified entry point for business traffic, is responsible for receiving, routing, and distributing responses to all external requests. The availability, response performance, error distribution, and call patterns of its interfaces directly determine the service quality and end-user experience of the business system. As the complexity of enterprise digital business continues to increase, the interface scale of microservice clusters is growing exponentially, and cross-tenant, multi-version, and multi-instance interface call scenarios are becoming increasingly common. Therefore, granular, real-time, and multi-dimensional monitoring capabilities for controller layer interfaces have become a core necessity for ensuring business continuity, improving operational and troubleshooting efficiency, and reducing online failure risks.
[0003] Currently, the mainstream monitoring solutions for web interfaces in the industry are based on application performance monitoring (APM) systems. These solutions achieve end-to-end tracing and metric collection of distributed service calls through full-stack instrumentation, deep bytecode enhancement, or dedicated SDK integration, which solves the problem of fault location in cross-service scenarios to some extent. However, these solutions have inherent drawbacks that cannot be avoided: First, most of them require modification of business system code to introduce dedicated dependencies or to perform system-wide deep bytecode injection, resulting in high coupling with business logic; Second, end-to-end tracing requires generating a complete call span context for a single request and performing cross-node propagation, and synchronous instrumentation and full data collection modes will continuously consume a large amount of CPU, memory, and network resources.
[0004] Meanwhile, existing monitoring solutions have significant technical shortcomings in real-time response capabilities and multi-dimensional analysis support. Current mainstream solutions generally employ a "batch collection - offline disk storage - periodic aggregation" processing chain. From data collection via API calls to final visualization, there is typically a minute-level transmission and processing latency, making it impossible to achieve sub-second-level real-time metric feedback. In the face of sudden traffic surges, soaring API timeouts, and sudden increases in error rates, fault detection and early warning are severely delayed, easily leading to a continuous escalation of business losses. When multi-dimensional tags such as tenant, version, region, and instance are introduced for combined analysis, dimensionality explosion and cardinality loss problems are highly likely, not only causing an exponential increase in data storage costs but also resulting in extremely high latency for multi-dimensional OLAP query responses.
[0005] Furthermore, existing solutions consistently fail to meet the dual demands of lightweight implementation and granular monitoring. For many SMEs and business development teams, the deployment, maintenance, and adaptation costs of heavy-duty APM systems are extremely high, requiring dedicated technical teams for continuous maintenance, making implementation far beyond the reach of business teams.
[0006] In summary, no existing technology has yet provided a controller layer interface monitoring solution that can simultaneously meet the requirements of zero business intrusion, extremely low operating overhead, sub-second real-time response, and controllable multi-dimensional analysis capabilities. This makes it unsuitable for the core requirements of lightweight, refined, and real-time interface monitoring in complex business scenarios under a microservice architecture. Summary of the Invention
[0007] This application provides a method and apparatus for real-time monitoring of controller layer interfaces based on annotations. This solution deploys a lock-free circular buffer locally on the user end to store interface call event information, and predefines the time window size and window step size. The call event information is processed by sliding window to achieve real-time indicator statistics at the sub-second level, which greatly improves the efficiency of interface anomaly detection and early warning.
[0008] In a first aspect, embodiments of this application provide a method for real-time monitoring of a controller layer interface based on annotations, the method comprising:
[0009] Scan the annotations of the user-side microservice instance to obtain each controller, and weave monitoring probes into each controller to monitor the call event information of each interface within the controller. The call event information includes interface call parameters and multiple predefined monitoring dimensions. When an interface is invoked, the corresponding invocation event information is stored in a lock-free circular buffer deployed locally on the user's end. In the lock-free circular buffer, the interface invocation parameters of each interface within the current time window are aggregated according to different monitoring dimensions to obtain multiple aggregation results. If the percentile of the interface latency of the aggregation result does not exceed a preset threshold, a real-time aggregation snapshot is generated based on the corresponding aggregation result and uploaded to the server. If the percentile of the interface latency of the aggregation result exceeds the preset threshold, the full invocation event information corresponding to the aggregation result in the lock-free circular buffer is retrieved and uploaded to the server.
[0010] Secondly, embodiments of this application provide an annotation-based real-time monitoring device for controller layer interfaces, comprising: Control layer: Scan the annotations of the user-end microservice instance to obtain each controller, and weave monitoring probes into each controller to monitor the call event information of each interface within the controller. The call event information includes interface call parameters and multiple predefined monitoring dimensions. Data Processing Layer: When an interface is invoked, the corresponding invocation event information is stored in a lock-free circular buffer deployed locally on the user's end. In the lock-free circular buffer, the interface invocation parameters of each interface within the current time window are aggregated according to different monitoring dimensions to obtain multiple aggregation results. If the percentile of the interface latency of the aggregation result does not exceed a preset threshold, a real-time aggregation snapshot is generated based on the corresponding aggregation result and uploaded to the server. If the percentile of the interface latency of the aggregation result exceeds the preset threshold, the full invocation event information corresponding to the aggregation result in the lock-free circular buffer is retrieved and uploaded to the server.
[0011] Thirdly, embodiments of this application provide an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to execute an annotation-based real-time monitoring method for a controller layer interface.
[0012] Fourthly, embodiments of this application provide a readable storage medium storing a computer program, which, when executed by a processor, implements an annotation-based real-time monitoring method for a controller layer interface.
[0013] The main contributions and innovations of this invention are as follows: This application's embodiments obtain controllers by scanning microservice instance annotations and weave monitoring probes into the controller method entry and exit points, thereby achieving interface monitoring with zero business intrusion. It requires no modification to business code or the introduction of proprietary dependencies, resulting in extremely low coupling with business logic. This solution deploys a lock-free circular buffer locally on the user end to store interface call event information. The lock-free structure avoids multi-threaded lock contention, keeping typical CPU usage for data writing below 0.5%, significantly reducing the performance impact of monitoring on the business system. This solution predefines the time window size and window step, performing sliding window processing on call event information to achieve sub-second real-time metric statistics, solving the problems of traditional methods. The minute-level processing latency caused by the "batch collection-offline disk writing-periodic aggregation" approach significantly improves the efficiency of interface anomaly detection and early warning. This solution, based on preset thresholds for interface latency percentiles and interface call error rates, adopts a dual-path differentiated data reporting strategy. When the interface is in normal condition, only a lightweight real-time aggregated snapshot is uploaded, greatly reducing network transmission overhead and server-side storage pressure. When the interface is in an abnormal condition, the corresponding full call event information is automatically uploaded, retaining complete fault diagnosis data, while taking into account both the lightweight nature of daily monitoring and the refined needs of anomaly troubleshooting. In abnormal scenarios, the reporting frequency of normal traffic can be limited to prevent the monitoring system from being overwhelmed by sudden traffic surges.
[0014] Details of one or more embodiments of this application are set forth in the following drawings and description to make other features, objects and advantages of this application more readily apparent. Attached Figure Description
[0015] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 This is a flowchart of a real-time monitoring method for an annotation-based controller layer interface according to an embodiment of this application; Figure 2 This is an endpoint call heatmap for visual analysis of a server according to an embodiment of this application; Figure 3 This is an interface latency quantile diagram for visual analysis of a server according to an embodiment of this application; Figure 4 This is a Sankey diagram of a status code for visual analysis of a server according to an embodiment of this application; Figure 5 This is a tenant performance comparison chart that is visualized and analyzed by a server according to an embodiment of this application. Figure 6 This is a runtime sequence diagram of a real-time monitoring method for a controller layer interface according to an embodiment of this application; Figure 7 This is a structural block diagram of a real-time monitoring device for an annotation-based controller layer interface according to an embodiment of this application; Figure 8 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0016] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with one or more embodiments of this specification. Rather, they are merely examples of apparatuses and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.
[0017] It should be noted that the steps of the corresponding methods are not necessarily performed in the order shown and described in this specification in other embodiments. In some other embodiments, the methods may include more or fewer steps than described in this specification. Furthermore, a single step described in this specification may be broken down into multiple steps in other embodiments; and multiple steps described in this specification may be combined into a single step in other embodiments.
[0018] Example 1 This application provides an annotation-based real-time monitoring method for controller layer interfaces. It deploys a lock-free circular buffer locally on the user end to store interface call event information, and predefines the time window size and window step. The call event information is processed using a sliding window method to achieve sub-second-level real-time metric statistics, significantly improving the efficiency of interface anomaly detection and early warning. Specifically, refer to... Figure 1 The method includes: Scan the annotations of the user-side microservice instance to obtain each controller, and weave monitoring probes into each controller to monitor the call event information of each interface within the controller. The call event information includes interface call parameters and multiple predefined monitoring dimensions. When an interface is invoked, the corresponding invocation event information is stored in a lock-free circular buffer deployed locally on the user's end. In the lock-free circular buffer, the interface invocation parameters of each interface within the current time window are aggregated according to different monitoring dimensions to obtain multiple aggregation results. If the percentile of the interface latency of the aggregation result does not exceed a preset threshold, a real-time aggregation snapshot is generated based on the corresponding aggregation result and uploaded to the server. If the percentile of the interface latency of the aggregation result exceeds the preset threshold, the full invocation event information corresponding to the aggregation result in the lock-free circular buffer is retrieved and uploaded to the server.
[0019] In the current embodiment, when the startup signal of the microservice instance is obtained on the user end, the annotations of the microservice instance on the user end are scanned to obtain the controller annotations. Based on the metadata of the controller annotations, the corresponding controller path is extracted, and the monitoring probes are deployed at the entry and exit points of the controller.
[0020] Specifically, deploying monitoring probes at the entry and exit points of controller methods can accurately capture the start and end times of each interface call, thereby obtaining the interface response time, and the monitoring probes are injected only once for function boundary interception.
[0021] Furthermore, the controller annotations include native routing annotations from web frameworks such as Spring or custom monitoring annotations. The call event information for each interface is obtained based on the routing annotations and custom monitoring annotations. The routing annotations declare interface call parameters, and the custom monitoring annotations declare monitoring dimensions. The interface call parameters are basic parameter information related to the interface call behavior. The monitoring dimensions include business dimensions and operational dimensions. The business dimensions are dimension information related to the tenant's own attributes, and the operational dimensions are dimension information related to the tenant's interface calls.
[0022] Specifically, the interface call parameters include interface path, HTTP request method, interface response time, interface response status, and interface QPS. The business dimension includes tenant ID, tenant version, and product line identifier. The operation and maintenance dimension includes instance ID, instance IP, container name, user source region, service deployment region, HTTP status code, interface exception type, and time window size.
[0023] It is worth mentioning that by modifying custom monitoring annotations, the size of the monitoring dimensions can be expanded, so that the monitoring probe can obtain information from different monitoring dimensions, thereby achieving comprehensive monitoring of the interface.
[0024] In the current embodiment, a predefined time window size and window step are used to perform sliding window processing on the call event information in the lock-free circular buffer. The Top-K algorithm is used to select K combinations of monitoring dimensions with high to low frequency. During the sliding window processing, the interface call parameters of the K combinations of monitoring dimensions are aggregated to obtain multiple aggregation results.
[0025] Specifically, the sliding window allows for real-time statistics of recent call events, unlike traditional monitoring which waits until the end of the current time period to obtain statistical results. For example, if the current time is 10:00:01, the time window size is 1 second, and the step size is 0.1 seconds, traditional statistics only count the interface data for the first second at 10:00:02. However, this solution counts the data every 0.1 seconds, meaning that the call event information will be counted at 10:00:01.1.
[0026] For example, if the most frequently occurring monitoring dimension combination is tenant ID + version, i.e., tenantId=A, version=v1, then all interface call parameters under tenant ID A and version v1 are aggregated, so that the call situation of different tenants for the same interface can be visualized and analyzed in subsequent steps; or if the most frequently occurring monitoring dimension combination is tenant ID + regional IP, then the interface call parameters of different tenants under different regions are aggregated, so that the call situation of different regions for the same interface can be visualized and analyzed in subsequent steps.
[0027] It is worth mentioning that the monitoring dimension combinations in this solution can also be customized, allowing for specific visualization analysis of a particular aspect.
[0028] In the current embodiment, an approximate quantile sketch is used to aggregate the interface call parameters for any combination of monitoring dimensions in the current time window.
[0029] Specifically, each interface call parameter is recorded using DDSketch or CKMS approximate quantile sketches, and the recorded results are aggregated using an aggregator. DDSketch supports configuring relative errors (such as ±1%), which significantly reduces memory and computational overhead while ensuring the accuracy of key quantiles such as P99. CKMS is suitable for dynamic quantile estimation in streaming scenarios.
[0030] Specifically, the aggregator that aggregates interface call parameters adopts a single-producer lock-free structure to avoid lock contention, with typical CPU usage below 0.5%.
[0031] For example, taking percentile precision P99 as an example, an approximate quantile sketch is used to count the parameters of a certain interface call and make them fall into the error controllable histogram. An aggregator is used to aggregate the error controllable histogram. Here, P99 means that 99% of the requests should be less than the specified latency, and only 1% of the requests are allowed to be greater than the specified latency. Similarly, the quantile precision in this solution is set manually and can be P50, P95, P99, etc.
[0032] In the current embodiment, the interface latency is obtained based on the monitoring probe. The interface latency is the interface response time, which is used to indicate the specific time when the interface receives the call information and provides feedback.
[0033] In the current embodiment, if the percentile of the interface latency of the aggregation result does not exceed the preset threshold, it indicates that the interface is in normal condition. For example, if the preset threshold is 120ms, then when P99 is greater than 120ms, it means that 1% of the interface responses are greater than 12ms. This indicates that the interface call has a tail delay. In this case, the full call event information corresponding to the aggregation result in the lockless circular buffer is retrieved and uploaded to the server to analyze the cause of the tail delay.
[0034] In other embodiments, if the interface call error rate in the aggregation result exceeds a preset threshold, a real-time aggregation snapshot is generated based on the corresponding aggregation result and uploaded to the server; if the interface call error rate in the aggregation result does not exceed the preset threshold, the full call event information corresponding to the aggregation result in the lock-free circular buffer is retrieved and uploaded to the server.
[0035] Specifically, when uploading all event information to the server, the reporting frequency of other normal traffic is limited to prevent the monitoring system from being overwhelmed.
[0036] In the current embodiment, the real-time aggregated snapshot is incrementally uploaded to the server, and the server performs visual analysis based on the received data content.
[0037] In other words, this scheme uses token bucket / leaky bucket and aggregated reporting to control CPU / network overhead for high-concurrency traffic. When P99 exceeds the threshold or the error rate increases, tail enhancement sampling is automatically triggered to retain the original sample or a finer-grained sketch, while normal traffic only reports aggregated snapshots.
[0038] In the current embodiment, the received data is stored on the server side in a way that separates time series and dimensional indexes, and multidimensional OLAP style queries are supported.
[0039] In the current embodiment, the endpoint call heatmap during server-side visualization analysis is as follows: Figure 2 As shown, the interface delay quantile diagram is as follows: Figure 3 As shown in (P50 / P95 / P99), the status code Sankey diagram is as follows: Figure 4 As shown in the figure, the tenant performance comparison chart is as follows: Figure 5 As shown, the tenant performance comparison includes tenant / version comparison, instance comparison, geographical / regional distribution, anomaly window magnification, and tail request replay diagnosis. Figure 2 In the context of endpoint call heatmaps, this is used to display which interfaces are currently under high load. Figure 3 In the diagram, the interface delay quantile is used to show whether P99 exceeds the threshold. Figure 4 In the context of requests, a Sankey diagram of state transitions is used to show whether errors are concentrated in a particular version or region. Figure 5 In the chart, the tenant performance comparison graph is used to show the differences in response time among different tenants.
[0040] Specifically, any type of visualization analysis can be used to analyze the data within the server.
[0041] In the current embodiment, the runtime sequence of the real-time monitoring method for the controller layer interface is as follows: Figure 6 As shown, the real-time aggregated snapshots in this solution are reported via a UDP / QUIC priority link (with optional FEC / retransmission), and zero-copy serialization (FlatBuffers) reduces serialization overhead. FlatBuffers allows access to fields without deserialization, significantly reducing GC pressure and CPU consumption.
[0042] Example 2 Based on the same concept, referencing Figure 7 This application also proposes a data import device, comprising: Control layer: Scan the annotations of the user-end microservice instance to obtain each controller, and weave monitoring probes into each controller to monitor the call event information of each interface within the controller. The call event information includes interface call parameters and multiple predefined monitoring dimensions. Data Processing Layer: When an interface is invoked, the corresponding invocation event information is stored in a lock-free circular buffer deployed locally on the user's end. In the lock-free circular buffer, the interface invocation parameters of each interface within the current time window are aggregated according to different monitoring dimensions to obtain multiple aggregation results. If the percentile of the interface latency of the aggregation result does not exceed a preset threshold, a real-time aggregation snapshot is generated based on the corresponding aggregation result and uploaded to the server. If the percentile of the interface latency of the aggregation result exceeds the preset threshold, the full invocation event information corresponding to the aggregation result in the lock-free circular buffer is retrieved and uploaded to the server.
[0043] Example 3 This embodiment also provides an electronic device, see reference. Figure 8 It includes a memory 404 and a processor 402, wherein the memory 404 stores a computer program and the processor 402 is configured to run the computer program to perform the steps in any of the above method embodiments.
[0044] Specifically, the processor 402 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.
[0045] Memory 404 may include a mass storage device for data or instructions. For example, and not limitingly, memory 404 may include a hard disk drive (HDD), a floppy disk drive, a solid-state drive (SSD), flash memory, an optical disk drive, a magneto-optical disk drive, magnetic tape, or a Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 404 may include removable or non-removable (or fixed) media. Where appropriate, memory 404 may be internal or external to a data processing device. In a particular embodiment, memory 404 is non-volatile memory. In a particular embodiment, memory 404 includes read-only memory (ROM) and random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable read-only memory (PROM), an erasable read-only memory (EPROM), an electrically erasable read-only memory (EEPROM), an electrically alterable read-only memory (EAROM), or flash memory, or a combination of two or more of these. Where appropriate, the RAM can be Static Random-Access Memory (SRAM) or Dynamic Random-Access Memory (DRAM). DRAM can be Fast Page Mode Dynamic Random-Access Memory (FPMDRAM), Extended Data Out Dynamic Random-Access Memory (EDODRAM), Synchronous Dynamic Random-Access Memory (SDRAM), etc.
[0046] The memory 404 can be used to store or cache various data files that need to be processed and / or communicated, as well as possible computer program instructions executed by the processor 402.
[0047] The processor 402 reads and executes computer program instructions stored in the memory 404 to implement any of the annotation-based controller layer interface real-time monitoring methods in the above embodiments.
[0048] Optionally, the electronic device may further include a transmission device 406 and an input / output device 408, wherein the transmission device 406 is connected to the processor 402, and the input / output device 408 is connected to the processor 402.
[0049] The transmission device 406 can be used to receive or send data via a network. Specific examples of the network described above may include wired or wireless networks provided by the communication provider of the electronic device. In one example, the transmission device includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 406 may be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0050] Input / output device 408 is used to input or output information. In this embodiment, the input information may be event information, etc., and the output information may be visualization analysis results, etc.
[0051] Optionally, in this embodiment, the processor 402 can be configured to perform the following steps via a computer program: Scan the annotations of the user-side microservice instance to obtain each controller, and weave monitoring probes into each controller to monitor the call event information of each interface within the controller. The call event information includes interface call parameters and multiple predefined monitoring dimensions. When an interface is invoked, the corresponding invocation event information is stored in a lock-free circular buffer deployed locally on the user's end. In the lock-free circular buffer, the interface invocation parameters of each interface within the current time window are aggregated according to different monitoring dimensions to obtain multiple aggregation results. If the percentile of the interface latency of the aggregation result does not exceed a preset threshold, a real-time aggregation snapshot is generated based on the corresponding aggregation result and uploaded to the server. If the percentile of the interface latency of the aggregation result exceeds the preset threshold, the full invocation event information corresponding to the aggregation result in the lock-free circular buffer is retrieved and uploaded to the server.
[0052] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.
[0053] Generally, various embodiments can be implemented in hardware or dedicated circuitry, software, logic, or any combination thereof. Some aspects of the invention can be implemented in hardware, while others can be implemented by firmware or software executed by a controller, microprocessor, or other computing device, but the invention is not limited thereto. Although various aspects of the invention may be shown and described as block diagrams, flowcharts, or using some other graphical representation, it should be understood that, by way of non-limiting example, these blocks, apparatuses, systems, techniques, or methods described herein can be implemented in hardware, software, firmware, dedicated circuitry or logic, general-purpose hardware or controllers or other computing devices, or some combination thereof.
[0054] Embodiments of the present invention can be implemented by computer software, which may be executable by a data processor of a mobile device, such as a processor entity, or by hardware, or by a combination of software and hardware. Computer software or programs (also referred to as program products) including software routines, applets, and / or macros can be stored in any device-readable data storage medium, and they include program instructions for performing specific tasks. The computer program product may include one or more computer-executable components configured to perform the embodiments when the program is run. The one or more computer-executable components may be at least one piece of software code or a portion thereof. Additionally, it should be noted in this respect that, as Figure 8 Any box in the logical flow can represent a program step, or interconnected logic circuits, boxes and functions, or a combination of program steps and logic circuits, boxes and functions. Software can be stored on physical media such as memory chips or blocks of storage implemented within a processor, magnetic media such as hard disks or floppy disks, and optical media such as DVDs and their data variants, CDs, etc. The physical medium is a non-transient medium.
[0055] Those skilled in the art should understand that the technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments have been described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0056] The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for real-time monitoring of controller layer interfaces based on annotations, characterized in that, Includes the following steps: Scan the annotations of the user-side microservice instance to obtain each controller, and weave monitoring probes into each controller to monitor the call event information of each interface within the controller. The call event information includes interface call parameters and multiple predefined monitoring dimensions. When an interface is invoked, the corresponding invocation event information is stored in a lock-free circular buffer deployed locally on the user's end. In the lock-free circular buffer, the interface invocation parameters of each interface within the current time window are aggregated according to different monitoring dimensions to obtain multiple aggregation results. If the percentile of the interface latency of the aggregation result does not exceed a preset threshold, a real-time aggregation snapshot is generated based on the corresponding aggregation result and uploaded to the server. If the percentile of the interface latency of the aggregation result exceeds the preset threshold, the full invocation event information corresponding to the aggregation result in the lock-free circular buffer is retrieved and uploaded to the server.
2. The annotation-based real-time monitoring method for controller layer interfaces according to claim 1, characterized in that, When the startup signal of the microservice instance is received on the user side, the annotations of the microservice instance on the user side are scanned to obtain the controller annotations. Based on the metadata of the controller annotations, the corresponding controller path is extracted, and the monitoring probes are deployed at the entry and exit points of the controller.
3. The annotation-based real-time monitoring method for controller layer interfaces according to claim 1, characterized in that, The interface call parameters are basic parameter information related to the interface call behavior. The monitoring dimensions include business dimensions and operation and maintenance dimensions. The business dimensions are dimension information related to the tenant's own attributes, and the operation and maintenance dimensions are dimension information related to the tenant's interface call.
4. The annotation-based real-time monitoring method for controller layer interfaces according to claim 1, characterized in that, Using a predefined time window size and window step, the call event information in the lock-free circular buffer is processed by sliding window. The Top-K algorithm is used to select K combinations of monitoring dimensions with high to low frequency. During the sliding window processing, the interface call parameters of the K combinations of monitoring dimensions are aggregated to obtain multiple aggregation results.
5. The annotation-based real-time monitoring method for controller layer interfaces according to claim 1, characterized in that, The interface call parameters for any combination of monitoring dimensions in the current time window are aggregated using an approximate quantile sketch.
6. The annotation-based real-time monitoring method for controller layer interfaces according to claim 1, characterized in that, If the interface call error rate in the aggregation result exceeds a preset threshold, a real-time aggregation snapshot is generated based on the corresponding aggregation result and uploaded to the server; if the interface call error rate in the aggregation result does not exceed a preset threshold, the full call event information corresponding to the aggregation result is retrieved from the lock-free circular buffer and uploaded to the server.
7. The annotation-based real-time monitoring method for controller layer interfaces according to claim 1, characterized in that, The real-time aggregated snapshot is incrementally uploaded to the server.
8. A real-time monitoring device for a controller layer interface based on annotations, characterized in that, include: Control layer: Used to scan annotations of user-end microservice instances to obtain each controller, and weave monitoring probes into each controller to monitor the call event information of each interface within the controller. The call event information includes interface call parameters and multiple predefined monitoring dimensions. Data Processing Layer: When an interface is invoked, the corresponding invocation event information is stored in a lock-free circular buffer deployed locally on the user's end. In the lock-free circular buffer, the interface invocation parameters of each interface within the current time window are aggregated according to different monitoring dimensions to obtain multiple aggregation results. If the percentile of the interface latency of the aggregation result does not exceed a preset threshold, a real-time aggregation snapshot is generated based on the corresponding aggregation result and uploaded to the server. If the percentile of the interface latency of the aggregation result exceeds the preset threshold, the full invocation event information corresponding to the aggregation result in the lock-free circular buffer is retrieved and uploaded to the server.
9. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to execute the annotation-based real-time monitoring method for the controller layer interface as described in any one of claims 1-7.
10. A readable storage medium, characterized in that, The readable storage medium stores a computer program, which, when executed by a processor, implements an annotation-based real-time monitoring method for controller layer interfaces as described in any one of claims 1-7.