Method and equipment for processing observation data of micro service

By adding specific identifiers to the log and microservice call link data, the association between log and microservice call link data is realized, and the problem of difficulty in unified query and analysis in the prior art is solved, which improves problem positioning efficiency and reduces costs.

CN119728758APending Publication Date: 2025-03-28BEIJING VOLCANO ENGINE TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411847420.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-13
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

In the microservice architecture, it is difficult for the prior art to effectively realize unified query and analysis of logs and microservice call link data, resulting in difficulty in fast problem location.

Method used

By adding an access request identifier to the log and adding a call link identifier generated based on the access request identifier to the microservice call link data, the association between the log and the microservice call link data is achieved.

Benefits of technology

It improves the efficiency of querying and analysis of associated logs and microservice call link data, reduces costs, and does not increase the resource overhead of microservices, and does not affect the performance of microservices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119728758A_ABST
    Figure CN119728758A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a micro-service observation data processing method and device, and the method comprises the steps: responding to a micro-service access request, sequentially calling one or more micro-services, and enabling the micro-service access request to comprise an access request identifier; generating a calling link identifier of the micro-service calling link data according to the access request identifier; and generating a log and micro-service calling link data in a micro-service running process, adding the access request identifier in the log, adding a calling link identifier in the micro-service calling link data, and storing. According to the embodiment of the invention, the association of the log and the micro-service calling link data can be realized, the query and analysis efficiency of the associated log and micro-service calling link data can be improved, the cost is reduced, the resource overhead of the micro-service is not increased, and the performance of the micro-service is not influenced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present disclosure relate to the field of computer and network communication technology, and in particular, to a method and device for processing observation data of a microservice. Background Art

[0002] With the development and maturity of cloud computing and the technical evolution of microservice architecture, enterprises have begun to adopt more microservice models in service-oriented architecture theory, especially with the popularization of cloud native concepts, more services are deployed in containers. Compared with traditional design theory models, the technical advantages of microservice architecture can help enterprises or departments quickly iterate and go online, but at the same time, the microservice design model also faces two important challenges. First, it is difficult for microservice architecture to achieve strong consistency of traditional databases and need to pursue final consistency. Second, service discovery and service call link tracking have become more difficult.

[0003] In the microservice architecture, observability is mainly composed of three core capabilities and derivative capabilities. These three core capabilities are call link tracing (trace), logging (log), and monitoring (metrics). However, they are usually collected, stored, and analyzed by different systems. It is impossible to effectively query and analyze the call link tracing (trace) and log (log) in a unified manner, which is not conducive to rapid problem location. Summary of the invention

[0004] The embodiments of the present disclosure provide a method and device for processing observation data of a microservice, so as to associate a log of a microservice with data of a microservice call link.

[0005] In a first aspect, an embodiment of the present disclosure provides a method for processing observation data of a microservice, including:

[0006] In response to a microservice access request, calling one or more microservices in sequence, wherein the microservice access request includes an access request identifier;

[0007] Generate a call link identifier for microservice call link data according to the access request identifier;

[0008] Generate a log and microservice call link data during the operation of the microservice, add the access request identifier to the log, and add the call link identifier to the microservice call link data;

[0009] The log and the microservice call link data are stored.

[0010] In a second aspect, an embodiment of the present disclosure provides a device for processing observation data of a microservice, including:

[0011] A calling unit, configured to call one or more microservices in sequence in response to a microservice access request, wherein the microservice access request includes an access request identifier;

[0012] An identifier generating unit, used to generate a call link identifier of microservice call link data according to the access request identifier;

[0013] A data generation unit, used to generate a log and microservice call link data during the operation of the microservice, and add the access request identifier to the log, and add the call link identifier to the microservice call link data;

[0014] A storage unit is used to store the log and the microservice call link data.

[0015] In a third aspect, an embodiment of the present disclosure provides an electronic device, including: a processor and a memory;

[0016] The memory stores computer-executable instructions;

[0017] The processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the method for processing observation data of the microservice as described in the first aspect and various possible designs of the first aspect.

[0018] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, a method for processing observation data of a microservice as described in the first aspect and various possible designs of the first aspect is implemented.

[0019] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, including a computer program, which, when executed by a processor, implements the method for processing observation data of the microservice as described in the first aspect and various possible designs of the first aspect.

[0020] The method and device for processing observation data of microservices provided in the embodiments of the present disclosure call one or more microservices in sequence in response to a microservice access request, wherein the microservice access request includes an access request identifier; a call link identifier of microservice call link data is generated according to the access request identifier; a log and microservice call link data are generated during the operation of the microservice, and the access request identifier is added to the log, and the call link identifier is added to the microservice call link data; the log and the microservice call link data are stored so that the associated log and microservice call link data can be queried according to the access request identifier and the corresponding call link identifier respectively when querying. In the embodiments of the present disclosure, the log and microservice call link data can be associated by adding an access request identifier to the log and adding a call link identifier generated based on the access request identifier to the microservice call link data, thereby improving the efficiency of querying and analyzing the associated log and microservice call link data, reducing costs, and not increasing the resource overhead of the microservice, and not affecting the performance of the microservice. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the embodiments of the present disclosure 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, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0022] Figure 1 A schematic diagram of the architecture of a method for processing observation data of a microservice provided in an embodiment of the present disclosure;

[0023] Figure 2 A schematic diagram of a process flow of a method for processing observation data of a microservice provided in an embodiment of the present disclosure;

[0024] Figure 3 A flowchart of a method for processing observation data of a microservice provided by another embodiment of the present disclosure;

[0025] Figure 4 A structural block diagram of a device for processing observation data of a microservice provided in an embodiment of the present disclosure;

[0026] Figure 5 A schematic diagram of the hardware structure of a device for processing observation data of a microservice provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.

[0028] In the microservice architecture, observability is mainly composed of three core capabilities and derivative capabilities (such as root cause location, alarm system, AIOps intelligent operation and maintenance, etc.). These three core capabilities are call link tracing (trace), logging (log), and monitoring (metrics). Among them, the content of the log (log) is detailed, usually including timestamp, microservice name or ID, log level, operation content, environment information, error stack information, etc., but the upstream and downstream dependencies are vague, and the logs corresponding to different microservice accesses are mixed together; and the call link tracing (trace) can accurately see the call relationship between the request link and the microservices, and record the clear start and end time of the call between the microservices, but lacks log-related information; call link tracing (trace), logging (log), and monitoring (metrics) are usually collected, stored, and analyzed by different systems, and it is impossible to effectively query and analyze the call link tracing (trace) and log (log) in a unified manner, which is not conducive to rapid problem location. In particular, different microservices are developed through cross-departmental collaboration, with different development languages ​​and docking difficulties. Log specifications are not unified and cannot be associated with trace information. In addition, traces need to be accessed using separate components to be collected, and there is no clear association identifier to associate traces with logs.

[0029] Some related technologies add logs to trace by adding attributes to achieve the combination of trace and log, but this increases the amount of trace data and performance overhead when reporting traces, which can affect service stability in extreme cases. In addition, only a limited number of logs can be added to the attribute tag of trace. In addition, the process of generating traces requires one log print, and when generating logs, one log print is also required, so two log prints are performed, which also increases performance overhead. This related technology also cannot effectively achieve the same query and analysis of traces and all logs.

[0030] In order to solve the above technical problems, the embodiments of the present invention provide a method for processing observation data of a microservice, so as to associate the log with the microservice call link data with the aid of an access request identifier. The access request identifier can be added to the log, and the call link identifier generated based on the access request identifier can be added to the microservice call link data. In this way, based on the mapping relationship between the access request identifier and the call link identifier, the association between the log and the microservice call link data can be achieved, and the associated log and microservice call link data can be queried according to the access request identifier and the corresponding call link identifier, respectively. This can improve the efficiency of querying and analyzing the associated log and microservice call link data, reduce costs, and do not increase the resource overhead of the microservice, and do not affect the performance of the microservice.

[0031] The architecture of the method for processing observation data of the microservice of the embodiment of the present disclosure is as follows: Figure 1 As shown, in response to a microservice access request, one or more microservices are called in sequence, wherein the microservice access request includes an access request identifier; a call link identifier of the microservice call link data is generated according to the access request identifier; a unified printing library can be used to generate logs and microservice call link data during the operation of the microservice, and the access request identifier is added to the log, and the call link identifier is added to the microservice call link data; the log and the microservice call link data are stored so that the associated log and microservice call link data can be queried according to the access request identifier and the corresponding call link identifier respectively when querying.

[0032] In addition, a preset observation and calculation engine can be configured outside the microservice to query and analyze the observable data, that is, the log and microservice call link data. When the user terminal needs to query the associated log and microservice call link data, a query request for the associated log and microservice call link data can be sent to the preset observation and calculation engine, and then the preset observation and calculation engine determines the access request identifier to be queried and the corresponding call link identifier to be queried, and queries the associated target log and target microservice call link data, and uses the preset calculation rules to calculate the target log and target microservice call link data to obtain the target calculation result; the target calculation result is stored and / or sent to the user terminal.

[0033] The following will introduce in detail the method for processing observation data of the microservice disclosed in the present invention in conjunction with specific embodiments.

[0034] refer to Figure 2 , Figure 2 A flowchart of a method for processing observation data of a microservice provided in an embodiment of the present disclosure. The method of this embodiment can be applied in a terminal device or a server. The method for processing observation data of the microservice includes:

[0035] S201. In response to a microservice access request, call one or more microservices in sequence, wherein the microservice access request includes an access request identifier.

[0036] In this embodiment, when a user needs to access a microservice, a microservice access request is sent to the microservice, and the microservice may also need to use functions provided by other microservices during operation. Therefore, for a microservice access request, only one microservice may be called, or a series of microservices may be called, that is, there is a calling relationship between microservices. An access request ID can be configured for the microservice access request, and the access request ID will be passed between the called microservices when calling one or more microservices.

[0037] S202: Generate a call link identifier for microservice call link data according to the access request identifier.

[0038] In this embodiment, in order to establish an association relationship between the log (Log) and the microservice call link data (Trace) generated in the process of calling one or more microservices, an access request identifier can be used to establish the association relationship. Considering that the microservice call link data usually adopts a fixed format and the number of bits of the call link identifier is usually fixed, a call link identifier can be generated according to the access request identifier to add the call link identifier when generating the microservice call link data.

[0039] Optionally, a character string can be obtained from a target position in an access request identifier; a hash operation can be performed on the character string to obtain a hash value, and the hash value can be determined as the call link identifier. The target position can be a corresponding position in the access request identifier starting from any specified position and ending after a specified length, for example, it can be the last 16 bits in the access request identifier, or it can also be the first 16 bits, or the 16 bits starting from a certain position in the middle, and of course it can also be not limited to 16 bits; the hash operation can be any hash algorithm, such as the MD5 algorithm, and the hash operation is performed on the intercepted character string in order to generate a unique call link identifier.

[0040] Of course, this embodiment is not limited to the above-mentioned method of generating a call link identifier. The character string intercepted from the target position in the access request identifier can also be directly determined as the call link identifier, or any other arbitrary algorithm can be used to generate a call link identifier based on the access request identifier. As long as the generated call link identifier uniquely corresponds to the access request identifier, there is no limitation here.

[0041] On the basis of the above embodiment, since the call link identifier is generated based on the string intercepted from the target position in the access request identifier, in order to ensure the uniqueness of the call link identifier, the intercepted string also needs to be unique, that is, the string intercepted from the target position in different access request identifiers cannot be repeated, so a deduplication process is required to achieve it. Specifically, when generating an access request identifier for a microservice access request, it can be determined whether the target position in the access request identifier is repeated with the target position in the historical access request identifier. If repeated, the access request identifier is regenerated. In this way, it is ensured that the string intercepted from the target position in the access request identifier is unique, and the generated call link identifier is also unique.

[0042] It should be noted that, usually, the call link identifier is generated by the first microservice called. Optionally, in this embodiment, the call link identifier may also be generated by the first microservice called according to the access request identifier.

[0043] S203: Generate a log and microservice call link data during the operation of the microservice, add the access request identifier to the log, and add the call link identifier to the microservice call link data.

[0044] In this embodiment, logs and microservice call link data are generated during the operation of the microservice. In order to associate the logs with the microservice call link data, the access request identifier can be added to the log, and the call link identifier can be added to the microservice call link data. Optionally, the capabilities of generating logs and microservice call link data can be combined into a unified log and microservice call link data printing library to perform unified generation and output of logs and microservice call link data.

[0045] Specifically, the process of generating logs and microservice call link data can adopt a conventional method. In this embodiment, it can be based on the OTEL protocol (OpenTelemetry Protocol, which is an open source trace, log, and metrics reporting protocol), which has good portability. Of course, other transmission protocols can also be used; the difference is that an access request identifier is added to the log, and a call link identifier is added to the microservice call link data.

[0046] Among them, the process of adding a call link identifier to the microservice call link data is relatively easy to implement because it only needs to be executed once at the beginning to generate the call link identifier based on the access request identifier, and the call link identifier can be used all the time when recording the call link data subsequently.

[0047] Regarding the process of adding the access request identifier to the log, since the log is recorded by each called microservice respectively, the log is generated by the print log command print. In an optional method, the printing of the access request identifier can be added to the program code of the microservice for each print log command.

[0048] However, considering that there are many print log commands in each microservice, if each log print command is modified, the workload of modifying the program code of the microservice is very large and the cost is high. Therefore, optionally, this embodiment can also provide a method to reduce the modification of the program code of the microservice, that is, using the hook technology, pre-configuring a preset hook program, which is used to add an access request identifier to the log generated by the print log command, that is, it is necessary to monitor the execution of the print log command by the microservice, and when it is detected that the microservice executes the print log command, run the preset hook program, so as to obtain the access request identifier from the microservice through the preset hook program, and add the access request identifier to the log generated by the print log command. Through the Hook technology, it is possible to add the access request identifier to the log from a bypass, without modifying the program code of the microservice, without invading the microservice, and without increasing the performance loss of the microservice.

[0049] Optionally, some related information of the microservice access request can also be obtained from the microservice through the preset hook program, including but not limited to the user identifier (UserID, user unique identity identifier) ​​who initiated the microservice access request, the user account identifier (AccountID, a user can have multiple accounts, that is, there are multiple user account identifiers), the user source information (source container pod, source cluster cluster), and the upstream and downstream microservices of the microservice, etc., and then the preset hook program is used to add this related information to the log generated by the print log command, so that the information contained in the log is more comprehensive, which is convenient for subsequent log analysis and call link analysis, etc. The preset hook program can obtain the access request identifier and related information from the microservice based on the communication framework between microservices.

[0050] Of course, this embodiment is not limited to the above-mentioned method of adding access request identifiers in the log and adding call link identifiers in the microservice call link data. Any other feasible method may be used for implementation, which is not limited here.

[0051] S204: Store the log and the microservice call link data.

[0052] In this embodiment, the logs and microservice call link data are stored in any manner, such as using any storage service. Optionally, the logs and microservice call link data can be stored in a unified manner to facilitate query. For example, a corresponding preset storage space is configured for the microservice in the storage service, and then the logs and microservice call link data can be stored in the preset storage space corresponding to the microservice. Optionally, in the preset storage space, a sub-storage space can be further allocated for each microservice access request to uniformly store the logs and microservice call link data corresponding to the same microservice access request in the sub-storage space; or a distributed storage method can be used to store the logs and microservice call link data. For example, the logs are stored in one storage space (or storage service), and the microservice call link data are stored in another storage space (or another storage service), which can reduce the dependence on a single storage device.

[0053] The purpose of storing logs and microservice call link data is to provide support for subsequent query and analysis of related logs and microservice call link data. When querying related logs and microservice call link data later, you can obtain the access request identifier to be queried and the corresponding call link identifier to be queried, and then query the log according to the access request identifier to be queried, and query the microservice call link data according to the call link identifier to be queried. The queried logs and microservice call link data will also have an associated relationship.

[0054] The method for processing observation data of a microservice provided in this embodiment is to call one or more microservices in sequence in response to a microservice access request, wherein the microservice access request includes an access request identifier; generate a call link identifier of the microservice call link data according to the access request identifier; generate a log and microservice call link data during the operation of the microservice, and add the access request identifier to the log, and add the call link identifier to the microservice call link data; store the log and the microservice call link data so that the associated log and microservice call link data can be queried according to the access request identifier and the corresponding call link identifier respectively when querying. In this embodiment, the association between the log and the microservice call link data can be achieved by adding the access request identifier to the log and the call link identifier generated based on the access request identifier to the microservice call link data, which can improve the efficiency of querying and analyzing the associated log and microservice call link data, reduce costs, and do not increase the resource overhead of the microservice, and do not affect the performance of the microservice.

[0055] Based on any of the above embodiments, this embodiment also provides a method for querying and analyzing the associated logs and microservice call link data, such as Figure 3 As shown, the specific process is as follows:

[0056] S301, receiving a query request from a user through a preset observation computing engine, wherein the query request is used to query associated logs and microservice call link data, and determining an access request identifier to be queried and a corresponding call link identifier to be queried according to the query request;

[0057] S302, querying the associated target log and target microservice call link data according to the access request identifier to be queried and the corresponding call link identifier to be queried through a preset observation calculation engine;

[0058] S303, calculating the target log and the target microservice call link data by using the preset observation calculation engine and the preset calculation rules to obtain a target calculation result;

[0059] S304: Store and / or send the target calculation result to the user terminal.

[0060] In this embodiment, a preset observation computing engine can be configured outside the microservice to query and analyze the observable data, that is, the log and microservice call link data. Since the preset observation computing engine is not deployed within the microservice, that is, a bypass computing method is adopted, it does not invade the microservice business, does not increase the business performance loss, reduces the query and analysis computing costs, and improves efficiency.

[0061] When the user needs to query the associated logs and microservice call link data, a query request for the associated logs and microservice call link data can be sent to the preset observation computing engine, and the access request identifier to be queried and the corresponding call link identifier to be queried are determined according to the query request, wherein the access request identifier to be queried and the corresponding call link identifier to be queried can both be carried in the query request, or only the access request identifier to be queried is carried in the query request, and the corresponding call link identifier to be queried can be determined according to the access request identifier to be queried using S202; or the query request only includes some relevant information of the access request identifier to be queried and the corresponding call link identifier to be queried, such as the accessed microservice, access time, user identifier, user account identifier, user source information, etc., and the access request identifier to be queried and the corresponding call link identifier to be queried can be determined according to the relevant information; and so on. Then, the preset observation computing engine can query the associated target log and target microservice call link data according to the access request identifier to be queried and the corresponding call link identifier to be queried. When querying, the address, port, authentication information, etc. can be determined according to the metadata. The associated target log and target microservice call link data are queried based on the address, port, authentication information, etc., and then input into the preset observation computing engine. Then, the preset observation computing engine can use the preset calculation rules to calculate the target log and target microservice call link data to obtain the target calculation result, wherein the target calculation result may vary according to different preset calculation rules. Finally, the target calculation result is stored, for example, in the storage service, a sub-storage space is allocated to the preset storage space corresponding to the microservice configuration, and the target calculation result is stored in the sub-storage space.

[0062] In order to facilitate the user end to query the target calculation result from the sub-storage space, a query task identifier can be generated after the user end sends a query request and sent to the user end, and the target calculation result is stored and associated with the query task identifier, so that the user end can query the target calculation result based on the query task identifier. In addition, the target calculation result can also be directly sent to the user end to be displayed to the user end.

[0063] The optional preset calculation rules can be some data splicing rules, data analysis rules, data screening rules, etc., or any other rules. The data splicing rules are rules on how to splice the log and the target microservice call link data to form a more complete log content, which can be implemented in a specific format; the data analysis rules are specific purpose analysis and calculation based on the log and the target microservice call link data, for example, calculation rules for discovering various abnormal problems based on the log and microservice call link data, etc.; the data screening rules are rules for filtering from the log and the target microservice call link data based on the screening conditions; more rules are not limited here. It can also be expanded according to needs, such as expanding to scenarios such as SLA calculation and event rule calculation.

[0064] In an optional embodiment, the target log and the target microservice call link data can be spliced ​​by a preset observation computing engine to generate log data in a preset format as the target calculation result, wherein the target log and the target microservice call link data are spliced ​​to generate log data in a preset format in order to merge the target log and the target microservice call link data for display, and give full play to the advantages of microservice call link data in being able to accurately display the call relationship between microservices and the start and end time of the call, as well as the advantages of detailed log content, etc., wherein the preset format can be defined by developers or users.

[0065] In another optional embodiment, the target log can be screened according to preset keywords through a preset observation computing engine to obtain a target log including the preset keywords, and the target log including the preset keywords can be spliced ​​with the target microservice call link data to generate log data in a preset format as the target calculation result. In this embodiment, the target log can be first screened based on preset keywords, where the preset keywords can be any keywords that developers or users are concerned about, or the preset keywords can be different in different computing tasks. For example, in abnormal problem mining, the preset keywords can be "error", etc. After the target log including the preset keywords is screened, the target log including the preset keywords can be spliced ​​with the target microservice call link data to generate log data in a preset format, which can be used to show the relationship between a specific log and a microservice call link.

[0066] Of course, other preset calculation rules may also be used, which will not be described here one by one.

[0067] Based on any of the above embodiments, monitoring indicators (metrics), such as CPU usage, memory usage, request rate, error rate, etc., can also be collected during the operation of the microservice, and abnormal monitoring indicators can be detected, where the monitoring indicators are time series data. When an abnormality occurs in the microservice, an abnormal point will appear in the monitoring indicator. Therefore, these abnormal monitoring indicators can be detected, and then in the process of generating the log, the abnormal monitoring indicators can also be added to the log, so that abnormal problems can be quickly discovered in the subsequent analysis phase.

[0068] Optionally, Hook technology can be used to add anomaly detection indicators to the log. A preset hook program can be configured to detect anomaly monitoring indicators. After the anomaly monitoring indicators are detected, the anomaly detection indicators can be added to the log generated at the current moment.

[0069] Corresponding to the method for processing the observation data of the microservice in the above embodiment, Figure 4 A structural block diagram of a device for processing observation data of a microservice provided in an embodiment of the present disclosure. For ease of explanation, only the part related to the embodiment of the present disclosure is shown. Figure 4 The microservice observation data processing device 400 includes: a calling unit 401, an identification generating unit 402, a data generating unit 403, and a storage unit 404.

[0070] The calling unit 401 is used to call one or more microservices in sequence in response to a microservice access request, wherein the microservice access request includes an access request identifier;

[0071] An identifier generating unit 402 is used to generate a call link identifier of the microservice call link data according to the access request identifier;

[0072] The data generation unit 403 is used to generate a log and microservice call link data during the operation of the microservice, and add the access request identifier to the log, and add the call link identifier to the microservice call link data;

[0073] The storage unit 404 is used to store the log and the microservice call link data.

[0074] In one or more embodiments of the present disclosure, the device further includes a computing unit 405, configured to:

[0075] Receive a query request from a user through a preset observation computing engine, wherein the query request is used to query associated logs and microservice call link data, and determine an access request identifier to be queried and a corresponding call link identifier to be queried according to the query request;

[0076] Query the associated target log and target microservice call link data according to the access request identifier to be queried and the corresponding call link identifier to be queried through a preset observation calculation engine;

[0077] The preset observation calculation engine uses preset calculation rules to calculate the target log and the target microservice call link data to obtain a target calculation result;

[0078] The target calculation result is stored and / or sent to the user terminal.

[0079] In one or more embodiments of the present disclosure, when the calculation unit 405 calculates the target log and the target microservice call link data by using the preset observation calculation engine and the preset calculation rule to obtain the target calculation result, it is used to:

[0080] splicing the target log and the target microservice call link data through the preset observation computing engine to generate log data in a preset format as the target computing result; or

[0081] The target log is screened according to preset keywords by the preset observation computing engine to obtain the target log including the preset keywords, and the target log including the preset keywords is spliced ​​with the target microservice call link data to generate log data in a preset format as the target calculation result.

[0082] In one or more embodiments of the present disclosure, when the identifier generating unit 402 generates a call link identifier of the microservice call link data according to the access request identifier, it is used to:

[0083] Obtain a character string from a target location in the access request identifier;

[0084] A hash operation is performed on the character string to obtain a hash value, and the hash value is determined as the call link identifier.

[0085] In one or more embodiments of the present disclosure, the identification generation unit 402, in response to the microservice access request, is further configured to:

[0086] Generating the access request identifier for the microservice access request;

[0087] It is determined whether the target position in the access request identifier is repeated with the target position in the historical access request identifier; if so, a new access request identifier is generated.

[0088] In one or more embodiments of the present disclosure, when the data generating unit 403 adds the access request identifier to the log, it is used to:

[0089] When it is detected that the microservice executes a print log command during the log generation process, a preset hook program is run, the access request identifier is obtained from the microservice through the preset hook program, and the access request identifier is added to the log.

[0090] In one or more embodiments of the present disclosure, after running the preset hook program, the data generating unit 403 is further used to:

[0091] Obtaining, from the microservice through the preset hook program, the associated information of the microservice access request, wherein the associated information includes one or more of the following: a user identifier of a user initiating the microservice access request, a user account identifier, user source information, and upstream and downstream microservices of the microservice;

[0092] The associated information is added to the log.

[0093] In one or more embodiments of the present disclosure, when storing the log and the microservice call link data, the storage unit 404 is used to:

[0094] The log and the microservice call link data are stored in a preset storage space corresponding to the microservice.

[0095] In one or more embodiments of the present disclosure, when the data generation unit 403 generates logs and microservice call link data during the operation of the microservice, it is also used to:

[0096] Collect monitoring indicators during the operation of microservices and detect abnormal monitoring indicators;

[0097] The anomaly detection indicator is added to the log.

[0098] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.

[0099] In order to implement the above embodiment, the embodiment of the present disclosure also provides an electronic device.

[0100] refer to Figure 5, which shows a schematic diagram of the structure of an electronic device 500 suitable for implementing the embodiment of the present disclosure, and the electronic device 500 may be a terminal device or a server. The terminal device may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, personal digital assistants (PDAs), tablet computers, portable multimedia players (PMPs), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0101] like Figure 5 As shown, the electronic device 500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 to a random access memory (RAM) 503. Various programs and data required for the operation of the electronic device 500 are also stored in the RAM 503. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0102] Typically, the following devices may be connected to the I / O interface 505: input devices 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 508 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 509. The communication devices 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 5 The electronic device 500 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0103] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains 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 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0104] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, 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), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0105] The computer-readable medium may be included in the electronic device, or may exist independently without being installed in the electronic device.

[0106] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the method shown in the above embodiment.

[0107] Computer program code for performing the operations of the present disclosure 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 an independent 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 via 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).

[0108] 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 disclosure. 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 implementations as replacements, 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.

[0109] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a unit does not limit the unit itself in some cases. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses".

[0110] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0111] In a first aspect, according to one or more embodiments of the present disclosure, a method for processing observation data of a microservice is provided, including:

[0112] In response to a microservice access request, calling one or more microservices in sequence, wherein the microservice access request includes an access request identifier;

[0113] Generate a call link identifier for microservice call link data according to the access request identifier;

[0114] Generate a log and microservice call link data during the operation of the microservice, add the access request identifier to the log, and add the call link identifier to the microservice call link data;

[0115] The log and the microservice call link data are stored.

[0116] According to one or more embodiments of the present disclosure, the method further includes:

[0117] Receive a query request from a user through a preset observation computing engine, wherein the query request is used to query associated logs and microservice call link data, and determine an access request identifier to be queried and a corresponding call link identifier to be queried according to the query request;

[0118] Query the associated target log and target microservice call link data according to the access request identifier to be queried and the corresponding call link identifier to be queried through a preset observation calculation engine;

[0119] The preset observation calculation engine uses preset calculation rules to calculate the target log and the target microservice call link data to obtain a target calculation result;

[0120] The target calculation result is stored and / or sent to the user terminal.

[0121] According to one or more embodiments of the present disclosure, the step of calculating the target log and the target microservice call link data by the preset observation calculation engine using preset calculation rules to obtain a target calculation result includes:

[0122] splicing the target log and the target microservice call link data through the preset observation computing engine to generate log data in a preset format as the target computing result; or

[0123] The target log is screened according to preset keywords by the preset observation computing engine to obtain the target log including the preset keywords, and the target log including the preset keywords is spliced ​​with the target microservice call link data to generate log data in a preset format as the target calculation result.

[0124] According to one or more embodiments of the present disclosure, the step of generating a call link identifier of microservice call link data according to an access request identifier includes:

[0125] Obtain a character string from a target location in the access request identifier;

[0126] A hash operation is performed on the character string to obtain a hash value, and the hash value is determined as the call link identifier.

[0127] According to one or more embodiments of the present disclosure, the responding to the microservice access request further includes:

[0128] Generating the access request identifier for the microservice access request;

[0129] It is determined whether the target position in the access request identifier is repeated with the target position in the historical access request identifier; if so, a new access request identifier is generated.

[0130] According to one or more embodiments of the present disclosure, adding the access request identifier in the log includes:

[0131] When it is detected that the microservice executes a print log command during the log generation process, a preset hook program is run, the access request identifier is obtained from the microservice through the preset hook program, and the access request identifier is added to the log.

[0132] According to one or more embodiments of the present disclosure, after running the preset hook program, the method further includes:

[0133] Obtaining, from the microservice through the preset hook program, the associated information of the microservice access request, wherein the associated information includes one or more of the following: a user identifier of a user initiating the microservice access request, a user account identifier, user source information, and upstream and downstream microservices of the microservice;

[0134] The associated information is added to the log.

[0135] According to one or more embodiments of the present disclosure, storing the log and the microservice call link data includes:

[0136] The log and the microservice call link data are stored in a preset storage space corresponding to the microservice.

[0137] According to one or more embodiments of the present disclosure, when generating logs and microservice call link data during the operation of the microservice, it also includes:

[0138] Collect monitoring indicators during the operation of microservices and detect abnormal monitoring indicators;

[0139] In a second aspect, according to one or more embodiments of the present disclosure, a device for processing observation data of a microservice is provided, comprising:

[0140] A calling unit, configured to call one or more microservices in sequence in response to a microservice access request, wherein the microservice access request includes an access request identifier;

[0141] An identifier generating unit, used to generate a call link identifier of microservice call link data according to the access request identifier;

[0142] A data generation unit, used to generate a log and microservice call link data during the operation of the microservice, and add the access request identifier to the log, and add the call link identifier to the microservice call link data;

[0143] A storage unit is used to store the log and the microservice call link data.

[0144] According to one or more embodiments of the present disclosure, the device further includes a computing unit, configured to:

[0145] Receive a query request from a user through a preset observation computing engine, wherein the query request is used to query associated logs and microservice call link data, and determine an access request identifier to be queried and a corresponding call link identifier to be queried according to the query request;

[0146] Query the associated target log and target microservice call link data according to the access request identifier to be queried and the corresponding call link identifier to be queried through a preset observation calculation engine;

[0147] The preset observation calculation engine uses preset calculation rules to calculate the target log and the target microservice call link data to obtain a target calculation result;

[0148] The target calculation result is stored and / or sent to the user terminal.

[0149] According to one or more embodiments of the present disclosure, when the calculation unit calculates the target log and the target microservice call link data by using the preset observation calculation engine and the preset calculation rule to obtain the target calculation result, it is used to:

[0150] splicing the target log and the target microservice call link data through the preset observation computing engine to generate log data in a preset format as the target computing result; or

[0151] The target log is screened according to preset keywords by the preset observation computing engine to obtain the target log including the preset keywords, and the target log including the preset keywords is spliced ​​with the target microservice call link data to generate log data in a preset format as the target calculation result.

[0152] According to one or more embodiments of the present disclosure, when the identifier generation unit generates a call link identifier of the microservice call link data according to the access request identifier, it is used to:

[0153] Obtain a character string from a target location in the access request identifier;

[0154] A hash operation is performed on the character string to obtain a hash value, and the hash value is determined as the call link identifier.

[0155] According to one or more embodiments of the present disclosure, the identification generation unit, in response to the microservice access request, is further configured to:

[0156] Generating the access request identifier for the microservice access request;

[0157] It is determined whether the target position in the access request identifier is repeated with the target position in the historical access request identifier; if so, a new access request identifier is generated.

[0158] According to one or more embodiments of the present disclosure, when the data generation unit adds the access request identifier to the log, it is used to:

[0159] When it is detected that the microservice executes a print log command during the log generation process, a preset hook program is run, the access request identifier is obtained from the microservice through the preset hook program, and the access request identifier is added to the log.

[0160] According to one or more embodiments of the present disclosure, after running the preset hook program, the data generation unit is further used to:

[0161] Obtaining, from the microservice through the preset hook program, the associated information of the microservice access request, wherein the associated information includes one or more of the following: a user identifier of a user initiating the microservice access request, a user account identifier, user source information, and upstream and downstream microservices of the microservice;

[0162] The associated information is added to the log.

[0163] According to one or more embodiments of the present disclosure, when storing the log and the microservice call link data, the storage unit is used to:

[0164] The log and the microservice call link data are stored in a preset storage space corresponding to the microservice.

[0165] According to one or more embodiments of the present disclosure, when the data generation unit generates logs and microservice call link data during the operation of the microservice, it is also used to:

[0166] Collect monitoring indicators during the operation of microservices and detect abnormal monitoring indicators;

[0167] The anomaly detection indicator is added to the log.

[0168] In a third aspect, according to one or more embodiments of the present disclosure, there is provided an electronic device, comprising: at least one processor and a memory;

[0169] The memory stores computer-executable instructions;

[0170] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the method for processing observation data of the microservice as described in the first aspect and various possible designs of the first aspect.

[0171] In a fourth aspect, according to one or more embodiments of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer execution instructions. When a processor executes the computer execution instructions, a method for processing observation data of a microservice as described in the first aspect and various possible designs of the first aspect is implemented.

[0172] In a fifth aspect, according to one or more embodiments of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the method for processing observation data of a microservice as described in the first aspect and various possible designs of the first aspect is implemented.

[0173] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0174] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0175] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

Claims

1. A method for processing observation data of a microservice, characterized in that: include: In response to a microservice access request, calling one or more microservices in sequence, wherein the microservice access request includes an access request identifier; Generate a call link identifier for microservice call link data according to the access request identifier; Generate a log and microservice call link data during the operation of the microservice, add the access request identifier to the log, and add the call link identifier to the microservice call link data; The log and the microservice call link data are stored.

2. The method according to claim 1, characterized in that The method further comprises: Receive a query request from a user through a preset observation computing engine, where the query request is used to query associated logs and microservice call link data; Determine the access request identifier to be queried and the corresponding call link identifier to be queried according to the query request; Query the associated target log and target microservice call link data according to the access request identifier to be queried and the corresponding call link identifier to be queried through a preset observation calculation engine; The preset observation calculation engine uses preset calculation rules to calculate the target log and the target microservice call link data to obtain a target calculation result; The target calculation result is stored and / or sent to the user terminal.

3. The method according to claim 2, characterized in that The method of calculating the target log and the target microservice call link data by the preset observation calculation engine using preset calculation rules to obtain a target calculation result includes: splicing the target log and the target microservice call link data through the preset observation computing engine to generate log data in a preset format as the target computing result; or The target log is screened according to preset keywords by the preset observation computing engine to obtain the target log including the preset keywords, and the target log including the preset keywords is spliced ​​with the target microservice call link data to generate log data in a preset format as the target calculation result.

4. The method according to claim 1, characterized in that The step of generating a call link identifier of the microservice call link data according to the access request identifier includes: Obtain a character string from a target location in the access request identifier; A hash operation is performed on the character string to obtain a hash value, and the hash value is determined as the call link identifier.

5. The method according to claim 4, characterized in that The response to the microservice access request also includes: Generating the access request identifier for the microservice access request; It is determined whether the target position in the access request identifier is repeated with the target position in the historical access request identifier; if so, a new access request identifier is generated.

6. The method according to claim 1, characterized in that Adding the access request identifier to the log includes: When it is detected that the microservice executes a print log command during the log generation process, a preset hook program is run, the access request identifier is obtained from the microservice through the preset hook program, and the access request identifier is added to the log.

7. The method according to claim 6, characterized in that After running the preset hook program, the method further includes: Obtaining, from the microservice through the preset hook program, the associated information of the microservice access request, wherein the associated information includes one or more of the following: a user identifier of a user initiating the microservice access request, a user account identifier, user source information, and upstream and downstream microservices of the microservice; The associated information is added to the log.

8. The method according to claim 1, characterized in that The storing of the log and the microservice call link data includes: The log and the microservice call link data are stored in a preset storage space corresponding to the microservice.

9. The method according to claim 1, characterized in that: When generating logs and microservice call link data during the operation of the microservice, it also includes: Collect monitoring indicators during the operation of microservices and detect abnormal monitoring indicators; The anomaly detection indicator is added to the log.

10. A device for processing observation data of a microservice, characterized in that: include: A calling unit, configured to call one or more microservices in sequence in response to a microservice access request, wherein the microservice access request includes an access request identifier; An identifier generating unit, used to generate a call link identifier of microservice call link data according to the access request identifier; A data generation unit, used to generate a log and microservice call link data during the operation of the microservice, and add the access request identifier to the log, and add the call link identifier to the microservice call link data; A storage unit is used to store the log and the microservice call link data.

11. An electronic device, characterized in that: include: Processor and memory; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the method according to any one of claims 1 to 9 is implemented.

13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.

Citation Information

Cited By

  • Micro-service identity dynamic access control method and system

    CN122069072A