Service chain tracking method, device, storage medium and program product

By introducing tracker instances and probes into microservice applications, non-invasive service chain tracking is implemented, the stability problems caused by microservice chain tracking technology are solved, and the system's response speed and throughput are improved.

CN118939348BActive Publication Date: 2025-01-07ZHONGDIAN DATA IND CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411420229.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-12
Publication Date
2025-01-07
Estimated Expiration
2044-10-12

AI Technical Summary

Technical Problem

The existing microservice chain tracking technology through intrusive code integration leads to an increase in the computing and I/O burden. As the load grows, it may lead to an extended service response time and a reduced throughput, affecting the stability of the microservice application system.

Method used

By introducing preset tracker instances and tracking probes, generating spans and collecting data without modifying business code, the high intrusion and resource consumption brought about by intrusive code integration is avoided, and the stability of the service chain tracking process is ensured. sex.

Benefits of technology

It effectively avoids the extended response time and reduced throughput caused by service tracking, improves the stability of the microservice application system, and ensures the context coherence of the service link when processing asynchronously and nonlinear requests.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118939348B_ABST
    Figure CN118939348B_ABST
Patent Text Reader

Abstract

The present application discloses a service chain tracking method, device, storage medium and program product, which relates to the field of data processing technology, including: when a microservice component to be called receives a component call request, a tracker instance is used to determine root span data based on the component call request, create a first initial span and add root span data to the first initial span to obtain a root span; when the microservice component to be called generates a service call request, a tracker instance is used to add context information to the service call request to obtain a target request; when the target request reaches a target microservice component, a tracker instance is used to determine subspan data based on the target request, create a second initial span and add subspan data to the second initial span to obtain a subspan; a preset tracking probe is used to obtain a root span and a subspan, and a target service chain is generated based on the root span and the subspan. The present application improves the stability of the microservice application system during service chain tracking.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a service chain tracking method, device, storage medium and program product. Background Art

[0002] Current microservice chain tracing technologies, such as Zipkin and Pinpoint, are generally implemented through intrusive code integration, which adds additional computing and I / O (input / output) burdens to each node in the service chain. Under low load, these overheads may not be obvious, but as the load increases, the computing resources and network resources required for service chain tracing increase rapidly, which may lead to longer service response time in the microservice application architecture and reduce service system throughput, affecting the stability of the microservice application system.

[0003] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention

[0004] The main purpose of this application is to provide a service chain tracking method, device, storage medium and program product, aiming to solve the technical problem that the stability of the microservice application system is affected by the microservice chain tracking technology.

[0005] To achieve the above objectives, the present application proposes a service chain tracking method, which includes:

[0006] When the microservice component to be called receives a component call request, the root span data is determined based on the component call request through a preset tracker instance, a first initial span is created through the tracker instance, and the root span data is added to the first initial span to obtain a root span; wherein the root span data at least includes context information, and the context information is used to identify the call path of the microservice component to be called;

[0007] When the microservice component to be called generates a service call request, the context information is added to the service call request through the tracker instance to obtain a target request;

[0008] When the target request reaches the target microservice component corresponding to the target request, the subspan data is determined based on the target request by the tracker instance, a second initial span is created by the tracker instance, and the subspan data is added to the second initial span to obtain a subspan; wherein the subspan data includes at least the context information;

[0009] The root span and the subspan are acquired through a preset tracing probe, tracing data is determined based on the root span and the subspan, and a target service chain is generated based on the tracing data.

[0010] In one embodiment, the step of creating a second initial span by the tracker instance and adding the subspan data to the second initial span to obtain a subspan includes:

[0011] Parsing the target request to obtain a calling task, and if the calling task is an asynchronous task, marking the calling task by using a preset asynchronous task tracking annotation to obtain a marked task;

[0012] When the target microservice component executes the labeling task, the context information carried by the target request is saved through a preset context capturer, and a second initial span is created through the tracker instance;

[0013] When the target microservice component completes the labeling task, the context information is obtained from the context capturer, and the context information is added as subspan data to the second initial span through the tracker instance to obtain a subspan.

[0014] In one embodiment, the step of generating a service chain based on the tracking data includes:

[0015] Enable Gzip compression in a probe configuration file of the tracing probe, and create a Gzip output stream and a Gzip input stream based on the Gzip compression;

[0016] Compressing the tracking data according to a preset compression level through the Gzip output stream to obtain compressed data;

[0017] Upon receiving a service chain generation instruction carrying a target identifier, obtaining the compressed data from the compressed data storage space based on the target identifier, wherein the target identifier is an identity identifier corresponding to the component call request;

[0018] The compressed data is decompressed through the Gzip input stream to obtain decompressed data, and a target service chain is generated based on the decompressed data.

[0019] In one embodiment, the tracking data includes a service chain tag;

[0020] After the step of generating a target service chain based on the tracking data, the method further includes:

[0021] Storing the target service chain in a preset service chain storage space;

[0022] When receiving a service chain search instruction, parsing the service chain search instruction to obtain a search tag;

[0023] A retrieval service chain whose service chain tag matches the retrieval tag is determined from a plurality of service chains in the service chain storage space, and the retrieval service chain is processed according to the service chain retrieval instruction.

[0024] In one embodiment, when the microservice component to be called receives a component call request, the step of determining the root span data based on the component call request through a preset tracker instance, creating a first initial span through the tracker instance and adding the root span data to the first initial span to obtain the root span also includes:

[0025] Determine the application programming language of the microservice component to be called, and add a tracing probe dependency in the dependency management of the microservice component to be called through the application programming language;

[0026] Adding probe configuration information to the dependent probe in the component configuration file of the microservice component to be called, wherein the probe configuration information is used to characterize the operation mode of the dependent probe for data tracking;

[0027] When the microservice component to be called is started, a probe is injected into the microservice component to be called as a preset tracing probe.

[0028] In one embodiment, when the microservice component to be called receives a component call request, the step of determining the root span data based on the component call request through a preset tracker instance, creating a first initial span through the tracker instance and adding the root span data to the first initial span to obtain the root span also includes:

[0029] Add the tracker dependency in the dependency management;

[0030] When the microservice component to be called is started, a running instance is created based on the dependent tracker, and the running instance is used as the preset tracker instance.

[0031] In one embodiment, after the step of obtaining the root span and the subspan by using a preset tracing probe, the method further includes:

[0032] Monitoring whether the tracking data reaches a preset warning threshold;

[0033] In the case where the tracking data reaches the warning threshold, abnormal data is determined from the tracking data, and warning information is generated based on the abnormal data.

[0034] In addition, to achieve the above-mentioned purpose, the present application also proposes a service chain tracking device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, and the computer program is configured to implement the steps of the service chain tracking method described above.

[0035] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the service chain tracking method described above are implemented.

[0036] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the service chain tracking method described above are implemented.

[0037] In the present application, when the microservice component to be called receives a component call request, root span data is determined based on the component call request through a preset tracer instance, a first initial span is created through the tracer instance, and the root span data is added to the first initial span to obtain the root span; wherein the root span data at least includes context information, and the context information is used to identify the call path of the microservice component to be called; when the microservice component to be called generates a service call request, the context information is added to the service call request through the tracer instance to obtain a target request; when the target request reaches the target microservice component corresponding to the target request, subspan data is determined based on the target request through the tracer instance, a second initial span is created through the tracer instance, and the subspan data is added to the second initial span to obtain the subspan; wherein the subspan data at least includes the context information; the root span and the subspan are obtained through a preset tracing probe, tracing data is determined based on the root span and the subspan, and a target service chain is generated based on the tracing data.

[0038] This application introduces preset tracer instances and tracing probes, generates spans through tracer instances, and collects data through spans without modifying business codes, thereby avoiding the high intrusiveness and resource consumption caused by intrusive code integration, thereby avoiding the situation where service tracking leads to prolonged service response time and reduced service system throughput, and improving the stability of the microservice application system during service chain tracing. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0041] Figure 1 A flowchart of the first embodiment of the service chain tracking method of the present application is provided;

[0042] Figure 2 A flow chart of the second embodiment of the service chain tracking method of the present application;

[0043] Figure 3 A brief flowchart of a service chain tracking method provided in an embodiment of the present application;

[0044] Figure 4 This is a schematic diagram of the module structure of the service chain tracking device according to an embodiment of the present application;

[0045] Figure 5 This is a schematic diagram of the device structure of the hardware operating environment involved in the service chain tracking method in the embodiment of the present application.

[0046] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0047] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0048] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0049] The main solution of the embodiment of the present application is: when the microservice component to be called receives a component call request, the root span data is determined based on the component call request through a preset tracker instance, a first initial span is created through the tracker instance, and the root span data is added to the first initial span to obtain the root span; wherein the root span data at least includes context information, and the context information is used to identify the call path of the microservice component to be called; when the microservice component to be called generates a service call request, the context information is added to the service call request through the tracker instance to obtain the target request; when the target request reaches the target microservice component corresponding to the target request, the subspan data is determined based on the target request through the tracker instance, a second initial span is created through the tracker instance, and the subspan data is added to the second initial span to obtain the subspan; wherein the subspan data at least includes the context information; the root span and the subspan are obtained through a preset tracing probe, tracing data is determined based on the root span and the subspan, and a target service chain is generated based on the tracing data.

[0050] In this embodiment, for the convenience of description, the following description is made with the service chain tracking device as the execution entity.

[0051] Since current microservice chain tracing technologies, such as Zipkin and Pinpoint, are generally implemented through intrusive code integration, this approach adds additional computing and I / O (input / output) burdens to each node in the service chain. Under low load, these overheads may not be obvious, but as the load increases, the computing resources and network resources required for service chain tracing increase rapidly, which may lead to longer service response time and lower service system throughput in the microservice application architecture, affecting the stability of the microservice application system. At the same time, when facing non-linear requests or asynchronous task processing mechanisms in the microservice architecture, a cross-thread tracing technology is needed to ensure the contextual consistency of the entire service chain.

[0052] The embodiment of the present application provides a solution by introducing preset tracer instances and tracing probes, generating spans through the tracer instances and collecting data through the spans without modifying the business code, thereby avoiding the high intrusiveness and resource consumption caused by intrusive code integration, thereby avoiding the situation where service tracking leads to prolonged service response time and reduced service system throughput, and improving the stability of the microservice application system during service chain tracing.

[0053] In addition, the solution proposed in the embodiment of the present application uses a tracer instance to determine the root span data when a microservice component receives a call request, and adds context information to the request when the microservice component generates a service call request to form a target request. When the request is sent to the next microservice component, it carries the necessary context information to ensure the consistency of the request. By passing context information in each service call, the context consistency of the entire service link can be ensured even in the case of non-linear or asynchronous processing.

[0054] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a service chain tracking device, etc. The following takes the service chain tracking device as an example to illustrate this embodiment and the following embodiments.

[0055] Based on this, the present application embodiment provides a service chain tracking method, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the service chain tracking method of the present application.

[0056] In this embodiment, the service chain tracking method includes steps S10 to S40:

[0057] Step S10, when the microservice component to be called receives a component call request, the root span data is determined based on the component call request through a preset tracker instance, a first initial span is created through the tracker instance and the root span data is added to the first initial span to obtain the root span, wherein the root span data includes at least context information, and the context information is used to identify the call path of the microservice component to be called.

[0058] It should be noted that microservice components are the basic units that constitute the microservice architecture (such as SpringCloud), providing specific business functions. The microservice component to be called is the microservice component to be called. The component call request is the call request received by the microservice component to be called. The tracker instance is a component used to track service calls and is used to generate and manage tracking data.

[0059] When the microservice component to be called receives a component call request, the microservice component to be called creates a span (hereinafter referred to as the first initial span for distinction) through the tracer instance before executing the task according to the component call request. When the microservice component to be called executes the task according to the component call request, the preset tracer instance is used to determine the root span data based on the component call request, wherein the root span data refers to the starting point data of the service chain tracking, which records the beginning of the service call chain, and the root span data at least includes context information, and the context information is used to identify the call path of the microservice component to be called. In a specific implementation, the context information may include traceID (tracing identifier) ​​and spanID (span identifier). The root span data may also include the task execution data (hereinafter referred to as the first execution data for distinction) generated when the microservice component to be called executes the task according to the component call request. After the microservice component to be called completes the task corresponding to the component call request, the root span data is added to this initial span through the tracer instance to form a root span.

[0060] It can be understood that by establishing a root span as a starting point for tracing the service call chain, necessary context information and tracing identifiers are provided, thereby providing a basis for subsequent service chain tracing.

[0061] Step S20, when the microservice component to be called generates a service call request, the context information is added to the service call request through the tracker instance to obtain the target request.

[0062] It should be noted that the service call request is a call request issued by the microservice component to be called to request other services. When the microservice component to be called initiates a call request to other services, the context information is added to the service call request through the tracker instance to obtain the target request, ensuring that the service call request carries the necessary context information and provides the receiving service with the data required for execution and tracking.

[0063] Step S30, when the target request arrives at the target microservice component corresponding to the target request, the subspan data is determined based on the target request through the tracker instance, a second initial span is created through the tracker instance, and the subspan data is added to the second initial span to obtain the subspan, wherein the subspan data includes at least context information.

[0064] It should be noted that the target microservice component is the microservice component corresponding to the target request.

[0065] When the target request reaches the target microservice component corresponding to the target request, before the target microservice component executes the task corresponding to the target request, a span is created through the tracer instance (hereinafter referred to as the second initial span for distinction). When the target microservice component executes the task corresponding to the target request, subspan data is collected through the tracer instance, wherein the subspan data is the data of other service calls derived from the root span in the service chain. Whenever a service calls another service, a new subspan may be created. The subspan data includes at least context information, and may also include task execution data generated when the target microservice component executes the task according to the target request (hereinafter referred to as the second execution data for distinction). After the target microservice component completes the task corresponding to the target request, the tracer instance adds the subspan data to the second initial span to form a subspan.

[0066] It can be understood that by generating tracking data for each link of the service call chain, the traceability of the entire call process is ensured.

[0067] Step S40: obtaining a root span and a subspan through a preset tracing probe, determining tracing data based on the root span and the subspan, and generating a target service chain based on the tracing data.

[0068] It should be noted that the tracing probe is a tool for extracting tracing information from an application. The root span and subspan are obtained from the service chain tracing system through the preset tracing probe, and the root span and subspan are parsed to obtain the tracing data, where the tracing data includes at least the root span data and the subspan data, and may also include timestamps, network information (network delay during the service call, DNS (Domain Name System) lookup time and other network-related indicators), load information (system load during service calls, such as CPU usage, memory usage, etc.), and other information, which is not limited here. A complete service chain (hereinafter referred to as the target service chain for distinction) is generated based on the tracing data. The target service chain can represent the complete path of the service call, including all related service calls.

[0069] It should be noted that the process of generating the target service chain based on the tracking data is not limited here, and a conventional service chain generation method can be used.

[0070] In this embodiment, by introducing preset tracer instances and tracing probes, spans are generated through the tracer instances and data is collected through the spans without modifying the business code, thereby avoiding the high intrusiveness and resource consumption caused by intrusive code integration, thereby avoiding the situation where service tracking leads to prolonged service response time and reduced service system throughput, and improving the stability of the microservice application system during service chain tracing.

[0071] In a feasible implementation, step S30: creating a second initial span through a tracker instance and adding subspan data to the second initial span to obtain a subspan includes steps S301 to S303:

[0072] Step S301 , parsing the target request to obtain a calling task, and in the case where the calling task is an asynchronous task, annotating the calling task through a preset asynchronous task tracking annotation to obtain a marked task.

[0073] It should be noted that the calling task is the specific task or operation contained in the request that needs to be executed. The asynchronous task refers to a task that does not return results immediately but returns results in the future through callbacks or other mechanisms. The asynchronous task tracking annotation is used to indicate that a task is asynchronous and requires specific tracking processing.

[0074] When the target microservice component receives a service call request, it parses the target request to identify the call task therein, and determines whether the call task is an asynchronous task. If the call task is asynchronous, it is annotated with a preset asynchronous task tracking annotation.

[0075] It can be understood that by marking the calling task with the preset asynchronous task tracking annotation when the calling task is an asynchronous task, it can be ensured that the asynchronous calling task can be correctly identified and marked, providing a basis for subsequent tracking and management.

[0076] Step S302: When the target microservice component executes the labeling task, the context information carried by the target request is saved through a preset context capturer, and a second initial span is created through a tracker instance.

[0077] It should be noted that the context capturer is a tool for capturing and storing context information carried in a request.

[0078] The calling task executed by the target microservice component may be a task passed from other threads or a task of its own task processing thread. When the target microservice component executes the annotation task (hereinafter referred to as the annotation task), the preset context capturer is used to capture the context information in the target request, and a second initial span is created through the tracker instance.

[0079] It can be understood that capturing and saving context information through the context capturer ensures the integrity and continuity of the call context even in an asynchronous execution environment.

[0080] Step S303: When the target microservice component completes the labeling task, context information is obtained from the context capturer, and the context information is added as subspan data to the second initial span through the tracker instance to obtain a subspan.

[0081] When the target service completes the labeling task, it obtains context information from the context capturer, and adds the context information as subspan data to the second initial span through the tracker instance to obtain the subspan.

[0082] It is understandable that by tracking and recording asynchronous call tasks, the entire process from the start to the end of the call can be traced, which helps with monitoring and problem diagnosis.

[0083] In a feasible implementation, step S40: the step of generating a service chain based on tracking data includes steps S401 to S404.

[0084] Step S401: enable Gzip compression in the probe configuration file of the tracing probe, and create a Gzip output stream and a Gzip input stream based on Gzip compression.

[0085] It should be noted that Gzip compression is a file format and data compression algorithm used in network transmission and file storage, using the Lempel-Ziv coding (LZ77) algorithm for data compression. Gzip output stream is a class used to compress data into GZIP format, and Gzip input stream is a class used to read and decompress data in GZIP format.

[0086] Step S402: compress the tracking data according to a preset compression level through the Gzip output stream to obtain compressed data, and store the compressed data in a preset compressed data storage space.

[0087] The collected root span data and subspan data are compressed to reduce the data volume to obtain compressed data, and the compressed data is stored in a preset compressed data storage space for subsequent use.

[0088] By compressing the tracking data according to a preset compression level through the Gzip output stream to obtain compressed data, this implementation can reduce the storage space occupied, improve storage efficiency, and facilitate data transmission and fast access.

[0089] Step S402, when receiving a service chain generation instruction carrying a target identifier, obtaining compressed data from a compressed data storage space based on the target identifier, wherein the target identifier is an identity identifier corresponding to the component call request.

[0090] It should be noted that the target identifier is an identity identifier associated with the calling path of the microservice component to be called, and is used to retrieve the tracking data generated during the component calling request. The service chain generation instruction is a service chain generation instruction.

[0091] The service chain tracking device can receive different service chain generation instructions, and different instructions can carry different identifiers. The identifiers carried by the instructions are used to identify different service call paths (i.e., service chains). When receiving the service chain generation instruction, the service chain generation instruction is parsed to obtain the identifier carried in the instruction. If the identifier carried in the service chain generation instruction is a target identifier, compressed data is obtained from the compressed data storage space based on the target identifier.

[0092] It can be understood that the target identifier can be used to determine the tracking data associated with the call path of the microservice component to be called, providing a data basis for the subsequent generation of the target service chain.

[0093] Step S403: decompress the compressed data through the Gzip input stream to obtain decompressed data, and generate a target service chain based on the decompressed data.

[0094] The obtained compressed data is decompressed to obtain the original tracking data associated with the call path of the microservice component to be called (hereinafter referred to as decompressed data for distinction), and the target service chain is constructed and generated based on the decompressed data to achieve a visual representation of the service call chain.

[0095] It can be understood that in this embodiment, by compressing the collected tracking data and configuring the storage strategy of the corresponding compressed data, the effect of optimizing performance and saving storage space is achieved. When calling, the corresponding compressed data is retrieved and decompressed to obtain the corresponding original tracking data, and the target service chain is constructed and generated based on the decompressed original tracking data to achieve a visual representation of the service call chain.

[0096] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 2 , the tracking data includes a service chain tag, step S40: after determining the tracking data based on the root span and the subspan, and generating the target service chain based on the tracking data, the service chain tracking method further includes steps S50 to S70:

[0097] Step S50: storing the target service chain in a preset service chain storage space.

[0098] It should be noted that after obtaining the target service chain, the target service chain is stored in a preset service chain storage space. The service chain storage space and the compressed data storage space can be different storage spaces on the same storage device or different storage spaces on different storage devices, and there is no limitation here.

[0099] Step S60: When a service chain search instruction is received, the service chain search instruction is parsed to obtain a search tag.

[0100] The service chain storage space stores multiple service chains. The service chain retrieval instruction is an instruction that triggers the retrieval of a service chain from the service chain storage space. The service chain retrieval instruction carries tag information. When the service chain retrieval instruction is received, the service chain retrieval instruction is parsed. The tag obtained by parsing the instruction is referred to as the retrieval tag.

[0101] Step S70: determine a search service chain whose service chain tag matches the search tag from among the multiple service chains in the service chain storage space, and process the search service chain according to the service chain search instruction.

[0102] The service chain tag is a tag used to identify the characteristics of the service chain. In service chain tracking, the tag is used to provide additional contextual information to help identify and classify different parts of the service chain. It should be noted that the root span data also includes a first tag, and the subspan data also includes a second tag. The first tag in the root span data and the second tag in the subspan data are essentially used to identify and distinguish the identification information in different service chains. The tracking data is obtained based on the root span and the subspan, and the service chain tags in the tracking data include the first tag and the second tag.

[0103] A service chain whose service chain tag matches the search tag is determined from multiple service chains in the service chain storage space, hereinafter referred to as the search service chain for distinction, and the search service chain is further analyzed or displayed according to the service chain search instruction.

[0104] In a feasible implementation, step S10: when the microservice component to be called receives a component call request, the root span data is determined based on the component call request by a preset tracker instance, and before the first initial span is created by the tracker instance and the root span data is added to the first initial span to obtain the root span, steps S01 to S03 are also included:

[0105] Step S01, determining the application programming language of the microservice component to be called, and adding a tracing probe dependency in the dependency management of the microservice component to be called through the application programming language.

[0106] It should be noted that the application programming language refers to the programming language used to implement microservice components, such as Java, Python, Node.js, etc.

[0107] Identify and determine the application programming language used by the microservice component to be called to ensure that the added tracing probe dependency is compatible with the programming language of the microservice component.

[0108] According to the determined application programming language, select a tracing probe library or framework suitable for the language, and add the dependencies of the selected tracing probe in the dependency management of the microservice component to be called. For example, in a Java project, inject Maven dependencies in the XML file; in a Python project, introduce and initialize skywalking.agent in the application code; in a Go project, introduce it through the skywalking package.

[0109] Step S02: adding probe configuration information to the dependent probe in the component configuration file of the microservice component to be called, wherein the probe configuration information is used to characterize the operation mode of the dependent probe for data tracking.

[0110] It should be noted that the probe configuration information is used to characterize the operating mode of the probe for data tracing, characterizes the behavior and characteristics of the probe, defines how the probe interacts with the application, what data is captured, and how to manage and transmit this data, including but not limited to the probe type (specifies the type or function of the probe to be used, such as performance monitoring, error tracing, transaction tracing, etc.), tracing mode (synchronous or asynchronous tracing), data collection granularity (the degree of detail of the probe collected data, such as method level, class level or service call level), sampling rate (defines the frequency of probe sampling data, such as 1 sample for every 100 requests) and output target (the output destination of the tracing data, such as log files, remote tracing systems or other monitoring tools).

[0111] In this implementation, a probe dependency is added to the dependency management of the microservice component to be called, and probe configuration information is added to the component configuration file of the microservice component to be called to ensure that the microservice component can perform necessary data tracking through the probe and provide infrastructure for subsequent service chain tracking. The probe configuration information can be used to customize the behavior of the probe to adapt to different tracking requirements.

[0112] Step S03: When the microservice component to be called is started, a probe is injected into the microservice component to be called as a preset tracing probe.

[0113] It should be noted that injecting a probe means integrating the probe into the microservice component so that it can collect tracing data when the component is executed. It is understandable that by injecting a probe into the microservice component to be called as a preset tracing probe when the microservice component to be called is started, tracing data can be automatically collected through the tracing probe during the execution of the microservice component without manual intervention.

[0114] In a feasible implementation, step S10: when the microservice component to be called receives a component call request, the root span data is determined based on the component call request by a preset tracker instance, and before the first initial span is created by the tracker instance and the root span data is added to the first initial span to obtain the root span, steps S04-S05 are also included:

[0115] Step S04: Add the tracker dependency in dependency management.

[0116] It should be noted that tracer dependency refers to adding a tracer for creating and managing tracing data to the dependency management of microservice components.

[0117] By adding the tracer dependency in dependency management, initializing the tracer, and preparing the tracer's operating environment, you can ensure that the tracer can be loaded correctly and is ready to go, providing support for creating and managing tracing data.

[0118] Step S05: When the microservice component to be called is started, a running instance is created based on the dependent tracker, and the running instance is used as the preset tracker instance.

[0119] It should be noted that a running instance is an instance of a tracer, which is used to manage the tracing data of a specific microservice component. It can be understood that by creating a tracer instance, independent tracing data management can be provided for each microservice component, which helps in accurate tracing and analysis.

[0120] In a feasible implementation manner, after step S40: obtaining the root span and the subspan by using a preset tracing probe, steps S80 to S90 are further included:

[0121] Step S80, monitoring whether the tracking data reaches a preset warning threshold.

[0122] It should be noted that the warning threshold is a predefined data standard or level used to evaluate the health status or performance indicators of the service chain. When the data exceeds this threshold, it may indicate a problem or anomaly.

[0123] By monitoring and tracking whether the data reaches the preset warning threshold, real-time monitoring of service chain performance can be achieved, and potential performance bottlenecks or abnormal situations can be discovered in time. Through timely monitoring, problems can be prevented from occurring and the risk of system failure can be reduced.

[0124] Step S90: when the tracking data reaches the warning threshold, abnormal data is determined from the tracking data, and alarm information is generated based on the abnormal data.

[0125] It should be noted that abnormal data are data points that are significantly different from normal or expected patterns and may indicate problems or failures in the service chain.

[0126] Once the tracking data reaches the warning threshold, abnormal data is determined from the tracking data, and the abnormal data is analyzed to determine its impact on the service chain. Based on the analysis results, an alarm message is generated. The method of determining abnormal data from the tracking data is not limited here, and conventional data analysis methods can be used, which will not be described in detail here.

[0127] It is understandable that in this implementation, a monitoring and alarm mechanism based on data thresholds is introduced. This mechanism makes the monitoring of the service chain more automated and intelligent. By setting early warning thresholds, the performance of the service chain can be monitored in real time, and relevant personnel can be notified in a timely manner when an abnormality is detected, thereby improving the reliability and stability of the microservice application system and the operation and maintenance efficiency.

[0128] Exemplarily, in order to help understand the implementation process of the service chain tracing method obtained by combining this embodiment with the above-mentioned embodiment 1, a method for sampling and tracing the microservice call link based on the combination of Skywalking and SpringCloud is proposed. It should be noted that SkyWalking is an open source observable platform that mainly provides application performance monitoring (APM, Application Performance Management) functions. It is designed for microservices, cloud native architectures, and modern application environments based on containers (such as Docker, Kubernetes, Mesos, etc.). SkyWalking provides an integrated solution for distributed tracing, service grid telemetry analysis, metric aggregation and visualization, helping developers and operation and maintenance teams to deeply understand the operating status and performance issues of applications. SpringCloud is a collection of a series of frameworks that uses the convenience of SpringBoot to simplify the development of distributed systems. SpringCloud provides a wealth of tools and patterns to help developers build microservice-based applications. These tools and patterns help developers more easily deal with some common problems in distributed systems, such as configuration management, service discovery, circuit breakers, intelligent routing, micro-agents, distributed sessions, etc. OpenTracing is a distributed tracing standard proposed by the Cloud Native Computing Foundation (CNCFCloud Native Computing Foundation). It aims to provide a vendor-neutral, language-independent API so that developers can switch seamlessly between different tracing systems. The OpenTracing specification defines a series of basic terms and concepts, such as Trace, Span, Context, etc. These terms provide unified semantics and behavioral standards for the implementation of distributed tracing. Span is the basic building block of Trace, representing an independent unit of work, such as a function call or an HTTP (HyperText Transfer Protocol) request. Each Span records the service name, start time and end time, as well as the logs and tags related to the Span.

[0129] In this embodiment, please refer to Figure 3 , Figure 3 A brief process diagram of the service chain tracing method based on Skywalking is provided. SkyWalking is installed in the SpringCloud application framework, and the process of service chain tracing can be achieved through OpenTracing dependency integration:

[0130] 1. Deploy SkyWalking on the server. To install the SkyWalking server, you can choose to deploy the SkyWalking server through Docker, or install it directly on the server.

[0131] 2. Configure environment dependencies. In SpringCloud applications, you need to add SkyWalking related dependencies and configurations. This usually includes adding SkyWalking's Maven dependency in pom.xml, and configuring the address of the SkyWalking server in application.yml or application.properties (that is, adding probe dependencies in the dependency management of the microservice component to be called).

[0132] 3. Introduce OpenTracing. Add the OpenTracing dependency in pom.xml so that you can use the OpenTracing API in your code (that is, add the tracer dependency in dependency management and initialize the tracer).

[0133] 4. Create a Tracer instance and create a Span. Specifically, in a SpringBoot application, you can initialize the OpenTracing Tracer by implementing the ApplicationRunner interface. In the run method, you can create and configure a Tracer instance and register it to the global TracerContext (that is, create a running instance based on the tracer as the preset tracer instance).

[0134] 5. Set a custom tag for the Span. In the business code, you can use the OpenTracing API to create and operate the Span, add a custom tag to the Span, and obtain the TraceID through the TraceContext (that is, when the microservice component to be called receives a component call request, the root span data is determined based on the component call request through the preset tracer instance, and the first initial span is created through the tracer instance and the root span data is added to the first initial span to obtain the root span, wherein the root span data includes at least context information, and the context information is used to identify the call path of the microservice component to be called; when the microservice component to be called generates a service call request, the context information is added to the service call request through the tracer instance to obtain the target request; when the target request reaches the target microservice component corresponding to the target request, the subspan data is determined based on the target request through the tracer instance, and the second initial span is created through the tracer instance and the subspan data is added to the second initial span to obtain the subspan, wherein the subspan data includes at least context information).

[0135] 6. Integrate SkyWalking probes in SpringCloud applications. Add SkyWalking probe dependencies in the pom.xml file of the SpringCloud application. Skywalking provides probes for different languages ​​to support applications in different languages. For example, in a Java project, you can inject Maven dependencies into the XML file; in Python, you can introduce and initialize skywalking.agent in the application code; in Go language, you can introduce it through the skywalking package. At the same time, there are corresponding probe integration methods for languages ​​such as Node.js and .NET (that is, add probe configuration information in the component configuration file of the microservice component to be called).

[0136] 7. Configure JavaAgent. When starting the SpringCloud application, inject the SkyWalking probe into the application through JavaAgent (that is, when the microservice component to be called is started, inject the probe into the microservice component to be called as the preset tracing probe). Improve performance and fault tolerance and reduce blocking through asynchronous data transmission. In order to implement asynchronous data, implement the log collection logic through the SupplierWrapper wrapper class (or CallableWrapper, RunnableWrapper, select different wrapper classes according to the task type), use the @TraceCrossThread annotation, and intercept the class through bytecode enhancement. When encountering cross-thread situations, the Trace context will be saved and restored through the ContextManager class. Before the asynchronous task starts, use ContextManager.capture to save the current Trace context to ContextSnapshot. After the asynchronous task is executed, use ContextManager.continued(contextSnapshot) to restore the context (that is, parse the target request to obtain the calling task, and when the calling task is an asynchronous task, annotate the calling task with the preset asynchronous task tracing annotation to obtain the annotated task; when the target microservice component executes the annotated task, save the context information carried by the target request through the preset context capturer, and create a second initial span through the tracer instance; when the target microservice component completes the annotated task, obtain the context information from the context capturer, and add the context information as subspan data to the second initial span through the tracer instance to obtain the subspan).

[0137] In this embodiment, Gzip compression is enabled in the component configuration file of the SkyWalking probe, and according to the system situation, the configuration parameters are customized to set the compression level. The collected performance data is compressed through GZIPOutputSrtream, and the storage strategy of the corresponding compressed data is configured to achieve the effect of optimizing performance and saving storage space. When calling, the corresponding compressed data is retrieved and decompressed through GZIPInputStream to obtain the corresponding monitoring data (that is, Gzip compression is enabled in the probe configuration file of the tracking probe, and a Gzip output stream and a Gzip input stream are created based on Gzip compression; the tracking data is compressed through the Gzip output stream according to the preset compression level to obtain compressed data, and the compressed data is stored in the preset compressed data storage space; when a service chain generation instruction carrying a target identifier is received, the compressed data is obtained from the compressed data storage space based on the target identifier, wherein the target identifier is the identity identifier corresponding to the component call request; the compressed data is decompressed through the Gzip input stream to obtain the decompressed data, and the target service chain is generated based on the decompressed data).

[0138] 8. Implement link tracking based on Tag retrieval in SkyWalking. In the SkyWalking server component configuration file, configure the custom tag set in the previous step in searchableTracesTags. In the service log page, you can see the TraceID information output by the log (Hypertext Transfer Protocol) to implement service link tracking (that is, store the target service chain in the preset service chain storage space; when receiving the service chain retrieval instruction, parse the service chain retrieval instruction to obtain the retrieval tag; determine the retrieval service chain whose service chain tag matches the retrieval tag from multiple service chains in the service chain storage space, and process the retrieval service chain according to the service chain retrieval instruction).

[0139] In this embodiment, in a microservice architecture, a user request may require the collaboration of multiple services to be completed. When performance problems or failures occur, link tracking can help developers quickly locate the specific services and links where the problem occurs, thereby speeding up problem resolution. SkyWalking is an open source APM (Application Performance Management) tool designed for microservices, cloud native and containerized architectures. SkyWalking supports multiple languages ​​and frameworks and can be integrated with other monitoring systems. Integration with the log system can be through gRPC (Google Remote Procedure Call, Google Remote Procedure Call) to send log information to the SkyWalking OAP (Open API Protoco, open interface specification) server. In this way, log information can be analyzed and visualized together with link tracking data, providing a more comprehensive view of system behavior. This is very useful for troubleshooting and performance analysis. The alarm mechanism of the integrated alarm system can be: first, set a threshold based on the monitoring data, and trigger an alarm when the indicator exceeds the threshold. This can be achieved by configuring Webhook (a mechanism that allows users to register a callback URL in their own applications. When a specific event occurs, the event source will send a POST request to the URL to notify the user of what happened) to send the alarm information to the specified alarm system, such as email, SMS or instant messaging tools. This can help the operation and maintenance team to discover and respond to potential performance problems in a timely manner.

[0140] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the service chain tracking method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.

[0141] This application also provides a service chain tracking device, please refer to Figure 4 , the service chain tracking device comprises:

[0142] A first creation module 10 is used to determine root span data based on the component call request through a preset tracker instance when the microservice component to be called receives a component call request, create a first initial span through the tracker instance and add the root span data to the first initial span to obtain a root span; wherein the root span data at least includes context information, and the context information is used to identify the call path of the microservice component to be called;

[0143] An adding module 20 is used to add the context information to the service call request to obtain a target request through the tracker instance when the microservice component to be called generates a service call request;

[0144] A second creation module 30 is used for, when the target request arrives at the target microservice component corresponding to the target request, determining subspan data based on the target request through the tracker instance, creating a second initial span through the tracker instance and adding the subspan data to the second initial span to obtain a subspan; wherein the subspan data at least includes the context information;

[0145] The determination module 40 is configured to obtain the root span and the subspan through a preset tracing probe, determine tracing data based on the root span and the subspan, and generate a target service chain based on the tracing data.

[0146] In one embodiment, the second creation module 30 is used to:

[0147] Parsing the target request to obtain a calling task, and if the calling task is an asynchronous task, marking the calling task by using a preset asynchronous task tracking annotation to obtain a marked task;

[0148] When the target microservice component executes the labeling task, the context information carried by the target request is saved through a preset context capturer, and a second initial span is created through the tracker instance;

[0149] When the target microservice component completes the labeling task, the context information is obtained from the context capturer, and the context information is added as subspan data to the second initial span through the tracker instance to obtain a subspan.

[0150] In one embodiment, the determination module 40 is used to:

[0151] Enable Gzip compression in a probe configuration file of the tracing probe, and create a Gzip output stream and a Gzip input stream based on the Gzip compression;

[0152] Compressing the tracking data according to a preset compression level through the Gzip output stream to obtain compressed data;

[0153] Upon receiving a service chain generation instruction carrying a target identifier, obtaining the compressed data from the compressed data storage space based on the target identifier, wherein the target identifier is an identity identifier corresponding to the component call request;

[0154] The compressed data is decompressed through the Gzip input stream to obtain decompressed data, and a target service chain is generated based on the decompressed data.

[0155] In one embodiment, the tracking data includes a service chain tag; the device further includes a retrieval module for:

[0156] Storing the target service chain in a preset service chain storage space;

[0157] When receiving a service chain search instruction, parsing the service chain search instruction to obtain a search tag;

[0158] A retrieval service chain whose service chain tag matches the retrieval tag is determined from a plurality of service chains in the service chain storage space, and the retrieval service chain is processed according to the service chain retrieval instruction.

[0159] In one embodiment, the apparatus further comprises a configuration module, configured to:

[0160] Determine the application programming language of the microservice component to be called, and add a tracing probe dependency in the dependency management of the microservice component to be called through the application programming language;

[0161] Adding probe configuration information to the dependent probe in the component configuration file of the microservice component to be called, wherein the probe configuration information is used to characterize the operation mode of the dependent probe for data tracking;

[0162] When the microservice component to be called is started, a probe is injected into the microservice component to be called as a preset tracing probe.

[0163] The configuration module is also used to:

[0164] Add the tracker dependency in the dependency management;

[0165] When the microservice component to be called is started, a running instance is created based on the dependent tracker, and the running instance is used as the preset tracker instance.

[0166] In one embodiment, the device further includes an early warning module, which is used to:

[0167] Monitoring whether the tracking data reaches a preset warning threshold;

[0168] In the case where the tracking data reaches the warning threshold, abnormal data is determined from the tracking data, and warning information is generated based on the abnormal data.

[0169] The service chain tracking device provided by the present application adopts the service chain tracking method in the above embodiment, which can solve the technical problem that the stability of the microservice application system is affected by the microservice chain tracking technology. Compared with the prior art, the beneficial effects of the service chain tracking device provided by the present application are the same as the beneficial effects of the service chain tracking method provided by the above embodiment, and the other technical features in the service chain tracking device are the same as the features disclosed in the above embodiment method, which will not be repeated here.

[0170] The present application provides a service chain tracking device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the service chain tracking method in the above-mentioned embodiments.

[0171] Reference below Figure 5 , which shows a schematic diagram of the structure of a service chain tracking device suitable for implementing the embodiment of the present application. The service chain tracking device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The service chain tracking device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0172] like Figure 5As shown, the service chain tracking device may include a processing device 1001 (such as a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the service chain tracking device are also stored. The processing device 1001, ROM1002 and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the service chain tracking device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a service chain tracking device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.

[0173] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0174] The service chain tracking device provided by the present application adopts the service chain tracking method in the above embodiment, which can solve the technical problem that the stability of the microservice application system is affected by the microservice chain tracking technology. Compared with the prior art, the beneficial effects of the service chain tracking device provided by the present application are the same as the beneficial effects of the service chain tracking method provided by the above embodiment, and the other technical features in the service chain tracking device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0175] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0176] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0177] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the service chain tracking method in the above-mentioned embodiment.

[0178] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.

[0179] The computer-readable storage medium may be included in the service chain tracking device; or may exist independently without being assembled into the service chain tracking device.

[0180] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the service chain tracking device, the service chain tracking device: when the microservice component to be called receives a component call request, determines the root span data based on the component call request through a preset tracker instance, creates a first initial span through the tracker instance and adds the root span data to the first initial span to obtain a root span; wherein the root span data at least includes context information, and the context information is used to identify the call path of the microservice component to be called; generates a service call request in the microservice component to be called , the context information is added to the service call request through the tracer instance to obtain the target request; when the target request reaches the target microservice component corresponding to the target request, the subspan data is determined based on the target request through the tracer instance, a second initial span is created through the tracer instance and the subspan data is added to the second initial span to obtain the subspan; wherein the subspan data includes at least the context information; the root span and the subspan are obtained through a preset tracing probe, tracing data is determined based on the root span and the subspan, and a target service chain is generated based on the tracing data.

[0181] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0182] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0183] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0184] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned service chain tracing method, and can solve the technical problem that the stability of the microservice application system is affected by the microservice chain tracing technology. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the service chain tracing method provided by the above-mentioned embodiment, and will not be repeated here.

[0185] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned service chain tracking method when executed by a processor.

[0186] The computer program product provided by this application can solve the technical problem that the microservice chain tracking technology affects the stability of the microservice application system. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the service chain tracking method provided by the above embodiment, which will not be repeated here.

[0187] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A service chain tracking method, characterized in that: The service chain tracking method comprises: When the microservice component to be called receives a component call request, the root span data is determined based on the component call request through a preset tracker instance, a first initial span is created through the tracker instance, and the root span data is added to the first initial span to obtain a root span; wherein the root span data at least includes context information, and the context information is used to identify the call path of the microservice component to be called; When the microservice component to be called generates a service call request, the context information is added to the service call request through the tracker instance to obtain a target request; When the target request reaches the target microservice component corresponding to the target request, the subspan data is determined based on the target request by the tracker instance, a second initial span is created by the tracker instance, and the subspan data is added to the second initial span to obtain a subspan; wherein the subspan data includes at least the context information; Acquire the root span and the subspan through a preset tracing probe, determine tracing data based on the root span and the subspan, and generate a target service chain based on the tracing data; Among them, when the microservice component to be called receives a component call request, the root span data is determined based on the component call request through a preset tracker instance, and before the step of creating a first initial span through the tracker instance and adding the root span data to the first initial span to obtain the root span, it also includes: Determine the application programming language of the microservice component to be called, and add a tracing probe dependency in the dependency management of the microservice component to be called through the application programming language; Adding probe configuration information to the dependent probe in the component configuration file of the microservice component to be called, wherein the probe configuration information is used to characterize the operation mode of the dependent probe for data tracking; When the microservice component to be called is started, a probe is injected into the microservice component to be called as a preset tracing probe; Add the tracker dependency in the dependency management; When the microservice component to be called is started, a running instance is created based on the dependent tracker, and the running instance is used as the preset tracker instance.

2. The service chain tracking method according to claim 1, characterized in that: The step of creating a second initial span through the tracker instance and adding the subspan data to the second initial span to obtain a subspan includes: Parsing the target request to obtain a calling task, and if the calling task is an asynchronous task, marking the calling task by using a preset asynchronous task tracking annotation to obtain a marked task; When the target microservice component executes the labeling task, the context information carried by the target request is saved through a preset context capturer, and a second initial span is created through the tracker instance; When the target microservice component completes the labeling task, the context information is obtained from the context capturer, and the context information is added as subspan data to the second initial span through the tracker instance to obtain a subspan.

3. The service chain tracking method according to claim 1, characterized in that: The steps of generating a service chain based on the tracking data include: Enable Gzip compression in a probe configuration file of the tracing probe, and create a Gzip output stream and a Gzip input stream based on the Gzip compression; Compressing the tracking data according to a preset compression level through the Gzip output stream to obtain compressed data; Upon receiving a service chain generation instruction carrying a target identifier, obtaining the compressed data from the compressed data storage space based on the target identifier, wherein the target identifier is an identity identifier corresponding to the component call request; The compressed data is decompressed through the Gzip input stream to obtain decompressed data, and a target service chain is generated based on the decompressed data.

4. The service chain tracking method according to claim 1, characterized in that: The tracking data includes a service chain tag; After the step of generating a target service chain based on the tracking data, the method further includes: Storing the target service chain in a preset service chain storage space; When receiving a service chain search instruction, parsing the service chain search instruction to obtain a search tag; A retrieval service chain whose service chain tag matches the retrieval tag is determined from a plurality of service chains in the service chain storage space, and the retrieval service chain is processed according to the service chain retrieval instruction.

5. The service chain tracking method according to any one of claims 1 to 4, characterized in that: After the step of obtaining the root span and the subspan by using a preset tracing probe, the method further includes: Monitoring whether the tracking data reaches a preset warning threshold; In the case where the tracking data reaches the warning threshold, abnormal data is determined from the tracking data, and warning information is generated based on the abnormal data.

6. A service chain tracking device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the service chain tracking method according to any one of claims 1 to 5.

7. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the service chain tracking method according to any one of claims 1 to 5 are implemented.

8. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the service chain tracking method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Intelligent distributed tracking context injection

    CN116057512A

  • Method for tracking service call chain based on Opentracing link

    CN116192621A