Request link monitoring method and distributed system
By implementing the request link monitoring method on the target node of the distributed system, the problems of back-end service complexity and resource overhead in the prior art are solved, and the lightweight and flexibility of request link monitoring in the distributed system are realized.
Patent Information
- Application Number
- CN202510005620.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-03
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2045-01-03
AI Technical Summary
In the prior art, the request link monitoring of distributed systems relies on complex and huge back-end services, resulting in large resource overhead and cumbersome deployment.
By implementing the request link monitoring method on the target node of the distributed system, a request execution fragment is generated, and storing and reporting according to the target link identification and reporting information configured by the ingress node, it supports working under the condition of no data collection center.
Dispersing request link monitoring to various nodes in the distributed system reduces resource dependence and environmental deployment difficulty, and implements client-based request link monitoring without the need to deploy external server components.
Smart Images

Figure CN119415364B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present specification relate to the technical field of distributed service architecture, and more particularly to a request link monitoring method and a distributed system. Background Art
[0002] With the rapid development of computer technology, various project requirements are becoming more and more complex, and the system is also split in various ways. The application of distributed service architecture is becoming more and more extensive. The request link monitoring of distributed systems provides distributed applications with complete call link restoration, call request volume statistics, link topology, application dependency analysis and other functions. By recording the relevant data of the entire request link from initiation to completion of the service request in the distributed system, it can help quickly analyze and diagnose node anomalies under the distributed architecture or optimize performance.
[0003] In the prior art, a client / server architecture is adopted, where the client is responsible for executing service requests, collecting request execution data and reporting it to the server, and the server manages and analyzes a large number of request links by processing and storing request execution data. However, the above-mentioned client / server architecture for request link monitoring requires complex and large backend services, and heavyweight servers not only have high resource consumption, but also are cumbersome to deploy. Summary of the invention
[0004] In view of this, an embodiment of this specification provides a request link monitoring method. One or more embodiments of this specification also relate to a request link monitoring device, a distributed system, a computing device, a computer-readable storage medium and a computer program product to solve the technical defects existing in the prior art.
[0005] According to a first aspect of an embodiment of this specification, a request link monitoring method is provided, which is applied to a target node of a distributed system, including:
[0006] In response to the target request, executing the target request to generate a corresponding request execution fragment;
[0007] Obtaining a target link identifier and target reporting information of the target request, wherein the target link identifier and the target reporting information are configured based on an entry node, the target link identifier is used to identify a complete call link of the target request initiated from a user end to the distributed system, and the target reporting information is used to specify a reporting method of request link data corresponding to the target request;
[0008] The target link identifier and the requested execution fragment are stored in correspondence, and whether to report the corresponding requested execution fragment is determined according to the target reporting information, and if so, the target link identifier and the corresponding requested execution fragment are reported;
[0009] In response to the query instruction, the target request execution segment corresponding to the link identifier to be queried is returned.
[0010] According to a second aspect of an embodiment of this specification, a request link monitoring device is provided, which is applied to a target node of a distributed system, including:
[0011] A generating module, configured to execute the target request in response to the target request to generate a corresponding request execution fragment;
[0012] an acquisition module, configured to acquire a target link identifier and target reporting information of the target request, wherein the target link identifier and the target reporting information are configured based on an entry node, the target link identifier is used to identify a complete call link of the target request initiated from a user end to the distributed system, and the target reporting information is used to specify a reporting method of request link data corresponding to the target request;
[0013] A storage module is configured to store the target link identifier and the request execution fragment in correspondence, and determine whether to report the corresponding request execution fragment according to the target reporting information, and if so, report the target link identifier and the corresponding request execution fragment;
[0014] In response to the query instruction, the target request execution segment corresponding to the link identifier to be queried is returned.
[0015] According to a third aspect of an embodiment of this specification, there is provided a distributed system, including an entry node and at least one downstream node;
[0016] The entry node is used to respond to the target request, execute the target request to generate a corresponding request execution fragment; configure the target link identifier and target reporting information of the target request, the target link identifier is used to identify the complete call link of the target request initiated from the user end to the distributed system, and the target reporting information is used to specify the reporting method of the request link data corresponding to the target request; store the target link identifier and the request execution fragment in correspondence, and determine whether to report the corresponding request execution fragment according to the target reporting information, and if so, report the target link identifier and the corresponding request execution fragment; send the target request, the target link identifier and the target reporting information to the downstream node;
[0017] The downstream node is used to respond to the target request, execute the target request to generate a corresponding request execution fragment, obtain the target link identifier and target reporting information of the target request, store the target link identifier and the request execution fragment in correspondence, and report the target link identifier and the corresponding request execution fragment according to the target reporting information; send the target request, the target link identifier and the target reporting information to the next downstream node;
[0018] The entry node and the downstream node are further configured to return a target request execution fragment corresponding to the link identifier to be queried in response to a query instruction.
[0019] According to a fourth aspect of an embodiment of this specification, a computing device is provided, including:
[0020] Memory and processor;
[0021] The memory is used to store computer executable instructions, and the processor is used to execute the computer executable instructions. When the computer executable instructions are executed by the processor, the steps of the above-mentioned request link monitoring method are implemented.
[0022] According to a fifth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the instructions are executed by a processor, the steps of the above-mentioned request link monitoring method are implemented.
[0023] According to a sixth aspect of the embodiments of this specification, a computer program product is provided, including a computer program / instruction, which implements the steps of the above-mentioned request link monitoring method when executed by a processor.
[0024] An embodiment of the present specification provides a request link monitoring method, which is applied to a target node of a distributed system, and in response to a target request, executes the target request to generate a corresponding request execution fragment; obtains a target link identifier and target reporting information of the target request, wherein the target link identifier and the target reporting information are configured based on an entry node, the target link identifier is used to identify a complete call link of the target request initiated from a user end to the distributed system, and the target reporting information is used to specify a reporting method for request link data corresponding to the target request; stores the target link identifier and the request execution fragment in correspondence, and determines whether to report the corresponding request execution fragment based on the target reporting information, and if so, reports the target link identifier and the corresponding request execution fragment; and returns the target request execution fragment corresponding to the link identifier to be queried in response to a query instruction.
[0025] An embodiment of the present specification realizes that, for any target node in a distributed system, a target request can be executed to generate a corresponding request execution fragment, the target link identifier and the request execution fragment are stored correspondingly, and whether to report the corresponding request execution fragment is determined based on the target reporting information. If reported, the target link identifier and the corresponding request execution fragment are reported, and the target request execution fragment corresponding to the link identifier to be queried is returned in response to the query instruction. In this way, unlike the client / server architecture, any target node in a distributed system can both report data and provide query services for request links, distributing the monitoring of request links to various nodes in the distributed system, and based on the client-side request link monitoring, there is no need to deploy server components, which reduces resource dependence and environmental deployment difficulty. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 is a flow chart of a method for requesting link monitoring provided by an embodiment of this specification;
[0027] Figure 2 It is a schematic diagram of the architecture of a target node in a distributed system provided by an embodiment of this specification;
[0028] Figure 3 It is a structural block diagram of a distributed system provided by an embodiment of this specification;
[0029] Figure 4 It is a schematic diagram of a processing process of a method for requesting link monitoring provided by an embodiment of this specification;
[0030] Figure 5 It is a structural diagram of a request link monitoring device provided by an embodiment of this specification;
[0031] Figure 6 It is a structural block diagram of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION
[0032] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.
[0033] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0034] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0035] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0036] First, the terms involved in one or more embodiments of this specification are explained.
[0037] Microservice architecture: is a design pattern that decomposes an application into a set of small, independent services, each of which implements a specific function and communicates through a well-defined API (Application Programming Interface). This architectural style promotes modularity, making applications easier to understand, develop, test, and maintain. Microservices can be deployed, expanded, and upgraded independently, which helps improve the flexibility and performance of the system. The application field of microservice development is very wide, and it is suitable for software systems that require high availability, scalability, and rapid iterative updates.
[0038] Apache SkyWalking: is an application performance monitoring (APM) platform and observability analysis platform designed for microservices, cloud native and containerized (Docker, Kubernetes, Mesos) architectures. It provides an integrated solution for distributed tracing, service mesh telemetry analysis, metric aggregation and visualization.
[0039] Jaeger: is an open source distributed tracing platform designed to help developers monitor and solve problems in applications based on microservice architecture. The core value of Jaeger lies in its ability to visualize and analyze request paths distributed among multiple microservices. To achieve this, Jaeger provides a complete set of tool chains.
[0040] Zipkin: is an open source distributed tracing system designed to help developers collect and query latency data in microservice architectures. It provides strong support for understanding and optimizing the performance of complex distributed systems, brings observability and transparency to microservice architectures, and enables developers to manage and optimize complex distributed systems more effectively. Zipkin is very suitable for applications that use microservice architectures, especially when it is necessary to monitor and optimize the performance of inter-service communication.
[0041] OpenTelemetry: is an observability framework that aims to provide a set of standardized tools, APIs, and SDKs (Software Development Kits) to help developers collect and transmit application telemetry data (such as tracing, metrics, and logs) to better understand the performance and behavior of their systems. The goal of OpenTelemetry is to create a unified ecosystem so that telemetry data between different services can be consistently generated, collected, and reported, and can be integrated with a variety of monitoring and visualization tools.
[0042] Java Agent: Also known as bytecode Agent, it is a special type of Java program and a core technology in the Java language. It allows developers to insert custom Java code during the running of Java applications without modifying the application source code, thereby achieving some specific functions, such as monitoring, debugging, code analysis, performance optimization, etc. Java Agent is widely used in performance monitoring, logging, security checks, hot fixes and other fields.
[0043] Distributed Tracing: A method for monitoring and analyzing the flow of requests in a distributed system. It can help developers understand the flow of requests between different services. In a microservice architecture, a single user request may pass through multiple independently deployed processing nodes, each of which may call other nodes or resources such as databases. In order to ensure the performance and reliability of distributed systems, it is crucial to understand the complete path of these requests and their processing in each node. Distributed Tracing records the life cycle of a request by passing a unique request identifier (i.e., traceID) between services, allowing developers to track the path of each request in the system and identify performance bottlenecks, errors, and other potential problems. Typically, a trace request consists of several spans, and different requests have different traceIDs.
[0044] Trace: Identifies a link tracing request, representing a complete request lifecycle, starting from the initial client request until the final result is returned to the client. A trace may span multiple nodes in a distributed system. A trace has a unique traceID and consists of multiple spans.
[0045] Trace ID: is a key concept in the link tracking system. It is a globally unique identifier that identifies the complete call path of a request initiated from a client in the entire distributed system. Through Trace ID, we can associate all operation logs, performance data and other information generated by the same request between different services to form a complete call chain, which is convenient for troubleshooting and performance analysis.
[0046] Span: In a distributed system, Span is the smallest unit of work in the tracking request processing process. It is used to represent an execution fragment of a request. Each Span represents a specific operation or task, such as calling a database, initiating an HTTP request, executing a piece of code logic, a database query, or a remote service call. Span contains information such as timestamps, event names, attribute tags, etc., and can be nested to form parent-child relationships to describe complex causal chains. It is a basic component for building a complete trace record (Trace). They are connected to each other through parent-child relationships to form a directed acyclic graph (DAG), which describes the flow of requests between different services.
[0047] It should be noted that in the field of microservice development and application, observability usually refers to the monitorability, traceability and diagnosability of the system, which means that the system can be effectively monitored and investigated to quickly discover and solve problems. Specifically, observability includes system logs, indicators, traces and events, which can help developers and operation and maintenance personnel monitor the status, performance and behavior of the system and find potential problems.
[0048] In actual implementation, the observability solution can adopt a client / server architecture. The client is responsible for executing service requests, collecting request execution data and reporting it to the server. The server manages and analyzes a large number of request links by processing and storing request execution data. The backend services that need to be relied on are complex and large, including data reporting, streaming processing, and big data storage. The heavyweight backend services not only have high resource overhead, but also are cumbersome to deploy. In addition, the protocol reported by the client cannot be changed dynamically to adapt to different server implementations.
[0049] One implementation method is to achieve observability of request links in distributed systems through tools such as Skywalking, Jaeger, Zipkin, and OpenTelemetry. The above tools are all client / server architectures. Request execution data is collected through the client and reported to the server for processing and storage. The client / server architecture has high performance requirements for the server, and the deployment resource overhead is large. The server bears too much traffic pressure and is the only entrance for observability. Once the server goes down, observability will be unavailable. In addition, the clients of these solutions only support their own protocols and cannot be adapted to different servers. Cloud service providers often need to adapt to different types of tenants' data collection centers (that is, servers). They cannot adapt to the protocol and need to replace the client according to the protocol type, which brings additional deployment costs.
[0050] It is worth noting that in certain scenarios, more attention is paid to how to reduce resource dependence and deployment difficulty. The embodiment of this specification provides a request link monitoring method, which is a lightweight link tracking observable solution. It distributes the link monitoring task to each node in the distributed system, and supports working without a data collection center (that is, without a server). Unlike the observable solution of the Client / Server architecture, the node is responsible for both data reporting and data collection and processing, providing query services for request links, and providing client-based request link monitoring. It does not require the deployment of external server-side components to achieve request link observability, reducing resource dependence and environmental deployment difficulty. In addition, the client can adapt to different data reporting protocols, support dynamic switching of protocols, and flexibly switch the reporting protocol and reporting address of link monitoring. It can not only complete the data collection and query of request link monitoring in a self-consistent manner, but also report the data of the request link to an external data collection center.
[0051] In this specification, a request link monitoring method is provided. This specification also relates to a request link monitoring device, a distributed system, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.
[0052] See also Figure 1 , Figure 1 A flowchart of a method for requesting link monitoring provided according to an embodiment of the present specification is shown, which is applied to a target node of a distributed system and specifically includes the following steps.
[0053] Step 102: In response to the target request, execute the target request to generate a corresponding request execution fragment.
[0054] The distributed system may be a microservice architecture, and the target node may be any application under the microservice architecture, that is, the target node may be any node of the distributed system, such as an entry node or any downstream node. The target request may be any service request initiated by the user end, such as a processing request initiated by the development end during the development and debugging phase.
[0055] It should be noted that in a distributed system, a single service request may be processed by multiple independently deployed nodes, and each node may call other nodes or resources such as databases. In order to ensure the performance and reliability of the distributed system, it is crucial to understand the complete chain of these requests and their processing in each node.
[0056] In one implementation, if the target node is an entry node, it can receive a target request initiated by a user terminal; in another implementation, if the target node is any downstream node, it can receive a target request transmitted by an upstream node of the target node.
[0057] In actual implementation, Java Agent can be mounted in each target node of the distributed system to perform bytecode enhancement. When the target request reaches the entry node (the first node where Java Agent is mounted), the target request will be intercepted by the bytecode mounted in the target node, and a corresponding target link identifier will be generated for the target request. When the target request is executed at the entry node, the first request execution fragment is generated. The request execution fragment is the smallest working unit for executing the target request, that is, a request execution fragment is a Span.
[0058] It should be noted that the Java Agent bytecode can be used to implement the target node application, which can intercept and process the target request in the target node. When the Java Agent is mounted into the target node, the target node bytecode will be enhanced, and the specific functions related to the target request will be identified, and the custom logic will be inserted. The inserted custom logic includes but is not limited to: initializing the generation of the request execution fragment (span) before the function, and ending the request execution fragment (span) after the function is executed or when an exception occurs and storing it in the memory.
[0059] Java Agent is a special type of Java program that allows monitoring, debugging, performance analysis or enhancement of applications at runtime without modifying the source code of the application. Java Agent is mainly implemented through the API provided by the java.lang.instrument package, and can be dynamically loaded at startup or during runtime. Java Agent can dynamically modify the bytecode of a class through the registered ClassFileTransformer implementation, which means that the target request can be intercepted and modified before or after it is loaded into the node, such as inserting additional logging records, adding performance monitoring points, etc. Depending on the timing of loading, Java Agent can be divided into two main types, namely, startup agent and runtime agent. The embodiment of this specification adopts startup agent. The startup agent (Premain Agent) agent is loaded at startup and runs before the main method of the application is executed. It is usually used to initialize certain global states or set environment configurations, such as initializing the logging framework, implanting monitoring code, etc.
[0060] In actual implementation, the target node can respond to the target request and execute the corresponding method. When an operation of the target request starts, a new request execution fragment (Span) is created. During the life cycle of the request execution fragment (Span), new tags, log entries or other related information may be continuously added to enrich the context of the request execution fragment (Span). When the operation is completed, the request execution fragment (Span) is correctly closed, and its duration and final status are set. All data in the request execution fragment (Span) will be packaged for subsequent request link monitoring.
[0061] In addition, in a complex distributed system, a single target request may trigger a call chain between multiple nodes. In order to accurately reflect these interactions, a parent-child relationship can be established between request execution fragments (Spans). The parent execution fragment (also known as the root span) corresponds to the entry point where the target request first enters the distributed system. The child execution fragment (also known as the child root span) is recorded as a child execution fragment. The child execution fragment can have multiple siblings, but only one direct parent execution fragment. In this way, the request execution fragment (Span) forms a tree structure, which clearly shows the request chain of the target request in the entire distributed system. In other words, the same target request may generate multiple request execution fragments (spans) during the processing of the distributed system. The multiple request execution fragments are in a parent-child relationship. For example, when the target request executes a method in node A, span_1 is generated. When node A calls a method in node B, span_2 is generated. Then span_1 is the parent execution fragment of span_2.
[0062] Step 104: Obtain a target link identifier and target reporting information of the target request, wherein the target link identifier and target reporting information are based on the ingress node configuration.
[0063] It should be noted that the target link identifier is a globally unique identifier of the target request, which is used to identify the complete call link of the target request from the user end to the entire distributed system, such as the target link identifier is Trace ID. The target reporting information is configured for the target request at the entry node, which is used to specify the reporting method of the request link data corresponding to the target request.
[0064] In an optional implementation of this embodiment, the target node is an entry node, and obtaining the target link identifier and target reporting information of the target request includes:
[0065] Generate a corresponding target link identifier for the target request;
[0066] In response to the reporting information configuration instruction, configure the target reporting information corresponding to the target request, wherein the target reporting information includes a target reporting mode, a target reporting endpoint and / or a target reporting protocol, the target reporting endpoint is a reporting endpoint corresponding to the target reporting mode, and the target reporting mode is a reporting mode currently configured by the entry node in at least one reporting mode.
[0067] In actual implementation, when the target request reaches the entry node, the Java Agent mounted on the entry node can intercept the target request and generate a globally unique identifier Trace ID for the target request as the target link identifier. In other words, when a target request enters the distributed system, it will be assigned a target link identifier (Trace ID). When the target request is passed to any downstream node in the distributed system, this target link identifier (Trace ID) will be passed along with it to ensure that each request execution fragment (Span) can belong to the same target link identifier (Trace ID).
[0068] In addition, when the Java Agent mounted on the entry node is started, the corresponding reporting information can also be specified through the reporting information configuration instruction, such as configuring the reporting mode, reporting protocol and / or reporting endpoint.
[0069] It should be noted that the reporting mode may include summary reporting mode, recursive reporting mode and data collection center reporting mode, etc. The summary reporting mode means that all downstream nodes in the distributed system, except the entry node, report the request link data to the entry node. At this time, the target reporting endpoint is the service address of the entry node; the recursive reporting mode means that each node in the distributed system summarizes the request link data generated by itself and the request link data reported by the downstream nodes, and then reports them to its own direct upstream node. At this time, the target reporting endpoint is the service address of the data collector of the direct upstream node of the target node; the data collection center reporting mode means that each node in the distributed system reports the request link data generated by itself to the data collection center configured at the entry node. At this time, the target reporting endpoint is the service address of the data collection center.
[0070] In the embodiments of the present specification, reporting information such as the target reporting mode, target reporting endpoint and / or target reporting protocol corresponding to the target request can be specified at the entry node, and the data reporting mode, reporting endpoint and reporting protocol of the request link can be dynamically adjusted. Multiple reporting modes and reporting protocols are supported. The collection and reporting of the request link data can be completed self-consistently in the distributed system, and the request link data can be reported to an external data collection center. It can be flexibly deployed as needed and different reporting modes and reporting protocols can be switched, so as to flexibly report the request link data to the corresponding endpoint, providing good scalability. While providing the operating mode of the distributed architecture, it also allows customized reporting to an external data collection center to be compatible with the client / server architecture.
[0071] It should be noted that, for the entry node, the corresponding target link identifier and target reporting information can be configured for the target request, so as to facilitate reporting the request execution fragment corresponding to the target link identifier according to the requirements of the target reporting information. In addition, when the target request processing is completed, the entry node can also send the target request, target link identifier and target reporting information to the direct downstream node of the entry node, that is, the entry node continues to call its downstream node to execute the target request, and the downstream node executes the target request, and when the target request processing is completed, it continues to send the target request, target link identifier and target reporting information to the next direct downstream node to realize the call processing of the target request; for any downstream node except the entry node, it can obtain the target link identifier and target reporting information sent by it from the upstream node, so as to facilitate the storage of the corresponding request execution fragment based on the target link identifier, and facilitate reporting the request execution fragment corresponding to the target link identifier according to the requirements of the target reporting information.
[0072] In an optional implementation of this embodiment, the target node is any downstream node, and obtaining the target link identifier and target reporting information of the target request includes:
[0073] Obtain link information sent by the direct upstream node of the target node;
[0074] The target link identifier and target reporting information requested by the target are obtained by parsing the link information.
[0075] In actual implementation, when the target request needs to cross different nodes, the entry node or any upstream node can pass the target request and the link information of the target request to the direct downstream node through remote calls, such as HTTP (HyperText Transfer Protocol) / RPC (Remote Procedure Call) calls, etc. The target node can receive the link information sent by its direct upstream node, parse the link information to obtain the target link identifier and target reporting information of the target request, and store and report the relevant data of the target request link.
[0076] In the embodiments of the present specification, if the target node is an entry node, it can obtain the target link identifier and target reporting information configured for the target request. If the target node is any downstream node, it can obtain the target link identifier and target reporting information transmitted by its direct upstream node. In the distributed system, each target node can transmit the target link identifier and target reporting information while transmitting the target request, so that each target node can subsequently identify the request execution fragment corresponding to the target request through the target link identifier, ensure that each request execution fragment (Span) of the target request can belong to the same target link identifier (Trace ID), and report according to the defined target reporting information, so as to realize link monitoring of the target request.
[0077] Step 106: Store the target link identifier and the obtained request execution fragment in correspondence, and determine whether to report the corresponding request execution fragment according to the target reporting information. If so, report the target link identifier and the corresponding request execution fragment.
[0078] In actual implementation, when the target request processing is completed, the target node can obtain the request execution fragment obtained by executing the corresponding method of the target request on itself, and can store the target link identifier and the obtained request execution fragment accordingly, and can also determine whether to report the corresponding request execution fragment based on the target reporting information configured at the entry node. If reported, the target link identifier and the corresponding request execution fragment are reported, so as to summarize and store the request execution fragments corresponding to the target link identifier.
[0079] In addition, the obtained request execution fragments may include not only the request execution fragments generated by the target node itself executing the target request, but also the request execution fragments reported by the downstream nodes of the target node. The target node aggregates and stores the two to provide query services for the target request link.
[0080] In an optional implementation of this embodiment, the target reporting information includes a target reporting mode, a target reporting endpoint and a target reporting protocol, the target reporting endpoint is a reporting endpoint corresponding to the target reporting mode, and the target reporting mode is a reporting mode currently configured by the entry node in at least one reporting mode;
[0081] Determine whether to report the corresponding request execution fragment according to the target reporting information, and if so, report the target link identifier and the corresponding request execution fragment, including:
[0082] Determine whether to report the corresponding request execution fragment according to the target reporting mode;
[0083] If reported, the request execution fragment is converted according to the target reporting protocol, and the converted request execution fragment and the target link identifier are reported to the target reporting endpoint.
[0084] It should be noted that the reporting mode may include summary reporting mode, recursive reporting mode and data collection center reporting mode, etc., and the reporting operation of the target node is different under different reporting modes. In the case where the target reporting mode configured at the entry node is the summary reporting mode, the entry node does not need to report the request execution fragment generated by itself, and all downstream nodes except the entry node need to report the request execution fragment generated by itself to the entry node; in the case where the target reporting mode configured at the entry node is the recursive reporting mode, the entry node does not need to report the request execution fragment generated by itself, and all downstream nodes except the entry node need to summarize the request execution fragment generated by itself and the request execution fragment reported by its direct downstream node and report it to its direct upstream node; in the case where the target reporting mode configured at the entry node is the data collection center reporting mode, each node in the distributed system (including the entry node and all downstream nodes except the entry node) needs to report the request execution fragment generated by itself to the corresponding data collection center.
[0085] In actual implementation, the target node is any node in the distributed system. The target node can determine whether it needs to report the corresponding request execution fragment according to the target reporting mode. If it does not need to report, the reporting operation will not be performed; if it needs to report, the request execution fragment will be converted according to the target reporting protocol, and the converted request execution fragment and target link identifier will be reported to the target reporting endpoint.
[0086] It should be noted that the target node can also be configured with a reporting thread and an adapter. When the Java Agent mounted on the target node is started, bytecode enhancement will be performed and components such as the adapter will be started. The reporting thread is responsible for periodically obtaining completed request execution fragments from the memory and reporting them to the target reporting endpoint. When each request execution fragment is generated, it can be bound to a target reporting protocol and target reporting endpoint to which it belongs, that is, the target reporting protocol and target reporting endpoint configured for the target request. The reporting thread will report according to different reporting protocols and reporting endpoints. The adapter is used to convert different data reporting protocols. When reporting a request execution fragment, the reporting thread will perform data protocol conversion through the adapter.
[0087] In specific implementation, if the target node determines that it needs to perform a reporting operation, the Java Agent mounted on the target node can send each request execution fragment corresponding to the target request to the reporting thread, and inform the reporting thread of the corresponding target reporting protocol and target reporting endpoint. After the reporting thread obtains the data of each request execution fragment corresponding to the target request, it will call the adapter according to the target reporting protocol to perform data protocol conversion, and send the converted request execution fragment to the corresponding target reporting endpoint. Among them, each request execution fragment corresponding to the target request can include the request execution fragment generated by the target node itself executing the target request, and can also include the request execution fragment reported by its downstream node.
[0088] In the embodiments of the present specification, the reporting operations of each node in the distributed system are different for different reporting modes. Therefore, the target node in the distributed system can first determine whether it needs to report the request execution fragment of the target request based on the configured target reporting mode. When reporting is required, the data protocol can be converted through an adapter and then reported to the corresponding endpoint, thereby supporting multiple data reporting protocols and flexibly switching data reporting protocols and reporting endpoints.
[0089] In an optional implementation of this embodiment, the target node is any downstream node, and the method further includes:
[0090] Receive the fragment identifier of the parent execution fragment of the target request sent by the direct upstream node;
[0091] Accordingly, the converted request execution fragment and target link identifier are reported to the target reporting endpoint, including:
[0092] The converted request execution fragment, the target link identifier and the fragment identifier of the parent execution fragment are reported to the target reporting endpoint, wherein the fragment identifier of the parent execution fragment is used to instruct the target reporting endpoint to associate and store each request execution fragment corresponding to the target link identifier.
[0093] It should be noted that for the various request execution fragments of the same target request, there is a parent-child relationship between them. The upstream node needs to pass the fragment identifier of the parent execution fragment to the downstream node. When the downstream node reports the request execution fragment, it needs to carry the current request execution fragment and the fragment identifier of the parent execution fragment of the upstream node, so as to facilitate the storage of the corresponding request execution fragments according to the parent-child relationship for the target link identifier.
[0094] Therefore, in actual implementation, for any downstream node except the entry node, in addition to receiving the target request, target link identifier, and target reporting information sent by the direct upstream node, it can also receive the fragment identifier of the parent execution fragment of the target request sent by the direct upstream node, and the parent execution fragment is the request execution fragment generated by the direct upstream node executing the target request. When reporting data, the target node can report the converted request execution fragment, the target link identifier, and the fragment identifier of the parent execution fragment to the target reporting endpoint. The target reporting endpoint can associate and store each request execution fragment corresponding to the target link identifier based on the target link identifier, the fragment identifier of the parent execution fragment, and the converted request execution fragment generated by the current target node.
[0095] For example, for traceID1, node 1 generates span_1, node 1 calls node 2, and sends the parent execution fragment's fragment identifier span_1 to node 2. Node 2 executes the target request to generate span_2. At this time, node 2 can report the parent execution fragment's fragment identifier span_1, the target link identifier traceID1, and the self-generated request execution fragment span_2 to the target reporting endpoint; node 2 calls node 3, and sends the parent execution fragment's fragment identifier span_2 to node 3. Node 3 executes the target request to generate span_3. At this time, node 3 can report the parent execution fragment's fragment identifier span_2, the target link identifier traceID1, and the self-generated request execution fragment span_3 to the target reporting endpoint. At this time, the target reporting endpoint can determine that the target link identifier traceID1 includes span_1, span_2, and span_3, and span_1 and span_2 are in a parent-child relationship, and span_2 and span_3 are in a parent-child relationship.
[0096] In an embodiment of the present specification, the fragment identifier of the parent execution fragment can be transmitted between different nodes, so that based on the parent-child relationship of the request execution fragments, the various request execution fragments of a target request can be associated and stored, so that the various request execution fragments of the target request belong to the same target link identifier according to the calling relationship, thereby realizing the monitoring of the complete calling link of the target request.
[0097] Of course, in actual implementation, the direct upstream node of the target node may not send the fragment identifier of the parent execution fragment. At this time, the target node can report the converted request execution fragment and the target link identifier to the target reporting endpoint. The target reporting endpoint queries the node call status of the target request and associates and stores each request execution fragment corresponding to the target link identifier. The embodiments of this specification do not limit this.
[0098] In an optional implementation of this embodiment, the target reporting mode is a summary reporting mode, the target reporting endpoint is an entry node; the target node is an entry node, and the target link identifier and the obtained request execution fragment are stored correspondingly, including:
[0099] Obtain the target link identifier and the corresponding request execution fragment reported by each downstream node;
[0100] The target link identifier and the first request execution fragment are stored correspondingly, wherein the first request execution fragment includes the request execution fragment generated by the entry node executing the target request, and the request execution fragment reported by each downstream node for the target link identifier.
[0101] It should be noted that when the target reporting mode configured at the entry node is the summary reporting mode, the entry node does not need to report the request execution fragments generated by itself. All downstream nodes except the entry node need to report the request execution fragments generated by themselves to the entry node. At this time, the target reporting endpoint is the entry node.
[0102] In actual implementation, for each downstream node except the entry node, that is, when the target node is any downstream node, it is necessary to report the target link identifier and the request execution fragment generated by itself to the entry node. If the target node also receives the fragment identifier of the parent execution fragment issued by its direct upstream node, it can also report the fragment identifier of the parent execution fragment to the target reporting endpoint; for the entry node, that is, when the target node is the entry node, it is necessary to obtain the target link identifier and the corresponding request execution fragment reported by each downstream node, and then store the target link identifier and the first request execution fragment in correspondence. The first request execution fragment includes the request execution fragment generated by the entry node executing the target request, and the request execution fragment reported by each downstream node for the target link identifier. In addition, if the entry node also receives the fragment identifier of the parent execution fragment reported by each downstream node, it can also associate and store the request execution fragments of the target link identifier according to the parent-child relationship.
[0103] In specific implementation, each node in the distributed system may also be configured with a data collector, through which the target link identifier and the corresponding request execution fragment reported by each downstream node are obtained.
[0104] For example, for the summary reporting mode, node 1 (entry node) generates a target link identifier traceID1 for the target request, executes the target request to generate request execution fragment 1, and the fragment identifier of request execution fragment 1 is span_1. Node 1 calls node 2 and sends the target request, target link identifier traceID1, target reporting mode is the summary reporting mode, target reporting endpoint is the entry node, target reporting protocol, and parent execution fragment fragment identifier span_1 to node 2. Node 2 executes the target request to generate request execution fragment 2, and the fragment identifier of request execution fragment 2 is span_2. Node 2 reports the target link identifier traceID1 and parent execution fragment to the entry node. The segment identifier span_1, the request execution segment 2 generated by itself and the corresponding segment identifier span_2; node 2 calls node 3, sends the target request, the target link identifier traceID1, the target reporting mode is the summary reporting mode, the target reporting endpoint is the entry node, the target reporting protocol, and the fragment identifier span_2 of the parent execution segment to node 3, node 3 executes the target request to generate the request execution segment 3, the fragment identifier of the request execution segment 3 is span_3, node 3 reports the target link identifier traceID1, the fragment identifier span_2 of the parent execution segment, the request execution segment 3 generated by itself and the corresponding fragment identifier span_3 to the entry node. At this time, the entry node can summarize the request execution fragments obtained for the target link identifier traceID1, and store the request execution fragment 1 identified by span_1, the request execution fragment 2 identified by span_2, and the request execution fragment 3 identified by span_3 under the target link identifier traceID1. The request execution fragment 1 identified by span_1 and the request execution fragment 2 identified by span_2 are in a parent-child relationship, and the request execution fragment 2 identified by span_2 and the request execution fragment 3 identified by span_3 are in a parent-child relationship.
[0105] In the embodiments of the present specification, for the summary reporting mode, each downstream node except the entry node can report the target link identifier and the corresponding generated request execution fragment to the entry node. The entry node summarizes and stores the request execution fragment generated by its own execution of the target request and the request execution fragment reported by each downstream node for the target link identifier. The entry node can be responsible for executing the target request and generating the corresponding request execution fragment, and can also be responsible for data collection and obtaining the request execution fragment reported by each downstream node for the target link identifier. The entry node implements link monitoring corresponding to the target request, and link observability can be completed without the need for an external data collection center, and there is no need to forcibly rely on an external data collection center, thereby reducing external resource dependence.
[0106] In an optional implementation of this embodiment, the target reporting mode is a recursive reporting mode, the target reporting endpoint is a direct upstream node of the target node, and the target node is any downstream node except the entry node; the method further includes:
[0107] Obtain the target link identifier and the corresponding request execution fragment reported by the direct downstream node of the target node;
[0108] The target link identifier and the second request execution fragment are stored correspondingly, wherein the second request execution fragment includes the request execution fragment generated by the target node executing the target request, and the request execution fragment reported by the direct downstream node of the target node for the target link identifier;
[0109] Accordingly, the converted request execution fragment and target link identifier are reported to the target reporting endpoint, including:
[0110] The converted second request execution fragment and the target link identifier are reported to the direct upstream node of the target node.
[0111] It should be noted that when the target reporting mode configured at the entry node is the recursive reporting mode, the entry node does not need to report the request execution fragments generated by itself. All downstream nodes except the entry node need to aggregate the request execution fragments generated by itself and the request execution fragments reported by its direct downstream nodes and report them to its direct upstream node.
[0112] In actual implementation, when the target node is an entry node, the target link identifier and the corresponding request execution fragment reported by its direct downstream node can be obtained, and the target link identifier and the second request execution fragment can be stored correspondingly; when the target node is any downstream node other than the entry node, the target link identifier and the corresponding request execution fragment reported by the direct downstream node of the target node can be obtained, the target link identifier and the second request execution fragment can be stored correspondingly, and the target link identifier and the corresponding second request execution fragment can be reported to the direct upstream node.
[0113] In the specific implementation, for the recursive reporting mode, the request execution fragments are reported to the upstream nodes layer by layer starting from the most downstream node of the distributed system until the entry node, and each request execution fragment corresponding to the target request can be obtained.
[0114] For example, for the recursive reporting mode, node 1 (entry node) generates a target link identifier traceID1 for the target request, executes the target request to generate request execution fragment 1, and the fragment identifier of request execution fragment 1 is span_1. Node 1 calls node 2, and sends the target request, target link identifier traceID1, target reporting mode is the summary reporting mode, target reporting endpoint is the entry node, target reporting protocol, and fragment identifier span_1 of the parent execution fragment to node 2. Node 2 executes the target request to generate request execution fragment 2, and the fragment identifier of request execution fragment 2 is span_2; node 2 calls node 3, and sends the target request, target link identifier traceID1, target reporting mode is the summary reporting mode, target reporting endpoint is the entry node, target reporting protocol, and fragment identifier span_2 of the parent execution fragment to node 3. Node 3 executes the target request to generate request execution fragment 3, and the fragment identifier of request execution fragment 3 is span_3.
[0115] Node 3 reports the target link identifier traceID1, the fragment identifier span_2 of the parent execution fragment, the request execution fragment 3 generated by itself and the corresponding fragment identifier span_3 to node 2. Node 2 stores traceID1 including the request execution fragment 2 identified by span_2 and the request execution fragment 3 identified by span_3, and the request execution fragment 2 identified by span_2 and the request execution fragment 3 identified by span_3 are in a parent-child relationship. In addition, node 2 reports the target link identifier traceID1, the fragment identifier span_2 of the parent execution fragment, and the corresponding fragment identifier span_3 to node 1. n_1, the request execution fragment 2 and the corresponding fragment identifier span_2, the request execution fragment 3 and the corresponding fragment identifier span_3 obtained by itself, node 1 stores traceID1 including the request execution fragment 1 identified by span_1, the request execution fragment 2 identified by span_2, and the request execution fragment 3 identified by span_3, and the request execution fragment 1 identified by span_1 and the request execution fragment 2 identified by span_2 are in a parent-child relationship, and the request execution fragment 2 identified by span_2 and the request execution fragment 3 identified by span_3 are in a parent-child relationship.
[0116] In the embodiments of the present specification, for the recursive reporting mode, each downstream node except the entry node can report the target link identifier and the obtained request execution fragment to the direct upstream node. Each node can summarize and store the request execution fragment generated by its own execution of the target request and the request execution fragment reported by the direct downstream node for the target link identifier. Each node in the distributed system can be responsible for executing the target request and generating the corresponding request execution fragment, and can also be responsible for data collection and obtaining the request execution fragment reported by the direct downstream node for the target link identifier, and distributing the link monitoring of the target request to each node in the distributed system. Link observability can be completed without the need for an external data collection center, and there is no need to forcibly rely on an external data collection center, thereby reducing dependence on external resources.
[0117] In an optional implementation of this embodiment, the target reporting mode is a data collection center reporting mode, and the target reporting endpoint is a data collection end configured at the entry node; reporting the converted request execution fragment and the target link identifier to the target reporting endpoint includes:
[0118] According to the address of the data collection end, the converted request execution fragment and the target link identifier are reported to the data collection end.
[0119] It should be noted that when the target reporting mode configured at the entry node is the data collection center reporting mode, each node in the distributed system (including the entry node and other downstream nodes except the entry node) needs to report the request execution fragment generated by itself to the corresponding data collection center.
[0120] For example, for the reporting mode of the data collection center, node 1 (entry node) generates a target link identifier traceID1 for the target request, executes the target request to generate request execution fragment 1, and the fragment identifier of request execution fragment 1 is span_1. Node 1 reports the target link identifier traceID1, the request execution fragment 1 generated by itself, and the corresponding fragment identifier span_1 to the data collection end; node 1 calls node 2, sends the target request, the target link identifier traceID1, the target reporting mode is the summary reporting mode, the target reporting endpoint is the entry node, the target reporting protocol, and the fragment identifier span_1 of the parent execution fragment to node 2, node 2 executes the target request to generate request execution fragment 2, and the fragment identifier of request execution fragment 2 is span_2, node Point 2 reports the target link identifier traceID1, the fragment identifier span_1 of the parent execution fragment, the request execution fragment 2 generated by itself and the corresponding fragment identifier span_2 to the data collection end; node 2 calls node 3, and sends the target request, the target link identifier traceID1, the target reporting mode is the summary reporting mode, the target reporting endpoint is the entry node, the target reporting protocol, and the fragment identifier span_2 of the parent execution fragment to node 3. Node 3 executes the target request to generate request execution fragment 3, and the fragment identifier of request execution fragment 3 is span_3. Node 3 reports the target link identifier traceID1, the fragment identifier span_2 of the parent execution fragment, the request execution fragment 3 generated by itself and the corresponding fragment identifier span_3 to the data collection end. At this time, the data collection end can summarize the request execution fragments obtained for the target link identifier traceID1, and store the request execution fragment 1 identified by span_1, the request execution fragment 2 identified by span_2, and the request execution fragment 3 identified by span_3 under the target link identifier traceID1. The request execution fragment 1 identified by span_1 and the request execution fragment 2 identified by span_2 are in a parent-child relationship, and the request execution fragment 2 identified by span_2 and the request execution fragment 3 identified by span_3 are in a parent-child relationship.
[0121] In the embodiments of this specification, the data collection end can be customized for the data collection center reporting mode, and each node in the distributed system can report the target link identifier and the request execution fragment generated by itself to the defined data collection end, allowing customized reporting to an external data collection end to be compatible with the client / server architecture.
[0122] Step 108: In response to the query instruction, the target request execution slice corresponding to the link identifier to be queried is returned.
[0123] It should be noted that, in addition to executing the target request to generate the corresponding request execution fragment and reporting the target link identifier and the corresponding request execution fragment, the target node can also store the target link identifier and the obtained request execution fragment, and provide link query services for the target request. In other words, the target node is responsible for request processing and reporting, and can also provide query services for request links. It can directly access the target application, query the link data of the target request, and distribute the link monitoring tasks to each node in the distributed system. It can achieve observability of the request link without deploying external server-side components, and provide request link monitoring based on each node in the distributed system, reducing resource dependence and environmental deployment difficulties.
[0124] In actual applications, any node in a distributed system can provide link query services and receive query instructions initiated by the user. The query instructions can carry the identifier of the link to be queried. The target node can query and return the request execution fragment corresponding to the link identifier in the link data stored in itself, thereby realizing the requested link monitoring.
[0125] In specific implementation, each node in the distributed system is also configured with a query interface, through which a query instruction initiated by a user terminal can be received and a corresponding query result can be returned to the user terminal.
[0126] For example, Figure 2 is a schematic diagram of the architecture of a target node in a distributed system provided by an embodiment of this specification, such as Figure 2 As shown, the target node is any node in the distributed system. An Agent, i.e., a link monitoring agent, is mounted on the application of the target node. The Agent includes bytecode enhancement, an adapter, a reporting thread, a data collector, and a query interface. When the Agent is started, bytecode enhancement is performed, and components such as the adapter, data collector, and query interface are started. The reporting thread can call the adapter to perform protocol conversion on the data to be reported based on the configured target reporting protocol. The target link identifier and the corresponding request execution fragment reported by the downstream node can be collected through the data collector, and the link query service can be provided through the query interface.
[0127] In the embodiments of this specification, each node in the distributed system can provide a query service for the request link, and distribute the monitoring of the request link to each node in the distributed system, providing a client-based request link monitoring without the need to deploy server-side components, thereby reducing resource dependence and environmental deployment difficulty.
[0128] In an optional implementation of this embodiment, if the reporting mode corresponding to the link identifier to be queried is a summary reporting mode, and the target node is an entry node, returning a target request execution fragment corresponding to the link identifier to be queried in response to the query instruction includes:
[0129] In response to a query instruction, obtaining an identifier of a link to be queried carried in the query instruction;
[0130] Query and return the target request execution fragment corresponding to the link identifier to be queried, wherein the target request execution fragment includes each request execution fragment corresponding to the link identifier to be queried.
[0131] In an optional implementation of this embodiment, if the reporting mode corresponding to the link identifier to be queried is a recursive reporting mode, the returning the target request execution fragment corresponding to the link identifier to be queried in response to the query instruction includes:
[0132] In response to a query instruction, obtaining an identifier of a link to be queried carried in the query instruction;
[0133] Query the target request execution fragment corresponding to the link identifier to be queried, wherein the target request execution fragment includes the request execution fragment generated by the target node for the link identifier to be queried, the request execution fragment reported by the direct downstream node of the target node, and the fragment identifier of the parent execution fragment issued by the direct upstream node of the target node.
[0134] In actual implementation, for the summary reporting mode, each request execution fragment corresponding to the link identifier to be queried can be queried at the entry node, and the request execution fragment corresponding to the link identifier to be queried cannot be queried at other downstream nodes, and a query failure prompt can be returned. For the recursive reporting mode, at other nodes except the entry node, the request execution fragment generated by the node itself, the request execution fragment reported by the direct downstream node of the node, and the fragment identifier of the parent execution fragment issued by the direct upstream node of the node can be queried. For the data collection center reporting mode, each request execution fragment corresponding to the link identifier to be queried can only be queried at the data collection end, and the target node can return a query failure prompt.
[0135] Continuing with the above example, for the summary reporting mode, assuming that the user terminal initiates a query instruction of traceID1 to node 1, it can query and obtain the request execution fragment 1 identified by span_1, the request execution fragment 2 identified by span_2, and the request execution fragment 3 identified by span_3 under traceID1. The request execution fragment 1 identified by span_1 and the request execution fragment 2 identified by span_2 are in a parent-child relationship, and the request execution fragment 2 identified by span_2 and the request execution fragment 3 identified by span_3 are in a parent-child relationship; if the user terminal initiates a query instruction of traceID1 to node 2 or node 3, a query failure prompt is returned. For the recursive reporting mode, assuming that the user end initiates a query instruction of traceID1 to node 1, it can be queried to obtain the request execution fragment 1 identified by span_1, the request execution fragment 2 identified by span_2, and the request execution fragment 3 identified by span_3 under traceID1. The request execution fragment 1 identified by span_1 and the request execution fragment 2 identified by span_2 are in a parent-child relationship, and the request execution fragment 2 identified by span_2 and the request execution fragment 3 identified by span_3 are in a parent-child relationship; if the user end initiates a query instruction of traceID1 to node 2, it can be queried to obtain the request execution fragment 2 identified by span_2 and the request execution fragment 3 identified by span_3, and the request execution fragment 2 identified by span_2 and the request execution fragment 3 identified by span_3 are in a parent-child relationship; if the user end initiates a query instruction of traceID1 to node 2, it can be queried to obtain the request execution fragment 2 identified by span_2 and the request execution fragment 3 identified by span_3 under traceID1, and the request execution fragment 2 identified by span_2 and the request execution fragment 3 identified by span_3 are in a parent-child relationship; if the user end initiates a query instruction to node 3, it can be queried to obtain the request execution fragment 3 identified by span_3 in traceID1.
[0136] It should be noted that each node in the distributed system can provide query services for request links. Different reporting modes can correspond to different query results. It supports multiple query methods and is more flexible. There is no need to rely on the server to implement request link queries.
[0137] The embodiments of this specification provide a request link monitoring method. Different from the client / server architecture, any target node in the distributed system can report data and provide query services for the request link, distributing the monitoring of the request link to each node in the distributed system. The client-based request link monitoring does not require the deployment of server components, reducing resource dependence and environmental deployment difficulties. In addition, it can adapt to different reporting modes and data reporting protocols, support dynamic switching, and flexibly switch the reporting mode and reporting protocol of link monitoring. The distributed system can not only complete the data collection and query of the request link monitoring in a self-consistent manner, but also report the data of the request link to an external data collection center to improve compatibility.
[0138] See also Figure 3 , Figure 3A structural block diagram of a distributed system provided according to an embodiment of this specification is shown. Figure 3 As shown, the distributed system includes an entry node 302 and at least one downstream node 304;
[0139] The entry node 302 is used to respond to the target request, execute the target request to generate a corresponding request execution fragment; configure the target link identifier and target reporting information of the target request, the target link identifier is used to identify the complete call link of the target request initiated from the user end to the distributed system, and the target reporting information is used to specify the reporting method of the request link data corresponding to the target request; store the target link identifier and the obtained request execution fragment in correspondence, and determine whether to report the corresponding request execution fragment according to the target reporting information, and if so, report the target link identifier and the corresponding request execution fragment; send the target request, the target link identifier and the target reporting information to the downstream node;
[0140] The downstream node 304 is used to respond to the target request, execute the target request to generate a corresponding request execution fragment, obtain the target link identifier and target reporting information of the target request, store the target link identifier and the obtained request execution fragment in correspondence, and report the target link identifier and the corresponding request execution fragment according to the target reporting information; send the target request, the target link identifier and the target reporting information to the next downstream node;
[0141] The entry node 302 and the downstream node 304 are further configured to return a target request execution fragment corresponding to the link identifier to be queried in response to a query instruction.
[0142] The above is a schematic scheme of a distributed system of this embodiment. It should be noted that the technical scheme of the distributed system and the technical scheme of the request link monitoring method described above are of the same concept, and the details not described in detail in the technical scheme of the distributed system can be found in the description of the technical scheme of the request link monitoring method described above.
[0143] The following combination Figure 4 , taking the application of the request link monitoring method provided in this specification in the user verification scenario as an example, the request link monitoring method is further explained. Among them, Figure 4 A schematic diagram of a processing process of a request link monitoring method provided by an embodiment of this specification is shown, such as Figure 4 As shown in the figure, the distributed system is a microservice architecture corresponding to the development environment in the user verification scenario. The microservice architecture is explained by taking three development nodes in the user verification scenario as an example. Each development node includes an application and an Agent mounted on the application (that is, a link monitoring agent). The Agent includes components such as bytecode enhancement, adapter, data collector, and query interface.
[0144] The development end in the user verification scenario initiates an HTTP / RPC call request to the entry node. The link monitoring agent configured in the entry node intercepts the call request, generates the corresponding target link identifier TraceID, and configures the corresponding target reporting mode, target reporting endpoint and target reporting protocol. The corresponding call request is executed at the entry node and request execution fragment 1 is generated. The fragment identifier of request execution fragment 1 is span_1. After the execution is completed, the request execution fragment 1 is terminated.
[0145] For the data collection center reporting mode, the link monitoring agent in the entry node sends the target link identifier TraceID and the generated request execution fragment 1, and the corresponding fragment identifier span_1 to the reporting thread. The reporting thread calls the adapter, performs protocol conversion based on the target reporting protocol, and reports the converted target link identifier TraceID and the generated request execution fragment 1, and the corresponding fragment identifier span_1 to the corresponding data collection center.
[0146] The entry node transmits the HTTP / RPC call request to the downstream node 1 through remote calls such as HTTP / RPC, and can also transmit the target link identifier TraceID, the fragment identifier span_1 of the parent execution fragment, the target reporting mode, the target reporting endpoint and the target reporting protocol. The link monitoring agent in the downstream node 1 can intercept the call request, obtain the transmitted target link identifier TraceID, the fragment identifier span_1 of the parent execution fragment, the target reporting mode, the target reporting endpoint and the target reporting protocol, and start its internal call processing and generate a new request execution fragment 2, the fragment identifier of the request execution fragment 2 is span_2.
[0147] For the data collection center reporting mode or the summary reporting mode, the link monitoring agent in the downstream node 1 sends the target link identifier TraceID and the generated request execution fragment 2, and the corresponding fragment identifier span_2 to the reporting thread. The reporting thread calls the adapter, performs protocol conversion based on the target reporting protocol, and reports the converted target link identifier TraceID and the generated request execution fragment 2, and the corresponding fragment identifier span_2 to the corresponding data collection center or the data collector of the entry node.
[0148] For the recursive reporting mode, the downstream node 1 sends the target link identifier TraceID of the call request, the fragment identifier span_1 of the parent execution fragment, the currently generated request execution fragment 2 and the corresponding fragment identifier span_2, the request execution fragment 3 and the corresponding fragment identifier span_3 reported by the downstream node 2 to the data collector of the downstream node 1, and other information to the reporting thread. The reporting thread calls the adapter, performs protocol conversion based on the target reporting protocol, and reports the converted target link identifier TraceID, the fragment identifier span_1 of the parent execution fragment, the currently generated request execution fragment 2 and the corresponding fragment identifier span_2, the request execution fragment 3 and the corresponding fragment identifier span_3 reported by the downstream node 2 to the data collector of the downstream node 1, and other information to the data collector of the entry node.
[0149] Downstream node 1 transmits the HTTP / RPC call request to downstream node 2 through remote calls such as HTTP / RPC, and can also transmit the target link identifier TraceID, the fragment identifier span_2 of the parent execution fragment, the target reporting mode, the target reporting endpoint, and the target reporting protocol. The link monitoring agent in downstream node 2 can intercept the call request, obtain the transmitted target link identifier TraceID, the fragment identifier of the parent execution fragment, the target reporting mode, the target reporting endpoint, and the target reporting protocol, and start its internal call processing and generate a new request execution fragment 3, the fragment identifier of the request execution fragment 3 is span_3.
[0150] For the data collection center reporting mode or the summary reporting mode, the link monitoring agent in the downstream node 2 sends the target link identifier TraceID and the generated request execution fragment 3 and the corresponding fragment identifier span_3 to the reporting thread. The reporting thread calls the adapter, performs protocol conversion based on the target reporting protocol, and reports the converted target link identifier TraceID and the generated request execution fragment 3 and the corresponding fragment identifier span_3 to the data collector of the corresponding data collection center or entry node.
[0151] For the recursive reporting mode, the downstream node 2 sends the target link identifier TraceID of the call request, the fragment identifier span_2 of the parent execution fragment, the currently generated request execution fragment 3 and the corresponding fragment identifier span_3 and other information to the reporting thread. The reporting thread calls the adapter, performs protocol conversion based on the target reporting protocol, and reports the converted target link identifier TraceID, the fragment identifier span_2 of the parent execution fragment, the currently generated request execution fragment 3 and the corresponding fragment identifier span_3 and other information to the data collector of the downstream node 1.
[0152] At any time, the development end (or other user end) in the user verification scenario can initiate a query instruction of a request link to the query interface in the data collection center, the entry node, the downstream node 1 or the downstream node 2.
[0153] Corresponding to the above method embodiment, this specification also provides a request link monitoring device embodiment, Figure 5 A schematic diagram of the structure of a request link monitoring device provided by an embodiment of the present specification is shown, which is applied to a target node of a distributed system, such as Figure 5 As shown, the device comprises:
[0154] A generating module 502 is configured to execute the target request to generate a corresponding request execution segment in response to the target request;
[0155] The acquisition module 504 is configured to acquire a target link identifier and target reporting information of the target request, wherein the target link identifier and the target reporting information are configured based on the entry node, the target link identifier is used to identify the complete call link of the target request initiated from the user end to the distributed system, and the target reporting information is used to specify a reporting method of the request link data corresponding to the target request;
[0156] The reporting module 506 is configured to store the target link identifier and the obtained request execution fragment in correspondence, and determine whether to report the corresponding request execution fragment according to the target reporting information, and if so, report the target link identifier and the corresponding request execution fragment;
[0157] The query module 508 is configured to return the target request execution segment corresponding to the link identifier to be queried in response to the query instruction.
[0158] Optionally, the target reporting information includes a target reporting mode, a target reporting endpoint and a target reporting protocol, the target reporting endpoint is a reporting endpoint corresponding to the target reporting mode, and the target reporting mode is a reporting mode currently configured by the entry node in at least one reporting mode;
[0159] The reporting module 506 is further configured to:
[0160] Determine whether to report the corresponding request execution fragment according to the target reporting mode;
[0161] If reported, the request execution fragment is converted according to the target reporting protocol, and the converted request execution fragment and the target link identifier are reported to the target reporting endpoint.
[0162] Optionally, the target node is any downstream node, and the method further includes a first receiving module configured to:
[0163] Receive the fragment identifier of the parent execution fragment of the target request sent by the direct upstream node;
[0164] Accordingly, the reporting module 506 is further configured to:
[0165] The converted request execution fragment, the target link identifier and the fragment identifier of the parent execution fragment are reported to the target reporting endpoint, wherein the fragment identifier of the parent execution fragment is used to instruct the target reporting endpoint to associate and store each request execution fragment corresponding to the target link identifier.
[0166] Optionally, the target reporting mode is a summary reporting mode, the target reporting endpoint is an entry node, the target node is an entry node, and the reporting module 506 is further configured as follows:
[0167] Obtain the target link identifier and the corresponding request execution fragment reported by each downstream node;
[0168] The target link identifier and the first request execution fragment are stored correspondingly, wherein the first request execution fragment includes the request execution fragment generated by the entry node executing the target request, and the request execution fragment reported by each downstream node for the target link identifier.
[0169] Optionally, the target reporting mode is a recursive reporting mode, the target reporting endpoint is a direct upstream node of the target node, and the target node is any downstream node except the entry node; the device further includes a first storage module, which is configured to:
[0170] Obtain the target link identifier and the corresponding request execution fragment reported by the direct downstream node of the target node;
[0171] The target link identifier and the second request execution fragment are stored correspondingly, wherein the second request execution fragment includes the request execution fragment generated by the target node executing the target request, and the request execution fragment reported by the direct downstream node of the target node for the target link identifier;
[0172] Accordingly, the reporting module 506 is further configured to:
[0173] The converted second request execution fragment and the target link identifier are reported to the direct upstream node of the target node.
[0174] Optionally, the target reporting mode is a data collection center reporting mode, and the target reporting endpoint is a data collection end configured by the entry node; the reporting module 506 is further configured as follows:
[0175] According to the address of the data collection end, the converted request execution fragment and the target link identifier are reported to the data collection end.
[0176] Optionally, the target node is any downstream node, and the acquisition module 504 is further configured to:
[0177] Obtain link information sent by the direct upstream node of the target node;
[0178] The target link identifier and target reporting information requested by the target are obtained by parsing the link information.
[0179] Optionally, the target node is an entry node, and the acquisition module 504 is further configured to:
[0180] Generate a corresponding target link identifier for the target request;
[0181] In response to the reporting information configuration instruction, configure the target reporting information corresponding to the target request, wherein the target reporting information includes a target reporting mode, a target reporting endpoint and / or a target reporting protocol, the target reporting endpoint is a reporting endpoint corresponding to the target reporting mode, and the target reporting mode is a reporting mode currently configured by the entry node in at least one reporting mode.
[0182] Optionally, if the reporting mode corresponding to the link identifier to be queried is a summary reporting mode, and the target node is an entry node; the query module 508 is further configured to:
[0183] In response to a query instruction, obtaining an identifier of a link to be queried carried in the query instruction;
[0184] Query and return the target request execution fragment corresponding to the link identifier to be queried, wherein the target request execution fragment includes each request execution fragment corresponding to the link identifier to be queried.
[0185] Optionally, if the reporting mode corresponding to the link identifier to be queried is a recursive reporting mode; the query module 508 is further configured to:
[0186] In response to a query instruction, obtaining an identifier of a link to be queried carried in the query instruction;
[0187] Query the target request execution fragment corresponding to the link identifier to be queried, wherein the target request execution fragment includes the request execution fragment generated by the target node for the link identifier to be queried, the request execution fragment reported by the direct downstream node of the target node, and the fragment identifier of the parent execution fragment issued by the direct upstream node of the target node.
[0188] The embodiments of this specification provide a request link monitoring device, including a generation module, an acquisition module and a reporting block. Different from the client / server architecture, any target node in the distributed system can report data and provide query services for the request link, distributing the monitoring of the request link to each node in the distributed system. The client-based request link monitoring does not require the deployment of server components, reducing resource dependence and environmental deployment difficulties. In addition, it can adapt to different reporting modes and data reporting protocols, support dynamic switching, and flexibly switch the reporting mode and reporting protocol of link monitoring. The distributed system can not only self-consistently complete the data collection and query of the request link monitoring, but also report the data of the request link to an external data collection center to improve compatibility.
[0189] The above is a schematic scheme of a request link monitoring device of this embodiment. It should be noted that the technical scheme of the request link monitoring device and the technical scheme of the request link monitoring method mentioned above belong to the same concept, and the details not described in detail in the technical scheme of the request link monitoring device can be referred to the description of the technical scheme of the request link monitoring method mentioned above.
[0190] Figure 6 The block diagram of a computing device according to an embodiment of the present specification is shown. The components of the computing device 600 include but are not limited to a memory 610 and a processor 620. The processor 620 is connected to the memory 610 via a bus 630, and the database 650 is used to store data.
[0191] The computing device 600 also includes an access device 640 that enables the computing device 600 to communicate via one or more networks 660. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 640 may include one or more of any type of network interface (e.g., a network interface card (NIC)) that is wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world-wide interoperability for microwave access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, and a near field communication (NFC).
[0192] In one embodiment of the present specification, the above components of the computing device 600 and Figure 6 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 6 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0193] The computing device 600 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 600 may also be a mobile or stationary server.
[0194] The processor 620 is used to execute the following computer executable instructions, which, when executed by the processor, implement the steps of the above-mentioned request link monitoring method.
[0195] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above-mentioned request link monitoring method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above-mentioned request link monitoring method.
[0196] An embodiment of the present specification further provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the steps of the above-mentioned request link monitoring method.
[0197] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above-mentioned request link monitoring method belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the above-mentioned request link monitoring method.
[0198] An embodiment of the present specification also provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned request link monitoring method when executed by a processor.
[0199] The above is a schematic scheme of a computer program product of this embodiment. It should be noted that the technical scheme of the computer program product and the technical scheme of the above-mentioned request link monitoring method belong to the same concept, and the details not described in detail in the technical scheme of the computer program product can be referred to the description of the technical scheme of the above-mentioned request link monitoring method.
[0200] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0201] Computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. Computer readable media may include: any entity or device capable of carrying computer program codes, recording media, USB flash drives, mobile hard disks, magnetic disks, optical disks, computer memories, read-only memories (ROM), random access memories (RAM), electric carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the contents of computer readable media may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer readable media do not include electric carrier signals and telecommunication signals.
[0202] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of this specification.
[0203] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0204] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that technicians in the relevant technical field can well understand and use this specification. This specification is only limited by the claims and their full scope and equivalents.
Claims
1. A request link monitoring method, applied to a target node of a distributed system, comprising: In response to the target request, executing the target request to generate a corresponding request execution fragment; Obtain a target link identifier and target reporting information of the target request, wherein the target link identifier and the target reporting information are configured based on an entry node, the target link identifier is used to identify a complete call link of the target request initiated from a user end to the distributed system, the target reporting information is used to specify a reporting method for request link data corresponding to the target request, the target reporting information includes a target reporting mode, a target reporting endpoint, and a target reporting protocol, the target reporting endpoint is a reporting endpoint corresponding to the target reporting mode, and the target reporting mode is a reporting mode currently configured by an entry node in at least one reporting mode; storing the target link identifier and the obtained request execution fragment in correspondence, and determining whether to report the corresponding request execution fragment according to the target reporting mode; If reported, performing protocol conversion on the request execution fragment according to the target reporting protocol, and reporting the converted request execution fragment and the target link identifier to the target reporting endpoint; In response to the query instruction, the target request execution segment corresponding to the link identifier to be queried is returned.
2. The request link monitoring method according to claim 1, wherein the target node is any downstream node, and the method further comprises: Receive a fragment identifier of a parent execution fragment of the target request sent by a direct upstream node; Accordingly, reporting the converted request execution fragment and the target link identifier to the target reporting endpoint includes: The converted request execution fragment, the target link identifier and the fragment identifier of the parent execution fragment are reported to the target reporting endpoint, wherein the fragment identifier of the parent execution fragment is used to instruct the target reporting endpoint to associate and store each request execution fragment corresponding to the target link identifier.
3. According to the request link monitoring method of claim 1, the target reporting mode is a summary reporting mode, and the target reporting endpoint is an entry node; The target node is an entry node, and the corresponding storage of the target link identifier and the obtained request execution fragment includes: Obtain the target link identifier and the corresponding request execution fragment reported by each downstream node; The target link identifier and the first request execution fragment are stored correspondingly, wherein the first request execution fragment includes the request execution fragment generated by the entry node executing the target request, and the request execution fragment reported by each downstream node for the target link identifier.
4. According to the request link monitoring method of claim 1, the target reporting mode is a recursive reporting mode, the target reporting endpoint is a direct upstream node of the target node, and the target node is any downstream node except the entry node; The method further includes: Obtaining a target link identifier and a corresponding request execution fragment reported by a direct downstream node of the target node; The target link identifier and the second request execution fragment are stored correspondingly, wherein the second request execution fragment includes the request execution fragment generated by the target node executing the target request, and the request execution fragment reported by the direct downstream node of the target node for the target link identifier; Accordingly, reporting the converted request execution fragment and the target link identifier to the target reporting endpoint includes: The converted second request execution fragment and the target link identifier are reported to a node directly upstream of the target node.
5. According to the request link monitoring method of claim 1, the target reporting mode is a data collection center reporting mode, and the target reporting endpoint is a data collection end configured by an entry node; the step of reporting the converted request execution fragment and the target link identifier to the target reporting endpoint comprises: According to the address of the data collection terminal, the converted request execution fragment and the target link identifier are reported to the data collection terminal.
6. According to any one of claims 1 to 5, the target node is any downstream node, and the step of obtaining the target link identifier and target reporting information of the target request comprises: Acquire link information sent by a direct upstream node of the target node; The target link identifier of the target request and the target reporting information are obtained by parsing the link information.
7. The request link monitoring method according to any one of claims 1 to 5, wherein the target node is an entry node, and the step of obtaining the target link identifier and target reporting information of the target request comprises: Generating a corresponding target link identifier for the target request; In response to the reporting information configuration instruction, configure the target reporting information corresponding to the target request, wherein the target reporting information includes a target reporting mode, a target reporting endpoint and / or a target reporting protocol, the target reporting endpoint is a reporting endpoint corresponding to the target reporting mode, and the target reporting mode is a reporting mode currently configured by the entry node in at least one reporting mode.
8. The request link monitoring method according to any one of claims 1 to 5, if the reporting mode corresponding to the link identifier to be queried is a summary reporting mode, the target node is an entry node; The step of returning a target request execution segment corresponding to the link identifier to be queried in response to the query instruction includes: In response to a query instruction, obtaining an identifier of a link to be queried carried in the query instruction; Query and return the target request execution fragment corresponding to the link identifier to be queried, wherein the target request execution fragment includes each request execution fragment corresponding to the link identifier to be queried.
9. The request link monitoring method according to any one of claims 1 to 5, if the reporting mode corresponding to the link identifier to be queried is a recursive reporting mode, the step of returning the target request execution fragment corresponding to the link identifier to be queried in response to the query instruction comprises: In response to a query instruction, obtaining an identifier of a link to be queried carried in the query instruction; Query the target request execution fragment corresponding to the link identifier to be queried, wherein the target request execution fragment includes the request execution fragment generated by the target node for the link identifier to be queried, the request execution fragment reported by the direct downstream node of the target node, and the fragment identifier of the parent execution fragment issued by the direct upstream node of the target node.
10. A distributed system comprising an entry node and at least one downstream node; The entry node is used to respond to the target request and execute the target request to generate a corresponding request execution fragment; Configure the target link identifier and target reporting information of the target request, the target link identifier is used to identify the complete call link of the target request initiated from the user end to the distributed system, the target reporting information is used to specify the reporting method of the request link data corresponding to the target request, the target reporting information includes a target reporting mode, a target reporting endpoint and a target reporting protocol, the target reporting endpoint is the reporting endpoint corresponding to the target reporting mode, and the target reporting mode is the reporting mode currently configured by the entry node in at least one reporting mode; The target link identifier and the obtained request execution fragment are stored in correspondence, and whether to report the corresponding request execution fragment is determined according to the target reporting mode; if reported, the request execution fragment is converted according to the target reporting protocol, and the converted request execution fragment and the target link identifier are reported to the target reporting endpoint; Sending the target request, the target link identifier and the target reporting information to a downstream node; The downstream node is used to respond to the target request, execute the target request to generate a corresponding request execution fragment, obtain the target link identifier and target reporting information of the target request, store the target link identifier and the obtained request execution fragment in correspondence, and determine whether to report the corresponding request execution fragment according to the target reporting mode, and if reported, perform protocol conversion on the request execution fragment according to the target reporting protocol, and report the converted request execution fragment and the target link identifier to the target reporting endpoint; Sending the target request, the target link identifier and the target reporting information to the next downstream node; The entry node and the downstream node are further configured to return a target request execution fragment corresponding to the link identifier to be queried in response to a query instruction.
11. A computing device comprising: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer program / instructions are executed by the processor, the steps of the method for requesting link monitoring according to any one of claims 1 to 9 are implemented.
12. A computer-readable storage medium storing a computer program / instruction, wherein the computer program / instruction, when executed by a processor, implements the steps of the method for requesting link monitoring according to any one of claims 1 to 9.
13. A computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the steps of the method for requesting link monitoring according to any one of claims 1 to 9.
Citation Information
Patent Citations
Micro-service log retrieval method and system, control device and storage medium
CN115344533A