Microservice link generation method, device, server and storage medium

By obtaining the attribute information of the microservice processing class and generating the label information of the target processing class, the accuracy problem of internal link tracking of microservices is solved, and a comprehensive analysis and fault location of the internal interface performance of microservices are achieved.

CN111381989BActive Publication Date: 2025-09-16CHINA PING AN LIFE INSURANCE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202010229524.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-03-27
Publication Date
2025-09-16
Estimated Expiration
2040-03-27

AI Technical Summary

Technical Problem

Existing distributed microservice link tracing solutions cannot accurately obtain call information between interfaces within microservices, resulting in an inability to effectively analyze performance bottlenecks.

Method used

By obtaining the bytecode file object of the microservice processing class, determining the attribute information, generating the label information of the target processing class, and generating the call link of the microservice based on the label information, the performance analysis of each interface within the microservice is achieved.

Benefits of technology

It provides an accurate and comprehensive microservice call link, which can provide an accurate basis for performance analysis of each interface within the microservice and improve troubleshooting efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111381989B_ABST
    Figure CN111381989B_ABST
Patent Text Reader

Abstract

The present application is applicable to the field of computer technology and proposes a microservice link generation method, comprising: determining attribute information corresponding to each processing class of the microservice based on a bytecode file object of the microservice, and after determining a target processing class corresponding to each port of the microservice based on the attribute information, generating label information of the target processing class; further determining call information corresponding to each port of the microservice based on the label information, and generating a call link of the microservice based on the call information. The method can generate a call link containing call information corresponding to each port of the microservice, and can provide an accurate analysis basis for analyzing the availability and performance bottlenecks between various interfaces within the microservice.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a microservice link generation method, device, server, and storage medium. Background Art

[0002] Currently, common distributed microservice link tracing solutions use link information generated by interface calls between different microservices to determine the performance of distributed microservice systems. However, this link information cannot be used internally within a microservice and cannot accurately analyze the availability and performance bottlenecks between interfaces within the microservice. Because interfaces within microservices often call each other, and the performance of each interface is affected by the performance of each interface within the microservice, obtaining accurate and comprehensive link information to analyze the performance of each interface within the microservice is a pressing technical challenge. Summary of the Invention

[0003] In view of this, the embodiments of the present application provide a microservice link generation method, device, server and storage medium to obtain an accurate and comprehensive microservice call link, thereby providing an accurate basis for the performance analysis of each interface within the microservice.

[0004] A first aspect of an embodiment of the present application provides a microservice link generation method, including:

[0005] If a microservice is detected to be running, all processing classes of the microservice are obtained;

[0006] Determining attribute information corresponding to each processing class based on the bytecode file object of each processing class;

[0007] Determine target attribute information corresponding to each port of the microservice based on the attribute information;

[0008] Generate label information of the target processing class corresponding to the target attribute information;

[0009] Determine call information corresponding to each port of the microservice based on the tag information, and generate a call link for the microservice according to the call information.

[0010] In an optional implementation, if it is detected that a microservice is running, all processing classes of the microservice are obtained, including:

[0011] If a microservice is detected running, the pre-created aspect class is called;

[0012] Obtain a pointcut expression corresponding to the aspect class, scan all the processing classes of the microservice based on the pointcut expression, and obtain all the scanned processing classes.

[0013] In an optional implementation, determining the attribute information of each processing class based on the bytecode file object of each processing class includes:

[0014] According to the bytecode file object, respectively create an instance corresponding to each of the bytecode file objects;

[0015] Each of the instances is called separately to obtain the attribute information of each processing class.

[0016] In an optional implementation, determining target attribute information corresponding to each port of the microservice based on the attribute information includes:

[0017] Based on a preset matching rule, target attribute information that matches the preset attribute information corresponding to each port of the microservice is matched from all the attribute information.

[0018] In an optional implementation, the preset matching rule includes a preset number of identical attribute information;

[0019] Correspondingly, matching target attribute information that matches preset attribute information corresponding to each port of the microservice from the attribute information based on a preset matching rule includes:

[0020] If a preset number of attribute information in the attribute information matches the preset attribute information corresponding to any port of the microservice, the preset number of attribute information is determined to be the target attribute information.

[0021] In an optional implementation, before generating label information of the target processing class corresponding to the target attribute information, the method includes:

[0022] Determine a target processing class corresponding to the target attribute information, where the target processing class is used to record call logs of each port of the microservice.

[0023] In an optional implementation, determining the call information corresponding to each port of the microservice based on the tag information, and generating a call link for the microservice according to the call information includes:

[0024] If it is detected that the target processing class corresponding to the tag information is called, the call information is obtained, where the call information is the call log of each port of the microservice recorded by the target processing class;

[0025] A second aspect of an embodiment of the present application provides a microservice link generation device, comprising:

[0026] An acquisition module is used to acquire all processing classes of a microservice if a microservice is detected to be running;

[0027] A first determining module, configured to determine attribute information corresponding to each processing class based on the bytecode file object of each processing class;

[0028] A second determination module is configured to determine target attribute information corresponding to each port of the microservice based on the attribute information;

[0029] A first generating module is used to generate label information of a target processing class corresponding to the target attribute information;

[0030] The second generating module is configured to determine the call information corresponding to each port of the microservice based on the tag information, and generate a call link for the microservice according to the call information.

[0031] In an optional implementation, the acquisition module includes:

[0032] The calling unit is used to call the pre-created aspect class if a microservice is detected to be running;

[0033] The first acquisition unit is used to obtain a pointcut expression corresponding to the aspect class, scan all the processing classes of the microservice based on the pointcut expression, and obtain all the scanned processing classes.

[0034] In an optional implementation, the first determining module includes:

[0035] A creating unit, configured to create, according to the bytecode file object, an instance corresponding to each of the bytecode file objects;

[0036] The second acquiring unit is configured to call each of the instances respectively to acquire attribute information of each of the processing classes.

[0037] In an optional implementation, the second determining module is specifically configured to:

[0038] Based on a preset matching rule, target attribute information that matches the preset attribute information corresponding to each port of the microservice is matched from all the attribute information.

[0039] In an optional implementation, the preset matching rule includes a preset number of identical attribute information;

[0040] Correspondingly, the second determining module is specifically configured to:

[0041] If a preset number of attribute information in the attribute information matches the preset attribute information corresponding to any port of the microservice, the preset number of attribute information is determined to be the target attribute information.

[0042] In an optional implementation, the method further includes:

[0043] The third determination module is used to determine the target processing class corresponding to the target attribute information, and the target processing class is used to record the call logs of each port of the microservice.

[0044] In an optional implementation, the second generating module includes:

[0045] A second acquiring unit is configured to acquire the calling information if it is detected that the target processing class corresponding to the tag information is called, where the calling information is a call log of each port of the microservice recorded by the target processing class;

[0046] A generating unit is configured to generate a call link for the microservice according to the call information.

[0047] In a third aspect, an embodiment of the present application provides a server comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the microservice link generation method described in the first aspect are implemented. In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, wherein when the processor executes the computer program, the steps of the microservice link generation method described in the first aspect are implemented.

[0048] The microservice link generation method provided in the first aspect of the embodiment of the present application has the following advantages compared with the prior art: by determining the attribute information corresponding to each processing class of the microservice based on the bytecode file object of the microservice, and after determining the target processing class corresponding to each port of the microservice based on the attribute information, generating label information of the target processing class; further determining the call information corresponding to each port of the microservice based on the label information, generating the call link of the microservice according to the call information, it is possible to obtain an accurate and comprehensive microservice call link, thereby providing an accurate basis for performance analysis of each interface within the microservice.

[0049] The second to fourth aspects of the embodiments of the present application have the same beneficial effects as the first aspect of the embodiments of the present application compared with the prior art, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or descriptions of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0051] Figure 1 This is a flowchart of the implementation of the microservice link generation method provided in the first embodiment of the present application;

[0052] Figure 2 yes Figure 1 The specific implementation flow chart of S101;

[0053] Figure 3 yes Figure 1 Specific implementation flow chart of S102;

[0054] Figure 4 yes Figure 1 Specific implementation flow chart of S105;

[0055] Figure 5 This is a flowchart of the implementation of the microservice link generation method provided in the second embodiment of the present application;

[0056] Figure 6 This is a schematic diagram of the structure of the microservice link generation device provided in an embodiment of the present application;

[0057] Figure 7 A schematic diagram of the server structure provided in this application. DETAILED DESCRIPTION

[0058] In the following description, specific details such as specific system structures and techniques are provided for purposes of illustration rather than limitation to facilitate a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obscuring the description of the present application with unnecessary detail.

[0059] In order to illustrate the technical solution described in this application, the following is a description of the specific embodiments. Figure 1 The figure shows a flowchart of the implementation of the microservice link generation method provided by the first embodiment of the present application. This embodiment can be implemented by hardware or software of a microservice link generation device, which can be a computing device with computing functions, such as a server. The details are as follows:

[0060] S101: If it is detected that a microservice is running, all processing classes of the microservice are obtained.

[0061] It should be noted that the operation of microservices on a distributed platform depends on the corresponding processing class, which contains the program logic for the services provided by the microservice. When the processing class is called, various service processes are recorded based on the program logic, such as package path resolution, operation log recording, method call processing, exception recording, return value processing, log recording, and log sending.

[0062] In an optional embodiment, if Figure 2 As shown, Figure 1 The specific implementation flow chart of S101 in FIG. Figure 2 It can be seen that S101 includes S1011 to S1012. The details are as follows:

[0063] S1011: If a microservice is detected running, the pre-created aspect class is called.

[0064] In the design concept of aspect-oriented programming, the pointcut expression of the aspect class is customized in advance. When the microservice is started, the aspect class scans the public package data of the microservice through the corresponding pointcut expression, and the public package data contains the processing class.

[0065] S1012: Obtain a pointcut expression corresponding to the aspect class, scan all the processing classes of the microservice based on the pointcut expression, and obtain all the scanned processing classes.

[0066] In this embodiment, the public data of the microservice is scanned based on the pointcut expression, and the processing of the scanned processing class is called according to the configuration notification method to obtain all the scanned processing classes. From the above analysis, it can be seen that when the microservice is detected, this embodiment obtains all the processing classes of the microservice through aspect-oriented programming. Based on the processing classes, it can further obtain the processing data of the microservice in a timely and accurate manner, thereby comprehensively obtaining all port call data of the microservice.

[0067] S102: Determine attribute information corresponding to each processing class based on the bytecode file object of each processing class.

[0068] Typically, when a processing class is running, the attribute information of each processing class can be obtained using the reflection mechanism. It should be noted that the process of using the reflection mechanism for each processing class relies on the bytecode file object of each fast search processing class. The bytecode file object is a .class type file, and all attribute information of the corresponding processing class can be obtained through the bytecode file.

[0069] The attribute information includes the calling method and class name of the processing class and the calling information of all ports required to implement the calling method corresponding to the processing class.

[0070] In an optional embodiment, if Figure 3 As shown, Figure 1 The specific implementation flow chart of S102. Figure 3 It can be seen that S102 includes S1021 to S10122. The details are as follows:

[0071] S1021: Create instances corresponding to each bytecode file object according to the bytecode file object.

[0072] It can be understood that instantiation is the process of creating an object, and each of the bytecode file objects has its own corresponding instance, which is a computer program that provides basic service functions.

[0073] S1022: Call each of the instances respectively to obtain attribute information of each of the processing classes.

[0074] The instance corresponding to each of the bytecode file objects may specifically be a computer program for obtaining the attribute information of the processing class.

[0075] From the above analysis, it can be seen that in this embodiment, by creating an instance of the bytecode file object corresponding to each processing class, all attribute information corresponding to each processing class is obtained. The attribute information of the processing class is obtained based on the reflection mechanism principle, so that the obtained data is more accurate and comprehensive.

[0076] S103: Determine target attribute information corresponding to each port of the microservice based on the attribute information.

[0077] Because the attribute information includes the calling method and class name of the processing class, as well as the calling information of all ports required to implement the calling method corresponding to the processing class, the target attribute information corresponding to each port of the microservice can be obtained by matching the calling information of all ports contained in the attribute information with the preset attribute information corresponding to each port of the microservice.

[0078] In an optional implementation, S103 specifically includes:

[0079] Target attribute information that matches preset attribute information corresponding to each port of the microservice is matched from the attribute information.

[0080] It should be noted that, during the matching process, a matching rule may be preset. For example, the preset matching rule may include a preset number of identical attribute information.

[0081] In an optional implementation, S103 specifically includes: matching target attribute information that matches preset attribute information corresponding to each port of the microservice from all the attribute information based on a preset matching rule.

[0082] S104: Generate label information of the target processing class corresponding to the target attribute information.

[0083] It is understood that the attribute information is the attribute information of the processing class, and there is a mapping relationship between the target attribute information and the target processing class. In this embodiment, in order to identify the target processing class corresponding to the target attribute information, corresponding tag information is generated for the target processing class. The tag information can be generated based on the target attribute information, that is, the tag information corresponding to each target processing class includes one or more attribute information in the target attribute information.

[0084] S105: Determine call information corresponding to each port of the microservice based on the tag information, and generate a call link for the microservice according to the call information.

[0085] It can be understood that the call information corresponding to each port of the microservice includes the first call information between the ports of the microservice, and also includes the second call information between each port of the microservice and the ports of other microservices. The call link of the microservice generated according to the call information includes the first call information and the second call information.

[0086] It can be understood that in the process of troubleshooting microservices, the call link of the microservice generated based on the call information is obtained, and the fault port is located based on the call link; this can provide a more comprehensive and accurate data basis for troubleshooting the microservices and improve the efficiency of microservice fault location. In an optional implementation, such as Figure 4 As shown, Figure 1 The specific implementation flow chart of S105. Figure 4 It can be seen that S105 includes S1051 to S1052. The details are as follows:

[0087] S1051: If it is detected that the target processing class corresponding to the tag information is called, the call information is obtained, where the call information is a call log of each port of the microservice recorded by the target processing class.

[0088] It can be understood that if it is detected that the target processing class is called, it is determined that the port of the microservice is called, and the target processing class records the call log of the port of the microservice during the call process. In this embodiment, the call log recorded by the processing class is obtained.

[0089] S1052: Generate a call link for the microservice according to the call information.

[0090] From the above analysis, it can be seen that the microservice link generation method provided in the embodiment of the present application determines the attribute information corresponding to each processing class based on the bytecode file object of each processing class of the microservice, and after determining the target processing class corresponding to each port of the microservice based on the attribute information, generates the label information of the target processing class; based on the label information, further determines the call information corresponding to each port of the microservice, and generates the call link of the microservice according to the call information, which can obtain an accurate and comprehensive microservice call link, and realize the problem of providing an accurate basis for the performance analysis of each interface within the microservice.

[0091] like Figure 5 As shown in FIG, it is a flowchart of the implementation of the microservice link generation method provided by the second embodiment of the present application. Figure 5 It can be seen that this embodiment is Figure 1 Compared with the embodiment shown, the specific implementation process of S501 to S503 is the same as S101 to S103, and S505 to S506 is the same as S104 to S105. The difference is that S504 is included before S505. It should be noted that S504 and S503 are executed in sequence. The implementation process of S504 is detailed as follows:

[0092] S504: Determine a target processing class corresponding to the target attribute information, where the target processing class is used to record call logs of each port of the microservice.

[0093] Since each processing class corresponds to different attribute information, the attribute information corresponding to each processing class can be determined based on the class name of the processing class. After determining the target attribute information corresponding to each port of the microservice, this embodiment needs to determine the target processing class used to record each port of the microservice from the processing class. After determining the target processing class, the call information of each port of the microservice can be obtained by tracking the port call log recorded by the target processing class. From the above analysis, it can be seen that this embodiment has Figure 1 On the basis of the embodiment, the target processing class corresponding to the target attribute information is further determined to provide a tracking basis for obtaining the call information of each port of the microservice being called.

[0094] Figure 6 This is a schematic diagram of the structure of the microservice link generation device provided in the embodiment of the present application. Figure 6It can be seen that the microservice link generation device 6 provided in the embodiment of the present application includes: an acquisition module 601, a first determination module 602, a second determination module 603, a first generation module 604 and a second generation module 605. The details are as follows:

[0095] The acquisition module 601 is used to acquire all processing classes of the microservice if a microservice is detected to be running;

[0096] A first determining module 602 is configured to determine attribute information corresponding to each processing class based on the bytecode file object of each processing class;

[0097] A second determining module 603 is configured to determine target attribute information corresponding to each port of the microservice based on the attribute information;

[0098] A first generating module 604 is configured to generate label information of a target processing class corresponding to the target attribute information;

[0099] The second generating module 605 is configured to determine the call information corresponding to each port of the microservice based on the tag information, and generate a call link for the microservice according to the call information.

[0100] In an optional implementation, the acquisition module 601 includes:

[0101] The calling unit is used to call the pre-created aspect class if a microservice is detected to be running;

[0102] The first acquisition unit is used to obtain a pointcut expression corresponding to the aspect class, scan all the processing classes of the microservice based on the pointcut expression, and obtain all the scanned processing classes.

[0103] In an optional implementation, the first determining module 602 includes:

[0104] A creating unit, configured to create, according to the bytecode file object, an instance corresponding to each of the bytecode file objects;

[0105] The second acquiring unit is configured to call each of the instances respectively to acquire attribute information of each of the processing classes.

[0106] In an optional implementation, the second determining module 603 is specifically configured to:

[0107] Target attribute information that matches preset attribute information corresponding to each port of the microservice is matched from the attribute information.

[0108] In an optional implementation, the preset matching rule includes a preset number of identical attribute information;

[0109] Correspondingly, matching target attribute information that matches preset attribute information corresponding to each port of the microservice from the attribute information based on a preset matching rule includes:

[0110] If a preset number of attribute information in the attribute information matches the preset attribute information corresponding to any port of the microservice, the preset number of attribute information is determined to be the target attribute information.

[0111] In an optional implementation, the method further includes:

[0112] The third determination module is used to determine the target processing class corresponding to the target attribute information, and the target processing class is used to record the call logs of each port of the microservice.

[0113] In an optional implementation, the second generating module 605 includes:

[0114] A second acquiring unit is configured to acquire the calling information if it is detected that the target processing class corresponding to the tag information is called, where the calling information is a call log of each port of the microservice recorded by the target processing class;

[0115] A generating unit is configured to generate a call link for the microservice according to the call information.

[0116] Figure 7 This is a schematic diagram of the structure of the server provided in the embodiment of the present application. Figure 7 As shown, the server 7 of this embodiment includes: a processor 70, a memory 71, and a computer program 72 stored in the memory 71 and executable on the processor 70, such as a microservice link generation program. When the processor 70 executes the computer program 72, the steps in the above-mentioned various microservice link generation method embodiments are implemented, such as Figure 1 Steps 101 to 105 are shown.

[0117] Exemplarily, the computer program 72 may be divided into one or more modules / units, which are stored in the memory 71 and executed by the processor 70 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution process of the computer program 72 in the server 7. For example, the computer program 72 may be divided into an acquisition module, a first determination module, a second determination module, a first generation module, and a second generation module (modules in the virtual device), and the specific functions of each module are as follows:

[0118] An acquisition module is used to acquire all processing classes of a microservice if a microservice is detected to be running;

[0119] A first determining module, configured to determine attribute information corresponding to each processing class based on the bytecode file object of each processing class;

[0120] A second determination module is configured to determine target attribute information corresponding to each port of the microservice based on the attribute information;

[0121] A first generating module is used to generate label information of a target processing class corresponding to the target attribute information;

[0122] The second generating module is configured to determine the call information corresponding to each port of the microservice based on the tag information, and generate a call link for the microservice according to the call information.

[0123] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0124] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.

[0125] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0126] In the embodiments provided in this application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are merely illustrative. For example, the division of the modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0127] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple communication units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0128] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0129] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application can implement all or part of the processes in the above-mentioned embodiment method by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, it can implement the steps of each of the above-mentioned method embodiments. The computer program includes computer program code, which can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media does not include electric carrier signals and telecommunication signals.

[0130] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application.

Claims

1. A microservice link generation method, characterized in that: include: If a microservice is detected to be running, all processing classes of the microservice are obtained, and the processing classes include the program logic of the service provided by the microservice; Determining attribute information corresponding to each processing class based on the bytecode file object of each processing class, wherein the attribute information includes a calling method of the processing class, a class name, and calling information of all ports required to implement the calling method corresponding to the processing class; Determine target attribute information corresponding to each port of the microservice based on the attribute information; Generate label information of the target processing class corresponding to the target attribute information; Determine call information corresponding to each port of the microservice based on the tag information, and generate a call link for the microservice according to the call information; If a microservice is detected to be running, all processing classes of the microservice are obtained, including: If a microservice is detected running, the pre-created aspect class is called; Obtaining a pointcut expression corresponding to the aspect class, scanning all the processing classes of the microservice based on the pointcut expression, and obtaining all the scanned processing classes; Determining attribute information of each processing class based on the bytecode file object of each processing class includes: According to the bytecode file object, respectively create an instance corresponding to each of the bytecode file objects; Calling each of the instances separately to obtain attribute information of each of the processing classes; The determining, based on the attribute information, target attribute information corresponding to each port of the microservice includes: Based on a preset matching rule, target attribute information that matches preset attribute information corresponding to each port of the microservice is matched from the attribute information.

2. The microservice link generation method according to claim 1, wherein: The preset matching rule is to include a preset number of identical attribute information; Correspondingly, matching target attribute information that matches preset attribute information corresponding to each port of the microservice from the attribute information based on a preset matching rule includes: If a preset number of attribute information in the attribute information matches the preset attribute information corresponding to any port of the microservice, the preset number of attribute information is determined to be the target attribute information.

3. The microservice link generation method according to claim 1 or 2, characterized in that: Before generating label information of the target processing class corresponding to the target attribute information, the method includes: Determine a target processing class corresponding to the target attribute information, where the target processing class is used to record call logs of each port of the microservice.

4. The microservice link generation method according to claim 3, wherein: The determining, based on the tag information, the call information corresponding to each port of the microservice, and generating a call link of the microservice according to the call information includes: If it is detected that the target processing class corresponding to the tag information is called, the call information is obtained, where the call information is the call log of each port of the microservice recorded by the target processing class; Generate a call link for the microservice based on the call information.

5. A microservice link generation device, characterized in that: include: An acquisition module is used to acquire all processing classes of a microservice if a microservice is detected to be running, wherein the processing class includes the program logic of the service provided by the microservice; A first determining module is configured to determine attribute information corresponding to each processing class based on the bytecode file object of each processing class, wherein the attribute information includes a calling method of the processing class, a class name, and calling information of all ports required to implement the calling method corresponding to the processing class; A second determination module is configured to determine target attribute information corresponding to each port of the microservice based on the attribute information; A first generating module is used to generate label information of a target processing class corresponding to the target attribute information; A second generating module is configured to determine call information corresponding to each port of the microservice based on the tag information, and generate a call link for the microservice according to the call information; The acquisition module includes: The calling unit is used to call the pre-created aspect class if it detects that a microservice is running; A first acquisition unit is configured to acquire a pointcut expression corresponding to the aspect class, scan all the processing classes of the microservice based on the pointcut expression, and acquire all the scanned processing classes; The first determining module includes: A creating unit, configured to create, according to the bytecode file object, an instance corresponding to each of the bytecode file objects; A second acquiring unit, configured to call each of the instances respectively to acquire attribute information of each of the processing classes; The second determining module is specifically configured to match target attribute information that matches preset attribute information corresponding to each port of the microservice from the attribute information based on a preset matching rule.

6. A server comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the microservice link generation method according to any one of claims 1 to 4 are implemented.

7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the microservice link generation method according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Content stream processing method and device, equipment and medium

    CN110673962A