Microservice link tracking processing method, coordination device and service gateway

By introducing a coordination device into the microservice system to coordinate the allocation of TraceIDs across multiple service gateways, the problem of non-unique TraceIDs is solved, achieving globally unique TraceID allocation and ensuring the accuracy of tracing in the microservice system.

CN116170487BActive Publication Date: 2025-12-09CHINA MOBILE COMM LTD RES INST +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111412030.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-25
Publication Date
2025-12-09
Estimated Expiration
2041-11-25

AI Technical Summary

Technical Problem

In microservice systems with multiple microservice groups, existing tracing schemes result in non-unique TraceIDs.

Method used

A coordination device is introduced to coordinate the allocation of TraceIDs among multiple service gateways, and the uniqueness of TraceIDs is ensured through pre-configured or real-time allocation algorithms.

Benefits of technology

In multi-microservice group scenarios, the global uniqueness of TraceID is achieved, ensuring the accuracy of tracing in microservice systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116170487B_ABST
    Figure CN116170487B_ABST
Patent Text Reader

Abstract

The application provides a micro-service link tracking processing method, a coordination device and a service gateway. The method comprises the following steps: the coordination device receives a first request message sent by the service gateway, wherein the first request message is used for requesting the coordination device to allocate a tracking ID; the coordination device allocates a tracking ID for the service gateway from the allocatable tracking IDs according to the first request message, so that the tracking IDs of various service requests in the micro-service system are unique; and the embodiment of the application introduces the coordination device, which is responsible for coordinating the tracking ID allocation between the entry service gateways of multiple micro-service groups, so as to ensure the uniqueness of the tracking IDs in the micro-service system.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of communication technology, in particular to a micro-service link tracking processing method, a coordination device and a service gateway. BACKGROUND

[0002] In a micro-service scenario, a traditional application will be composed of multiple micro-services, and the micro-services call each other. When the application has a problem, it is difficult to find the root cause from the complex micro-service call network.

[0003] Link tracking is to solve this problem, by recording the hierarchical relationship, call order and timestamp information between services, and stringing multiple services together. Specifically, it includes the following points:

[0004] 1. TraceID: identifies all services called in this request, and is generated by the consumer at the beginning of the micro-service call and inserted into the request message.

[0005] 2. SpanID: identifies the order of the called services.

[0006] 3. ParentID: identifies the hierarchical relationship of the call.

[0007] 4. Timestamp: identifies the timestamp when the call is initiated / received and the timestamp when the call is returned / received. The commonly used timestamps are as follows:

[0008] a) Client Sent (cs for short), which refers to the client initiating a call request to the server.

[0009] b) Server Received (sr for short), which refers to the server receiving the client's call request.

[0010] c) Server Sent (ss for short), which refers to the server completing the processing and preparing to return information to the client.

[0011] d) Client Received (cr for short), which refers to the client receiving the server's return information.

[0012] The above link tracking scheme allocates and inserts TraceID into the request message at the gateway of the micro-service group (or micro-service cluster, which refers to the combination of micro-services after the same gateway (or entry)) to identify the uniqueness of the service link. However, the existing link tracking scheme has the problem of non-unique TraceID in the case of multiple micro-service groups. For example, the possible scenario is as follows:

[0013] 1. Microservice calls exist between microservice groups. The gateway for each microservice group checks if the request message contains a TraceID. If not, a TraceID is assigned and inserted into the request message; otherwise, no new TraceID is assigned. Assigning TraceIDs independently to each entry point may result in non-unique TraceIDs throughout the system.

[0014] 2. If there are no microservice calls between microservice groups, each microservice group entry point will be assigned a TraceID independently, which may result in non-unique TraceIDs throughout the system. Summary of the Invention

[0015] The purpose of this invention is to provide a microservice tracing processing method, coordination device, and service gateway to solve the problem of non-unique TraceIDs in microservice systems comprising multiple microservice groups in the prior art.

[0016] To address the aforementioned problems, embodiments of the present invention provide a microservice tracing processing method, executed by a coordinating device, comprising:

[0017] The system receives a first request message sent by the service gateway, the first request message being used to request the coordination device to allocate a tracking ID;

[0018] Based on the first request message, a tracing ID is allocated to the service gateway from the available tracing IDs so that the tracing IDs of each service request in the microservice system are unique.

[0019] The first request message sent by the receiving service gateway includes:

[0020] The first request message is received when the service gateway goes online or when all pre-allocated tracking IDs have been allocated.

[0021] Specifically, allocating a tracking ID to the service gateway from the available tracking IDs according to the first request message includes:

[0022] Based on the allocatable tracking IDs and the pre-configured allocation algorithm, a target number of tracking IDs are selected and returned to the service gateway.

[0023] The first request message sent by the receiving service gateway includes:

[0024] The service gateway receives the first request message when the received service request message does not include a tracking ID.

[0025] Specifically, allocating a tracking ID to the service gateway from the available tracking IDs according to the first request message includes:

[0026] According to the allocable tracking ID and a preconfigured allocation algorithm, a tracking ID is selected to return to the service gateway.

[0027] The preconfigured allocation algorithm comprises:

[0028] Tracking ID allocation is performed according to the storage order of the allocable tracking ID.

[0029] Alternatively,

[0030] Tracking ID allocation is performed in sequence or randomly from a tracking ID range preallocated to each service gateway.

[0031] The embodiment of the application further provides a micro-service link tracking processing method, executed by a service gateway, comprising:

[0032] A first request message is sent to a coordination device, and the first request message is used to request the coordination device to allocate a tracking ID.

[0033] The tracking ID allocated by the coordination device is received, and the tracking ID allocated by the coordination device can make tracking IDs of various service requests in a micro-service system unique.

[0034] The first request message is sent to the coordination device, comprising:

[0035] The first request message is sent to the coordination device when the service gateway is online or preallocated tracking ID allocation is completed.

[0036] Alternatively,

[0037] The first request message is sent to the coordination device when the service request message received by the service gateway does not include a tracking ID.

[0038] The method further comprises:

[0039] It is judged whether the service request message received includes a tracking ID.

[0040] When the service request message received does not include a tracking ID, a tracking ID is selected from the tracking ID allocated by the coordination device, inserted into the service request message, and sent to a corresponding micro-service.

[0041] The embodiment of the application further provides a coordination device, comprising:

[0042] A first receiving unit is configured to receive a first request message sent by a service gateway, and the first request message is used to request the coordination device to allocate a tracking ID.

[0043] The processing unit is configured to allocate a tracking ID for the service gateway from the available tracking IDs according to the first request message, so that the tracking IDs of the service requests in the micro-service system are unique.

[0044] The embodiment of the application further provides a coordination device, comprising a processor and a transceiver, wherein the transceiver receives and sends data under the control of the processor, and the processor is configured to perform the following operations:

[0045] receiving a first request message sent by a service gateway, wherein the first request message is used to request the coordination device to allocate a tracking ID;

[0046] allocating a tracking ID for the service gateway from the available tracking IDs according to the first request message, so that the tracking IDs of the service requests in the micro-service system are unique.

[0047] The processor is further configured to perform the following operations:

[0048] receiving the first request message sent by the service gateway when the service gateway is online or when the pre-allocated tracking ID is allocated.

[0049] The processor is further configured to perform the following operations:

[0050] selecting a target number of tracking IDs from the available tracking IDs according to the pre-configured allocation algorithm and returning the tracking IDs to the service gateway.

[0051] The processor is further configured to perform the following operations:

[0052] receiving the first request message sent by the service gateway when the service gateway does not include a tracking ID in the received service request message.

[0053] The processor is further configured to perform the following operations:

[0054] selecting one tracking ID from the available tracking IDs according to the pre-configured allocation algorithm and returning the tracking ID to the service gateway.

[0055] The pre-configured allocation algorithm comprises:

[0056] allocating the tracking ID according to the storage order of the available tracking IDs;

[0057] or,

[0058] allocating the tracking ID in sequence or randomly from a tracking ID range pre-allocated to each service gateway.

[0059] The embodiment of the application further provides a service gateway, comprising:

[0060] The first sending unit sends a first request message to the coordination device, and the first request message is used to request the coordination device to allocate a tracking ID;

[0061] The second receiving unit is configured to receive the tracking ID allocated by the coordination device, and the tracking ID allocated by the coordination device can make the tracking IDs of service requests in the micro-service system unique.

[0062] The embodiment of the application further provides a service gateway, comprising a processor and a transceiver, wherein the transceiver receives and sends data under the control of the processor, and the processor is used to perform the following operations:

[0063] The first sending unit sends a first request message to the coordination device, and the first request message is used to request the coordination device to allocate a tracking ID;

[0064] The second receiving unit is configured to receive the tracking ID allocated by the coordination device, and the tracking ID allocated by the coordination device can make the tracking IDs of service requests in the micro-service system unique.

[0065] The processor is further used to perform the following operations:

[0066] The first sending unit sends the first request message to the coordination device when the service gateway is online or the pre-allocated tracking ID is allocated.

[0067] Or,

[0068] The first sending unit sends the first request message to the coordination device when the service request message received by the service gateway does not include a tracking ID.

[0069] The processor is further used to perform the following operations:

[0070] The processor judges whether the service request message received includes a tracking ID.

[0071] The processor inserts a tracking ID selected from the tracking IDs allocated by the coordination device into the service request message and sends the service request message to the corresponding micro-service when the service request message received does not include a tracking ID.

[0072] The embodiment of the application further provides a communication device, comprising a memory, a processor and a program stored in the memory and executable on the processor, and the processor implements the processing method of the micro-service link tracking when executing the program.

[0073] The embodiment of the application further provides a computer readable storage medium, which stores a computer program, and the program is executed by the processor to implement the steps in the processing method of the micro-service link tracking.

[0074] The above technical solutions of the present application have at least the following beneficial effects:

[0075] In the microservice link tracking processing method, the coordination device and the service gateway provided by the embodiments of the present application, in a microservice system including multiple microservice groups, the coordination device is introduced to be responsible for coordinating the allocation of tracking IDs between the entry service gateways of multiple microservice groups, so as to ensure the uniqueness of tracking IDs in the microservice system. BRIEF DESCRIPTION OF DRAWINGS

[0076] Figure 1 A system architecture diagram of a microservice system provided by an embodiment of the present application is shown;

[0077] Figure 2 One of the step flowcharts of a microservice link tracking processing method provided by an embodiment of the present application is shown;

[0078] Figure 3 An example diagram of the coordination device pre-allocating TraceIDs in the microservice link tracking processing method provided by an embodiment of the present application is shown;

[0079] Figure 4 An example diagram of the service gateway requesting TraceID allocation in real time in the microservice link tracking processing method provided by an embodiment of the present application is shown;

[0080] Figure 5 The second step flowchart of the microservice link tracking processing method provided by an embodiment of the present application is shown;

[0081] Figure 6 One of the structural schematic diagrams of the coordination device provided by an embodiment of the present application is shown;

[0082] Figure 7 The second structural schematic diagram of the coordination device provided by an embodiment of the present application is shown;

[0083] Figure 8 One of the structural schematic diagrams of the service gateway provided by an embodiment of the present application is shown;

[0084] Figure 9 The second structural schematic diagram of the service gateway provided by an embodiment of the present application is shown. DETAILED DESCRIPTION

[0085] To make the technical problems, technical solutions and advantages of the present application clearer, specific embodiments will be described in detail below with reference to the accompanying drawings.

[0086] Reference should be made to Figure 1 , Figure 1 A system architecture diagram of a microservice system provided by an embodiment of the present application is shown. The system includes:

[0087] a plurality of microservice groups (such as microservice group 1, microservice group 2), each microservice group including a service gateway and at least one microservice;

[0088] a coordination device connected with the plurality of service gateways respectively;

[0089] The coordination device is configured to coordinate the allocation of TraceIDs among the plurality of service gateways, so that the TraceIDs of various service requests in the microservice system are unique.

[0090] The service gateway is a connection between the microservice group and the outside, and all external requests enter the microservice group through the service gateway, and internal responses are returned to the request initiator through the service gateway. The microservice is a logical entity that provides services. The request initiator is located outside the microservice group and is a logical entity that sends a request message to the service gateway and receives a response message returned by the logical entity of the service gateway.

[0091] In at least one embodiment of the present application, the coordination device mainly includes four functional modules, a receiving functional module, a sending functional module, a processing functional module, and a storage functional module. The receiving functional module is configured to receive relevant request messages, the sending functional module is configured to send relevant response messages, the processing functional module is configured to process request messages, and the storage functional module is configured to store TraceID information, including allocatable TraceID information and used TraceID information.

[0092] Based on the microservice system in Figure 1 , please refer to Figure 2 , Figure 2 A step flowchart of a processing method for microservice link tracking is provided for an embodiment of the present application, and the processing method is executed by a coordination device, including:

[0093] Step 201: receiving a first request message sent by a service gateway, the first request message being used to request the coordination device to allocate a TraceID;

[0094] Step 202: allocating a TraceID for the service gateway from allocatable TraceIDs according to the first request message, so that the TraceIDs of various service requests in the microservice system are unique.

[0095] In an embodiment of the present application, in order to ensure the uniqueness of the TraceIDs in the microservice system, the coordination device needs to coordinate the allocation of TraceIDs among the plurality of service gateways, so that the plurality of microservice groups have globally unique TraceIDs; and the current link tracking scheme is slightly changed and is non-intrusive.

[0096] As an optional embodiment, step 201 comprises:

[0097] The first request message is sent when the service gateway is online or the pre-allocated TraceID allocation is complete.

[0098] Correspondingly, step 202 comprises:

[0099] According to the allocable TraceID and the pre-configured allocation algorithm, a target number of TraceIDs are selected and returned to the service gateway.

[0100] The target number can be the number of requests carried in the first request message or a number pre-configured by the coordination device, which is not specifically limited here.

[0101] This embodiment is a scheme in which the coordination device pre-allocates TraceIDs, that is, the service gateway pre-requests the coordination device to allocate TraceIDs in the case where the service gateway does not receive a service request. For example, after the TraceID number pre-allocated by the gateway is used up, the coordination device is requested to allocate a TraceID number; the coordination device returns a certain number of TraceIDs to the service gateway based on a pre-configured allocation algorithm.

[0102] See Figure 3 , Figure 3 An example diagram in which the coordination device pre-allocates TraceIDs, and a processing method of micro-service link tracking comprises:

[0103] Step 301: When the service gateway is online or the TraceID is used up, the coordination device is requested to allocate a TraceID range;

[0104] Step 302: The coordination device returns the allocated TraceID range to the service gateway;

[0105] Step 303: The service initiator sends a service request to the service gateway;

[0106] Step 304(a): If there is no TraceID in the service request, a TraceID is allocated in sequence or randomly from the TraceID range allocated by the coordination device, the service request is inserted, and the service request is sent to the corresponding micro-service;

[0107] Step 304(b): If there is a TraceID in the service request, the service request is directly sent to the corresponding micro-service;

[0108] Step 305: The micro-service returns a response to the service gateway;

[0109] Step 306: The service gateway returns a response to the service initiator.

[0110] As another optional embodiment of the present application, step 201 comprises:

[0111] receiving the first request message sent by the service gateway in the case that the received service request message does not include a trace ID.

[0112] Correspondingly, step 202 comprises:

[0113] selecting a trace ID according to the allocable trace ID and a preconfigured allocation algorithm and returning the trace ID to the service gateway.

[0114] This embodiment is a scheme for the service gateway to request real-time allocation of a TraceID, that is, the service gateway requests the coordination device to allocate a TraceID in the case of receiving a service request. For example, the service gateway receives a service request message without a TraceID, which indicates that the request message enters the microservice system for the first time and needs to be allocated a TraceID. Therefore, the service gateway applies for a TraceID from the coordination device in real time. The coordination device selects a TraceID according to a preconfigured allocation algorithm by querying the available TraceIDs and returns the TraceID to the service gateway.

[0115] Please refer to Figure 4 , Figure 4 For an example diagram of the service gateway to request real-time allocation of a TraceID, the processing method of the corresponding microservice link tracking comprises:

[0116] Step 401: The service initiator sends a service request to the service gateway; if the service request does not include a TraceID, steps 402(a)-402(c) are performed; if the service request includes a TraceID, step 403 is performed.

[0117] Step 402(a): The service request does not include a TraceID, and the service gateway requests the coordination device to allocate a TraceID.

[0118] Step 402(b): The coordination device returns the allocated TraceID to the service gateway.

[0119] Step 402(c): The TraceID allocated by the coordination device is inserted into the service request, and the service request is sent to the corresponding microservice.

[0120] Step 403: If the service request includes a TraceID, the service request is directly sent to the corresponding microservice.

[0121] Step 404: The microservice returns a response to the service gateway.

[0122] Step 405: The service gateway returns a response to the service initiator.

[0123] In at least one embodiment of the present application, the pre-configuration allocation algorithm comprises:

[0124] allocating the trace ID according to a storage order of the allocable trace ID; wherein the storage order can be from small to large, from large to small, no size order, etc.

[0125] Or,

[0126] allocating the trace ID in sequence or randomly from the trace ID range pre-allocated to each service gateway; for example, the coordination device pre-allocates the allocable TraceID range of the service gateway (the range can be exclusive or shared), when the service gateway applies for allocation of a new TraceID, the coordination device allocates a certain number of TraceIDs in sequence or randomly from the allocable TraceID range. The sequence can be the storage order of the TraceID, the size order of the TraceID, etc., which is not limited here.

[0127] In summary, in the micro-service system comprising multiple micro-service groups, the embodiment of the present application introduces a coordination device to be responsible for coordinating the allocation of trace IDs between the entry service gateways of multiple micro-service groups, and ensures the uniqueness of the trace IDs in the micro-service system.

[0128] As shown in Figure 5 The embodiment of the present application also provides a micro-service link tracking processing method, which is executed by a service gateway and comprises:

[0129] Step 501, sending a first request message to a coordination device, wherein the first request message is used to request the coordination device to allocate a trace ID (TraceID);

[0130] Step 502, receiving the trace ID allocated by the coordination device, wherein the trace ID allocated by the coordination device can make the trace IDs of each service request in the micro-service system have uniqueness.

[0131] In the embodiment of the present application, in order to ensure the uniqueness of the TraceID in the micro-service system, the coordination device needs to coordinate the allocation of the TraceID between multiple service gateways, so as to make the TraceID in the multiple micro-service group scenario have global uniqueness; and the embodiment of the present application has little change to the current link tracking scheme and is non-invasive.

[0132] As an optional embodiment, step 501 comprises:

[0133] After the service gateway is online or the pre-allocated trace ID is allocated, the first request message is sent to the coordination device; this embodiment is a scheme for pre-allocating a trace ID by the coordination device, that is, the service gateway pre-requests the coordination device to allocate a trace ID in the case where the service gateway does not receive a service request. For example, after the gateway is online or the pre-allocated trace ID number is used up, the coordination device is requested to allocate a trace ID number; the coordination device returns a certain number of trace IDs to the service gateway based on a preconfigured allocation algorithm.

[0134] Alternatively, step 501 comprises:

[0135] In the case where the service request message received by the service gateway does not include a trace ID, the first request message is sent to the coordination device. This embodiment is a scheme for the service gateway to request real-time allocation of a trace ID, that is, the service gateway requests the coordination device to allocate a trace ID in the case where the service gateway receives a service request. For example, the service request message received by the service gateway does not include a trace ID, which indicates that this request message enters the microservice system for the first time and needs to be allocated a trace ID, so the service gateway applies for a trace ID from the coordination device in real time. The coordination device selects a trace ID according to a preconfigured allocation algorithm by querying available trace IDs and returns the trace ID to the service gateway.

[0136] Further, in the embodiment of the application, the method further comprises:

[0137] determining whether the received service request message includes a trace ID;

[0138] In the case where the received service request message does not include a trace ID, a trace ID is selected from the trace IDs allocated by the coordination device and inserted into the service request message and sent to the corresponding microservice.

[0139] To sum up, in the microservice system including multiple microservice groups, the embodiment of the application introduces a coordination device to be responsible for the allocation of trace IDs between the entry service gateways of multiple microservice groups, so as to ensure the uniqueness of the trace IDs in the microservice system.

[0140] As shown in FIG. 6, the embodiment of the application also provides a coordination device, which comprises: Figure 6 a first receiving unit 601, configured to receive a first request message sent by a service gateway, the first request message being used to request the coordination device to allocate a trace ID;

[0141]

[0142] ​The processing unit 602 is configured to allocate a tracking ID for the service gateway from the allocatable tracking IDs according to the first request message, so that the tracking IDs of various service requests in the micro-service system are unique.

[0143] As an optional embodiment, the first receiving unit comprises:

[0144] The first receiving sub-unit is configured to receive the first request message sent by the service gateway when the tracking ID pre-allocated by the service gateway is allocated.

[0145] As an optional embodiment, the processing unit comprises:

[0146] The first processing sub-unit is configured to select a target number of tracking IDs according to the allocatable tracking IDs and a pre-configured allocation algorithm and return the tracking IDs to the service gateway.

[0147] As an optional embodiment, the first receiving unit comprises:

[0148] The second receiving sub-unit is configured to receive the first request message sent by the service gateway when the tracking ID is not included in the received service request message.

[0149] As an optional embodiment, the processing unit comprises:

[0150] The second processing sub-unit is configured to select one tracking ID according to the allocatable tracking IDs and a pre-configured allocation algorithm and return the tracking ID to the service gateway.

[0151] As an optional embodiment, the pre-configured allocation algorithm comprises:

[0152] The tracking ID is allocated according to the storage order of the allocatable tracking IDs.

[0153] Or,

[0154] The tracking ID is allocated in sequence or randomly from the tracking ID range pre-allocated to the various service gateways.

[0155] In the micro-service system comprising multiple micro-service groups, the embodiment of the application introduces a coordination device responsible for coordinating the tracking ID allocation between the entry service gateways of multiple micro-service groups, so as to ensure the uniqueness of the tracking ID in the micro-service system.

[0156] It should be noted that the coordination device provided by the embodiment of the application is a coordination device capable of performing the processing method of the micro-service link tracking, and all embodiments of the processing method of the micro-service link tracking are applicable to the coordination device and can achieve the same or similar beneficial effects.

[0157] AsFigure 7 As shown, the embodiment of the present application further provides a coordination device, comprising a processor 700 and a transceiver 710, the transceiver 710 receiving and sending data under the control of the processor 700, and the processor 700 being configured to perform the following operations:

[0158] receiving a first request message sent by a service gateway, the first request message being used to request the coordination device to allocate a tracking ID;

[0159] allocating a tracking ID for the service gateway from the allocatable tracking IDs according to the first request message, so that the tracking IDs of various service requests in the micro-service system are unique.

[0160] As an optional embodiment, the processor is further configured to perform the following operation:

[0161] receiving the first request message sent by the service gateway when the service gateway is online or when the pre-allocated tracking ID allocation is completed.

[0162] As an optional embodiment, the processor is further configured to perform the following operation:

[0163] selecting a target number of tracking IDs to return to the service gateway according to the allocatable tracking IDs and a pre-configured allocation algorithm.

[0164] As an optional embodiment, the processor is further configured to perform the following operation:

[0165] receiving the first request message sent by the service gateway when the tracking ID is not included in the received service request message.

[0166] As an optional embodiment, the processor is further configured to perform the following operation:

[0167] selecting one tracking ID to return to the service gateway according to the allocatable tracking IDs and a pre-configured allocation algorithm.

[0168] As an optional embodiment, the pre-configured allocation algorithm comprises:

[0169] allocating the tracking ID according to the storage order of the allocatable tracking IDs;

[0170] or,

[0171] allocating the tracking ID in sequence or randomly from the tracking ID range pre-allocated to each service gateway.

[0172] The embodiment of the application is applied to a micro-service system including multiple micro-service groups, and introduces a coordination device to be responsible for coordinating the allocation of tracking IDs between entry service gateways of multiple micro-service groups, so as to ensure the uniqueness of tracking IDs in the micro-service system.

[0173] It should be noted that the coordination device provided by the embodiment of the application is a coordination device capable of performing the processing method of micro-service link tracking, and all the embodiments of the processing method of micro-service link tracking are applicable to the coordination device, and can achieve the same or similar beneficial effects.

[0174] As shown in Figure 8 The embodiment of the application also provides a service gateway, which comprises:

[0175] A first sending unit 801 is configured to send a first request message to the coordination device, and the first request message is used to request the coordination device to allocate a tracking ID.

[0176] A second receiving unit 802 is configured to receive the tracking ID allocated by the coordination device, and the tracking ID allocated by the coordination device can ensure the uniqueness of tracking IDs of various service requests in the micro-service system.

[0177] As an optional embodiment, the first sending unit comprises:

[0178] A sending sub-unit is configured to send the first request message to the coordination device in the case that the service gateway is online or the pre-allocated tracking ID is allocated.

[0179] Or, the sending sub-unit is configured to send the first request message to the coordination device in the case that the service request message received by the service gateway does not include a tracking ID.

[0180] As an optional embodiment, the service gateway further comprises:

[0181] A judging unit is configured to judge whether the service request message received includes a tracking ID.

[0182] A second sending unit is configured to select a tracking ID from the tracking IDs allocated by the coordination device and insert the tracking ID into the service request message and send the service request message to a corresponding micro-service in the case that the service request message received does not include a tracking ID.

[0183] The embodiment of the application is applied to a micro-service system including multiple micro-service groups, and introduces a coordination device to be responsible for coordinating the allocation of tracking IDs between entry service gateways of multiple micro-service groups, so as to ensure the uniqueness of tracking IDs in the micro-service system.

[0184] It should be noted that the service gateway provided by the embodiment of the present application is a service gateway capable of performing the processing method of the micro-service link tracking, and all embodiments of the processing method of the micro-service link tracking are applicable to the service gateway, and can achieve the same or similar beneficial effects.

[0185] As shown in Figure 9 The embodiment of the present application also provides a service gateway, which comprises a processor 900 and a transceiver 910, the transceiver 910 receives and sends data under the control of the processor 900, and the processor 900 is used for performing the following operations:

[0186] sending a first request message to the coordination device, the first request message being used for requesting the coordination device to allocate a tracking ID;

[0187] receiving the tracking ID allocated by the coordination device, wherein the tracking ID allocated by the coordination device can make the tracking IDs of various service requests in the micro-service system unique.

[0188] As an optional embodiment, the processor is further used for performing the following operations:

[0189] sending the first request message to the coordination device in the case that the service gateway is online or the pre-allocated tracking ID is allocated completely;

[0190] Or,

[0191] sending the first request message to the coordination device in the case that the service request message received by the service gateway does not include a tracking ID.

[0192] As an optional embodiment, the processor is further used for performing the following operations:

[0193] judging whether the received service request message includes a tracking ID or not;

[0194] in the case that the received service request message does not include a tracking ID, selecting a tracking ID from the tracking IDs allocated by the coordination device, inserting the tracking ID into the service request message, and sending the service request message to the corresponding micro-service.

[0195] In the micro-service system comprising multiple micro-service groups, the embodiment of the present application introduces a coordination device, which is responsible for coordinating the allocation of tracking IDs between the entry service gateways of multiple micro-service groups, and guarantees the uniqueness of the tracking IDs in the micro-service system.

[0196] It should be noted that the service gateway provided by the embodiment of the present application is a service gateway capable of performing the processing method of the micro-service link tracking, and all embodiments of the processing method of the micro-service link tracking are applicable to the service gateway, and can achieve the same or similar beneficial effects.

[0197] The embodiment of the present application also provides a communication device which is a coordination device or a service gateway, the communication device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing each process in the processing method embodiment of the micro-service link tracking and achieving the same technical effects when executing the program, and details are not repeated here to avoid repetition.

[0198] The embodiment of the present application also provides a computer readable storage medium having a computer program stored thereon, the program implementing each process in the processing method embodiment of the micro-service link tracking and achieving the same technical effects when executed by a processor, and details are not repeated here to avoid repetition. The computer readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0199] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system or a computer program product. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer readable storage media (including, but not limited to, disk storage and optical storage, etc.) containing computer usable program code.

[0200] The present application is described with reference to the flowcharts and / or block diagrams according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing apparatus to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing apparatus produce a device implemented in the flowcharts and / or block diagrams. Figure 1 The device specified in one flow or multiple flows and / or one block or multiple blocks.

[0201] These computer program instructions can also be stored in a computer readable storage medium capable of guiding a computer or other programmable data processing apparatus to work in a specific manner, so that the instructions stored in the computer readable storage medium produce a product of manufacture including an instruction device, which implements the functions specified in the flowcharts and / or block diagrams. Figure 1 The device specified in one flow or multiple flows and / or one block or multiple blocks. Figure 1 The device specified in one flow or multiple flows and / or one block or multiple blocks.

[0202] These computer program instructions can also be loaded into computer or other programmable data processing devices, so that a series of operational steps are performed on the computer or other programmable data processing devices to generate computer-implemented processes, thus the instructions executed on the computer or other programmable data processing devices provide processes for implementing the functions specified in the flowchart Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0203] The above is the preferred embodiment of the present application, it should be pointed out that, for those skilled in the art, without departing from the principles of the present application, can also make a number of improvements and refinements, these improvements and refinements should also be considered as the protection scope of the present application.

Claims

1. A processing method of microservice chain link tracing, executed by a coordination device, characterized in that, The method comprises: receiving a first request message sent by a service gateway, the first request message being used for requesting the coordination device to allocate a tracking ID; allocating a tracking ID for the service gateway from the allocatable tracking IDs according to the first request message, so that the tracking IDs of various service requests in the micro-service system are unique; The receiving of the first request message sent by the service gateway comprises: receiving the first request message sent by the service gateway in the case that the tracking ID is not included in the received service request message.

2. The method of claim 1, wherein, The receiving of the first request message sent by the service gateway further comprises: receiving the first request message sent by the service gateway in the case that the tracking IDs pre-allocated by the service gateway are all allocated.

3. The method of claim 2, wherein, The allocating of the tracking ID for the service gateway from the allocatable tracking IDs according to the first request message comprises: selecting a target number of tracking IDs according to the allocatable tracking IDs and a pre-configured allocation algorithm and returning the tracking IDs to the service gateway.

4. The method of claim 1, wherein, The allocating of the tracking ID for the service gateway from the allocatable tracking IDs according to the first request message comprises: selecting one tracking ID according to the allocatable tracking IDs and a pre-configured allocation algorithm and returning the tracking ID to the service gateway.

5. The method according to claim 3 or 4, characterized in that, The pre-configured allocation algorithm comprises: allocating the tracking ID according to the storage order of the allocatable tracking IDs; or, sequentially or randomly allocating the tracking ID from the tracking ID range pre-allocated to each service gateway.

6. A method for microservice tracing, executed by a service gateway, characterized in that, The method comprises: sending a first request message to a coordination device, the first request message being used for requesting the coordination device to allocate a tracking ID; receiving a tracking ID allocated by the coordination device, wherein the tracking ID allocated by the coordination device can make the tracking IDs of various service requests in the micro-service system unique; The sending of the first request message to the coordination device comprises: sending the first request message to the coordination device in the case that the tracking ID is not included in the service request message received by the service gateway.

7. The method of claim 6, wherein, The sending of the first request message to the coordination device further comprises: sending the first request message to the coordination device in the case that the tracking IDs pre-allocated by the service gateway are all allocated.

8. The method of claim 6, wherein, The method further comprises: judging whether the tracking ID is included in the received service request message; in the case that the tracking ID is not included in the received service request message, selecting one tracking ID from the tracking IDs allocated by the coordination device, inserting the tracking ID into the service request message, and sending the service request message to the corresponding micro-service.

9. A coordinating device, characterized by The method comprises: a first receiving unit, configured to receive a first request message sent by a service gateway, the first request message being used for requesting the coordination device to allocate a tracking ID; a processing unit, configured to allocate a tracking ID for the service gateway from the allocatable tracking IDs according to the first request message, so that the tracking IDs of various service requests in the micro-service system are unique; The first receiving unit is further configured to receive the first request message sent by the service gateway in the case that the tracking ID is not included in the received service request message.

10. A coordinating device comprising a processor and a transceiver that receives and transmits data under control of the processor, characterized in that, The processor is configured to perform the following operations: receive a first request message sent by a service gateway, the first request message being used to request the coordination device to allocate a trace ID; allocate a trace ID for the service gateway from the allocable trace IDs according to the first request message, so that the trace IDs of service requests in the micro-service system are unique; the processor is further configured to perform the following operation: receive the first request message sent by the service gateway in a case that the service request message received by the service gateway does not include a trace ID.

11. The coordinating device of claim 10, wherein, the processor is further configured to perform the following operation: receive the first request message sent by the service gateway in a case that the service gateway is online or the pre-allocated trace IDs are allocated.

12. The coordinating device of claim 11, wherein, the processor is further configured to perform the following operation: select a target number of trace IDs according to the allocable trace IDs and a pre-configured allocation algorithm, and return the target number of trace IDs to the service gateway.

13. The coordinating device of claim 10, wherein, the processor is further configured to perform the following operation: select a trace ID according to the allocable trace IDs and a pre-configured allocation algorithm, and return the trace ID to the service gateway.

14. The coordinating device according to claim 12 or 13, characterized in that, the pre-configured allocation algorithm includes: allocate the trace IDs in the storage order of the allocable trace IDs; or, allocate the trace IDs in sequence or randomly from a trace ID range pre-allocated to each service gateway.

15. A service gateway, characterized by includes: a first sending unit configured to send a first request message to a coordination device, the first request message being used to request the coordination device to allocate a trace ID; a second receiving unit configured to receive a trace ID allocated by the coordination device, wherein the trace ID allocated by the coordination device can make the trace IDs of service requests in a micro-service system unique. the first sending unit is further configured to send the first request message to the coordination device in a case that a service request message received by the service gateway does not include a trace ID.

16. A service gateway comprising a processor and a transceiver, the transceiver receiving and transmitting data under control of the processor, characterized in that, the processor is configured to perform the following operation: send a first request message to a coordination device, the first request message being used to request the coordination device to allocate a trace ID; receive a trace ID allocated by the coordination device, wherein the trace ID allocated by the coordination device can make the trace IDs of service requests in a micro-service system unique. send the first request message to the coordination device in a case that a service request message received by the service gateway does not include a trace ID.

17. The service gateway of claim 16, wherein, the processor is further configured to perform the following operation: send the first request message to the coordination device in a case that the service gateway is online or the pre-allocated trace IDs are allocated.

18. The serving gateway of claim 16, wherein, the processor is further configured to perform the following operation: determine whether a service request message received includes a trace ID; in a case that the service request message received does not include a trace ID, select a trace ID from the trace IDs allocated by the coordination device, insert the trace ID into the service request message, and send the service request message to a corresponding micro-service.

19. A communication device comprising a memory, a processor, and a program stored on the memory and executable on the processor; characterized in that, the processor implements the processing method of the micro-service link tracking according to any one of claims 1-5 or the processing method of the micro-service link tracking according to any one of claims 6-8 when the processor executes the program.

20. A computer readable storage medium having stored thereon a computer program, characterized in that, The program, when executed by the processor, implements the steps in the processing method of microservice link tracking according to any one of claims 1-5, or implements the steps in the processing method of microservice link tracking according to any one of claims 6-8.

Citation Information

Patent Citations

  • Distribution method and device for identification value

    CN105812248A

  • Method and system used for processing log

    CN106850782A