CN115248737A - Interface calling time-consuming calculation method and device for section-oriented programming - Google Patents
Interface calling time-consuming calculation method and device for section-oriented programming Download PDFInfo
- Publication number
- CN115248737A CN115248737A CN202210921028.3A CN202210921028A CN115248737A CN 115248737 A CN115248737 A CN 115248737A CN 202210921028 A CN202210921028 A CN 202210921028A CN 115248737 A CN115248737 A CN 115248737A
- Authority
- CN
- China
- Prior art keywords
- aop
- micro
- micro service
- plug
- time
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/547—Remote procedure calls [RPC]; Web services
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/448—Execution paradigms, e.g. implementations of programming paradigms
- G06F9/4488—Object-oriented
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/546—Message passing systems or structures, e.g. queues
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The present disclosure relates to the field of software development, and in particular, to a method and an apparatus for calculating a time consumed by interface invocation for section-oriented programming. The method comprises the following steps: according to a pre-determined micro service program consuming the call of an interface to be calculated, configuring an AOP plug-in package name, wherein the AOP plug-in package name comprises a deployment path of the micro service program, and the micro service program comprises a plurality of micro service methods; according to the AOP plug-in package name, cutting the AOP plug-in into a cut point of a micro-service method in the micro-service program; when the microservice method is accessed, the AOP plug-in is activated by the tangent point and a log is printed by the AOP plug-in; and determining the interface time consumption information of the micro service program according to the called time length of the micro service method recorded in the log. According to the invention, by the principle of global AOP, by providing AOP plug-ins and micro-service program lead-in plug-ins, the function of counting interface time consumption without intrusion can be realized through related configuration.
Description
Technical Field
The present disclosure relates to the field of data processing, and in particular, to a method and an apparatus for calculating a time consumed by interface call oriented to section programming.
Background
In the interior of the micro-service interface at the present stage, due to the existence of logic for processing and processing data or calling other system interfaces, certain time consumption is generated, and each calling party using the micro-service is called overtime due to a request with overlong time consumption. For example, the H5 page initiates a request, the micro service interface is called through the gateway system, and if the time consumption of the micro service interface exceeds the default time consumption of the gateway system, the gateway system directly returns an error report, thereby causing a production risk.
The existing time-consuming calculation of the interface usually needs to perform log printing and calculation in the interface, the intrusiveness is strong, and redundant codes are many and are not easy to maintain. The invention aims to realize the function of counting the interface time consumption through related configuration by the principle of global AOP.
Aiming at the problems of strong invasiveness and difficulty in maintenance in interface time-consuming calculation in the prior art, a method and a device for interface call time-consuming calculation facing to section programming are needed.
Disclosure of Invention
To solve the above problems in the prior art, embodiments herein provide a method, an apparatus, a computer device, a computer-readable storage medium, and a computer program product for calculating a time consumption for interface call oriented to facet programming.
The embodiment of the invention provides a method for calculating the time consumption of interface calling facing to section programming, which comprises the following steps: according to a pre-determined micro service program consuming the call of an interface to be calculated, configuring an AOP plug-in package name, wherein the AOP plug-in package name comprises a deployment path of the micro service program, and the micro service program comprises a plurality of micro service methods; according to the AOP plug-in package name, cutting the AOP plug-in into a cut point of a micro-service method in the micro-service program; when the micro service method is accessed, the AOP plug-in is activated by the tangent point and a log is printed by the AOP plug-in; and determining the interface time consumption information of the micro service program according to the called time length of the micro service method recorded in the log.
According to one aspect of embodiments herein, configuring AOP plugin package names according to a predetermined time-consuming microserver invoked by the interface to be computed comprises: determining a micro-service program which consumes time for calling an interface to be calculated according to the time-consuming calculation requirement for calling the interface; determining configuration item parameters in a configuration file of the micro service program according to the deployment position of the micro service program in a server, wherein the configuration item parameters comprise a deployment path of the micro service program; and determining the deployment path as the AOP plug-in package name.
According to one aspect of embodiments herein, cutting an AOP plugin into a microservice method in the microservice program according to the AOP plugin package name comprises: inquiring the configuration item parameters of the micro service programs, and determining the deployment paths in the configuration item parameters in each micro service program; and according to the deployment path, cutting the AOP plug-in corresponding to the package name with the same content as the deployment path into the tangent point of the micro-service method in the micro-service program.
According to an aspect of embodiments herein, the length of time that the microservice method is invoked includes: when the micro service is called and accessed, intercepting the tangent point to call an AOP plug-in, printing a log and recording the starting time of the interface access in a message queue; and when the micro service is called and returned, intercepting the tangent point, printing a log and recording the end time of the interface access in a message queue, wherein the difference between the start time and the end time of the interface access is the calling time length of the micro service method.
According to one aspect of embodiments herein, the method comprises: and determining interface calling time-consuming information of the micro service program according to the sum of the calling time durations of a plurality of simultaneously called micro service methods in the micro service program.
According to one aspect of embodiments herein, the message queue comprises: one of a message queue within the microservice, a message queue in the AOP.
According to one aspect of embodiments herein, the method further comprises: judging whether the micro service method is abnormal or not according to the time consumed, the name of the micro service method corresponding to the tangent point and a preset alarm value; and if the micro-service method is abnormal, recording abnormal information.
Embodiments herein provide a cut plane programming oriented interface call time consuming computing device, the device comprising:
the AOP plug-in package name configuration unit is used for calling a time-consuming micro service program according to a predetermined interface to be calculated and configuring the AOP plug-in package name, wherein the AOP plug-in package name comprises a micro service program deployment path, and the micro service program comprises a plurality of micro service methods; the cut-in unit is used for cutting in the AOP plug-in to the tangent point of the micro-service method in the micro-service program according to the AOP plug-in package name; a plug-in log printing unit, which is used for printing the AOP plug-in log when the micro service method is executed to the tangent point; and the interface time consumption information determining unit is used for determining the interface time consumption information of the micro service program according to the called time length of the micro service method recorded in the log.
Embodiments herein also provide a computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the interface for profile-oriented programming to call a time-consuming computation method when executing the computer program.
Embodiments herein also provide a computer-readable storage medium storing a computer program, which when executed by a processor implements the interface for tangent-oriented programming to call a time-consuming computation method.
Embodiments also provide a computer program product, which includes a computer program, and when executed by a processor, the computer program implements the interface for tangent-oriented programming to call a time-consuming calculation method.
According to the scheme, by the aid of the global AOP principle, AOP plug-ins and micro-service program lead-in plug-ins are provided, the time-consuming function of a non-invasive statistical interface can be realized through related configuration, and the statistical efficiency of micro-service services is improved.
Drawings
In order to more clearly illustrate the embodiments or technical solutions in the prior art, the drawings used in the embodiments or technical solutions in the prior art are briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present disclosure, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a flowchart illustrating a method for calculating time-consuming interface calls for profile-oriented programming according to an embodiment of the present disclosure;
FIG. 2 is a flowchart illustrating a method for configuring AOP plugin package names according to an embodiment of the present disclosure;
FIG. 3 is a flowchart illustrating a method for switching an AOP plugin into a microservice method according to an embodiment of the disclosure;
FIG. 4 is a flowchart illustrating a method for determining a time duration for which a micro service method is invoked according to an embodiment of the present disclosure;
FIG. 5 is a flow chart illustrating a method for determining a time-consuming exception according to an embodiment of the present disclosure;
FIG. 6 is a block diagram of a section-oriented programming interface call time-consuming computing device according to an embodiment of the present disclosure;
FIG. 7 is a block diagram illustrating a specific structure of a section-oriented programming interface call time-consuming computing device according to an embodiment of the present disclosure;
fig. 8 is a schematic structural diagram of a computer device according to an embodiment of the present disclosure.
Description of the figures the symbols:
601. an AOP plug-in package name configuration unit;
602. a cutting unit;
603. a plug-in log printing unit;
604. an interface time consumption information determining unit;
6041. an interface access start time determination module;
6042. an interface access end time determining module;
802. a computer device;
804. a processor;
806. a memory;
808. a drive mechanism;
810. an input/output module;
812. an input device;
814. an output device;
816. a presentation device;
818. a graphical user interface;
820. a network interface;
822. a communication link;
824. a communication bus.
Detailed Description
In order to make the technical solutions in the present specification better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments, but not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments herein without making any creative effort, shall fall within the scope of protection.
It should be noted that the terms "first," "second," and the like in the description and claims herein and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments herein described are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, apparatus, article, or device that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or device.
The present specification provides method steps as described in the examples or flowcharts, but may include more or fewer steps based on routine or non-inventive labor. The order of steps recited in the embodiments is merely one manner of performing the steps in a multitude of orders and does not represent the only order of execution. When an actual system or apparatus product executes, it can execute sequentially or in parallel according to the method shown in the embodiment or the figures.
It should be noted that the interface call time-consuming calculation method for the tangent plane programming can be used in the field of software development and can also be used in the field of finance, and the application fields of the interface call time-consuming calculation method and the device for the tangent plane programming are not limited.
In this specification, aspect-Oriented Programming (AOP) is a technology for dynamically proxying and implementing unified maintenance of program functions during running in a pre-compiling manner, and the technology extracts common functions of different objects and calls the common functions in a tangent point triggering manner. The method can be switched into a designated class and a designated method during program compiling and running, and can isolate each part of the business logic by using the section-oriented programming, so that the coupling degree between each part of the business logic is reduced, the reusability of the program is improved, and the development efficiency is improved. The AOP is an important component of Spring, is used for realizing log monitoring, transaction management, authority control and the like, and has no invasion to original codes. When the microservice program runs, the AOP matches a target method needing cut-in, namely a called background data interface, according to the defined cut-in point, and a cut surface is generated in a dynamic proxy mode.
Fig. 1 is a flowchart illustrating a method for calculating time consumption for interface call facing to section programming according to an embodiment of the present disclosure, which specifically includes the following steps:
In some embodiments of the present description, a microservice program includes one or more microservice methods. When the microserver is called by a caller, the microserver method is accessed. Microservice methods include, but are not limited to: adding, modifying, inquiring, deleting and the like. See FIG. 2 for a detailed description of configuring AOP plugin package names.
And step 102, according to the AOP plug-in package name, cutting the AOP plug-in into the tangent point of the micro-service method in the micro-service program. In this step, the micro service program corresponding to the AOP plug-in is determined according to the AOP plug-in package name and the configuration parameters recorded by the configuration file of the micro service program. And inserting the AOP plug-in into the tangent point of the micro-service method in the micro-service program in an annotation mode, namely, introducing the related function of the AOP plug-in into the micro-service method according to the configured tangent point. In this specification, the AOP plugin is invoked in the form of a tangent point trigger. The cut points may be objects, annotations, etc., and may be declared using parameters in the Aspect annotation or via an xml configuration file.
Since each microserver includes one or more microserver methods, this step also involves cutting the AOP plug-in package name into the corresponding one or more microserver methods of the microserver. For the micro service program, the AOP plug-in is introduced into the code of the micro service program, the class, the attribute and the method in the AOP plug-in can be directly used, and the micro service method corresponding to all the micro service programs under the package name is cut in by reading the package name of the AOP plug-in. Specifically, the AOP plug can be introduced by configuring the coordinates of the AOP plug in pom. For example, the coordinates of the AOP insert are:
<groupId>org.aop.logging</groupId>
<artifactId>aop-logging</artifactId>
<version>1.0</version>
and providing a mechanism for injecting the tangent plane for a micro service program, and binding the defined tangent plane to the service through the tangent point in the running of the micro service program. By the AOP section programming, the coupling between codes which are calculated by consuming time for the micro program service interface and all micro service method codes in the micro service program can be reduced.
And 103, when the micro service method is accessed, the AOP plug-in is activated by the tangent point, and the AOP plug-in prints a log. In this step, the AOP plugin reads the configured package name as a tangent point, and the micro-service method is switched into the AOP plugin to register all programs. When the micro service method is called or accessed by the main service, the AOP plug-in unit carries out enhancement according to the called action of the micro service method. Specifically, when the micro-service method is called and accessed by the main service, the AOP plug-in intercepts the tangent point and prints the log; when the micro service method is called and returned by the main service, the AOP plug-in intercepts the tangent point and prints the log again. The AOP insert of the present specification includes a front portion and a rear portion, which are not limited in the present specification.
And step 104, determining interface time consumption information of the micro service program according to the called time length of the micro service method recorded in the log. In this step, the time length of the micro service method invoked by the main service is determined according to the log printing time recorded in the log printed twice in step 103. And further determining the interface time consumption information of the micro-service program.
Fig. 2 is a flowchart of a method for configuring an AOP plugin package name according to an embodiment of the present disclosure, which specifically includes the following steps:
In this step, the micro service program is usually deployed in a server, and the configuration parameters are determined in the configuration file of the micro service program according to the location or address of the server where the micro service is deployed. Specifically, the parameters may be configured in a property file, an application file, and the like of the microserver. In some embodiments of the present description, the configuration item parameter may be a parameter in the form of a key-value pair. For example, the configuration item parameter is a key value pair AOP. Logging. Scope = com/gold/guava/guava, where the key is AOP. Logging. Scope and the corresponding value is com/gold/guava/guava, indicating that the AOP will cut through all micro-servers under com/gold/guava/guava. Taking the value in the configuration item parameter as the deployment path of the microservice program
Fig. 3 is a flowchart illustrating a method for switching an AOP plugin into a microservice according to an embodiment of the present disclosure, which specifically includes the following steps:
In some embodiments of the present description, when an AOP plugin cuts into a microservice method in a microservice program, the AOP plugin may get method intervention corresponding to the microservice method. In the subsequent steps, the AOP plug-in intercepts the endpoint according to the called progress of the micro service method.
Fig. 4 is a flowchart of a method for determining a called duration of a microservice method according to an embodiment of the present disclosure, which specifically includes the following steps:
In some embodiments of the present description, the action to be performed is determined at a particular connection point of the section, based on the action that the microservice is invoked by the caller, and the action to be performed may also be understood as a notification. In this specification, notifications include pre-notifications and post-notifications, notifications are associated with a tangent point, and a specific microservice method is run on a connection point that satisfies the tangent point. In this step, the tangent point is determined in advance based on the operation of the microservice starting the called access. When the code of the micro-service method actually runs to the tangent point, the tangent point is intercepted, the preposed notice is determined, the log is printed, and the preposed time is recorded in the printed log, namely the time of entering the micro-service method and the time of accessing the interface.
In some embodiments of the present specification, the interface call time consumption information of the microservice program is determined according to the sum of the call time durations of a plurality of microservice methods which are called simultaneously in the microservice program. For example, under the micro service program for querying the exchange rate, 3 micro service methods are called simultaneously. The respective called time lengths of the 3 micro-service methods are added to determine the interface calling time of the query exchange rate micro-service program.
In some embodiments of the present description, according to the micro service method of the hand-in, after obtaining the start time of the interface access, print the log output, input the information related to the start time into the message queue, and then continue the internal logic of the micro service program interface; when the internal logic execution of the micro service interface returns, the AOP records the end time of the interface access, and inputs the information related to the end time into the message queue. And further, by configuring data in a consumption message queue such as a service address and topic in the message queue, calculating the time consumed by interface calling of the micro service method after acquiring the micro service method name, the micro service method starting time and the micro service method ending time of the micro service interface in the message queue. In some embodiments of the present description, the information in the message queue is represented as follows: { method: queryTime, startTime:20220720200730, endtime.
In some embodiments of the present description, the message queue comprises at least one of a message queue within a microservice, a message queue in an AOP.
Fig. 5 is a flowchart of a method for determining a time-consuming exception according to an embodiment of the present disclosure, which specifically includes the following steps:
step 501: and judging whether the micro-service method is abnormal or not according to the time consumed, the name of the micro-service method corresponding to the tangent point and a preset alarm value. In this step, the request consuming too long time will cause the calling party to call overtime, which will cause error reporting and cause the risk of service production. Therefore, the alarm value of the interface time consumption is preset and is used for judging whether the time consumption of the time-consuming micro-service method is overtime or not.
Fig. 6 is a schematic structural diagram of a time-consuming computing device for interface call facing a section programming according to an embodiment of the present disclosure, where a basic structure of the time-consuming computing device for interface call facing a section programming is described in this diagram, where functional units and modules may be implemented in a software manner, or may be implemented by using a general chip or a specific chip, and the time-consuming computing device for interface call facing a section programming is implemented by invoking the time-consuming computing interface facing a section programming, and the time-consuming computing device specifically includes:
an AOP plugin package name configuration unit 601, configured to configure an AOP plugin package name according to a micro service program that is time-consuming to call a predetermined interface to be calculated, where the AOP plugin package name includes a micro service program deployment path, and the micro service program includes multiple micro service methods;
a cut-in unit 602, configured to cut in an AOP plugin to a cut point of a micro-service method in the micro-service program according to the AOP plugin package name;
a plug-in log printing unit 603 configured to print the AOP plug-in log when the microservice method is executed to the tangent point;
an interface time consumption information determining unit 604, configured to determine interface time consumption information of the microservice program according to the called time length of the microservice method recorded in the log.
According to the scheme, by the aid of the global AOP principle, AOP plug-ins and micro-service program lead-in plug-ins are provided, the time-consuming function of a non-invasive statistical interface can be realized through related configuration, and the statistical efficiency of micro-service services is improved.
As an embodiment herein, reference may also be made to a schematic structural diagram of the interface call time-consuming computing apparatus, which is programmed facing the tangent plane in this embodiment as shown in fig. 7.
As an embodiment herein, the interface time consumption information determining unit 604 further includes:
an interface access start time determining module 6041, configured to intercept the tangent point calling AOP plugin when the micro service is called for access, print a log, and record start time of the interface access in a message queue;
an interface access end time determining module 6042, configured to intercept the point-of-contact call AOP plugin when the microservice is called and returned, print a log, and record end time of the interface access in a message queue;
as shown in fig. 8, a computer device provided in the embodiments herein, which may be a computer device in the embodiments herein, performs the above method herein. The computer device 802 may include one or more processors 804, such as one or more Central Processing Units (CPUs), each of which may implement one or more hardware threads. The computer device 802 may also include any memory 806 for storing any kind of information, such as code, settings, data, etc. For example, and without limitation, memory 806 may include any one or more of the following in combination: any type of RAM, any type of ROM, flash memory devices, hard disks, optical disks, etc. More generally, any memory may use any technology to store information. Further, any memory may provide volatile or non-volatile retention of information. Further, any memory may represent fixed or removable components of computer device 802. In one case, when the processor 804 executes the associated instructions, which are stored in any memory or combination of memories, the computer device 802 can perform any of the operations of the associated instructions. The computer device 802 also includes one or more drive mechanisms 808, such as a hard disk drive mechanism, an optical disk drive mechanism, etc., for interacting with any memory.
Corresponding to the methods in fig. 1 to 5, the embodiments herein also provide a computer-readable storage medium having stored thereon a computer program, which, when executed by a processor, performs the steps of the above-described method.
Embodiments herein also provide computer readable instructions, wherein when executed by a processor, a program thereof causes the processor to perform the method as shown in fig. 1-5.
Embodiments herein also provide a computer program product comprising a computer program which, when executed by a processor, implements the method as shown in fig. 1 to 5.
It should be understood that, in various embodiments herein, the sequence numbers of the above-mentioned processes do not mean the execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments herein.
It should also be understood that, in the embodiments herein, the term "and/or" is only one kind of association relation describing an associated object, meaning that three kinds of relations may exist. For example, a and/or B, may represent: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter associated objects are in an "or" relationship.
Those of ordinary skill in the art will appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the components and steps of the various examples have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the technical solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present disclosure.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided herein, it should be understood that the disclosed system, apparatus, and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may also be an electric, mechanical or other form of connection.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purposes of the embodiments herein.
In addition, functional units in the embodiments herein may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solutions in the present invention substantially or partially contribute to the prior art, or all or part of the technical solutions may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the methods described in the embodiments herein. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The principles and embodiments of this document are explained herein using specific examples, which are presented only to aid in understanding the methods and their core concepts; meanwhile, for the general technical personnel in the field, according to the idea of this document, there may be changes in the concrete implementation and the application scope, in summary, this description should not be understood as the limitation of this document.
Claims (11)
1. A time-consuming calculation method for interface call of section-oriented programming is characterized by comprising the following steps:
according to a pre-determined micro service program consuming the call of an interface to be calculated, configuring an AOP plug-in package name, wherein the AOP plug-in package name comprises a deployment path of the micro service program, and the micro service program comprises a plurality of micro service methods;
according to the AOP plug-in package name, cutting the AOP plug-in into a cut point of a micro-service method in the micro-service program;
when the micro service method is accessed, the AOP plug-in is activated by the tangent point and a log is printed by the AOP plug-in;
and determining the interface time consumption information of the micro service program according to the called time length of the micro service method recorded in the log.
2. The interface call time-consuming calculation method for tangent plane programming according to claim 1, wherein the configuring the AOP plugin package name according to the predetermined micro service program that is time-consuming for the interface call to be calculated comprises:
determining a micro-service program which consumes time for calling an interface to be calculated according to the time-consuming calculation requirement for calling the interface;
determining configuration item parameters in a configuration file of the micro service program according to the deployment position of the micro service program in a server, wherein the configuration item parameters comprise a deployment path of the micro service program;
and determining the deployment path as the AOP plug-in package name.
3. The interface call time-consuming calculation method for tangent plane oriented programming according to claim 2, wherein the step of cutting in the AOP plugin to the cut point of the micro service method in the micro service program according to the AOP plugin package name comprises:
inquiring the configuration item parameters of the micro service programs, and determining the deployment path in the configuration item parameters in each micro service program;
and according to the deployment path, cutting in the AOP plug-in corresponding to the package name with the same content as the deployment path to the tangent point of the micro-service method in the micro-service program.
4. The interface call time-consuming calculation method for tangent plane oriented programming according to claim 3, wherein the time duration for the micro service method to be called comprises:
when the micro service is called and accessed, intercepting the tangent point to call an AOP plug-in, printing a log and recording the starting time of the interface access in a message queue;
and when the micro service is called and returned, intercepting the point of tangency and calling the AOP plug-in, printing a log and recording the end time of the interface access in a message queue, wherein the difference between the start time and the end time of the interface access is the called time length of the micro service method.
5. The interface call time-consuming calculation method for tangent plane oriented programming according to claim 4, wherein the method comprises:
and determining interface calling time-consuming information of the micro service program according to the sum of the calling time durations of a plurality of simultaneously called micro service methods in the micro service program.
6. The interface call time-consuming calculation method for tangent plane oriented programming according to claim 5, wherein the message queue comprises: one of a message queue within the microservice, a message queue in the AOP.
7. The tangent-oriented programming interface call time-consuming calculation method of claim 6, further comprising:
judging whether the micro service method is abnormal or not according to the time consumed, the name of the micro service method corresponding to the tangent point and a preset alarm value;
and if the micro-service method is abnormal, recording abnormal information.
8. An interface call time-consuming computing apparatus for profile-oriented programming, the apparatus comprising:
the AOP plug-in package name configuration unit is used for calling a time-consuming micro service program according to a predetermined interface to be calculated and configuring the AOP plug-in package name, wherein the AOP plug-in package name comprises a micro service program deployment path, and the micro service program comprises a plurality of micro service methods;
the cut-in unit is used for cutting in the AOP plug-in to the cut-in point of the micro-service method in the micro-service program according to the package name of the AOP plug-in;
a plug-in log printing unit, which is used for activating the AOP plug-in by the tangent point when the micro service method is accessed, and printing a log by the AOP plug-in;
and the interface time consumption information determining unit is used for determining the interface time consumption information of the micro service program according to the called time length of the micro service method recorded in the log.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method of any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by a processor, implements the method of any one of claims 1 to 7.
11. A computer program product, characterized in that the computer program product comprises a computer program which, when being executed by a processor, carries out the method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210921028.3A CN115248737A (en) | 2022-08-02 | 2022-08-02 | Interface calling time-consuming calculation method and device for section-oriented programming |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210921028.3A CN115248737A (en) | 2022-08-02 | 2022-08-02 | Interface calling time-consuming calculation method and device for section-oriented programming |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115248737A true CN115248737A (en) | 2022-10-28 |
Family
ID=83700230
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210921028.3A Pending CN115248737A (en) | 2022-08-02 | 2022-08-02 | Interface calling time-consuming calculation method and device for section-oriented programming |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115248737A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115904365A (en) * | 2023-02-14 | 2023-04-04 | 支付宝(杭州)信息技术有限公司 | Interface resource identification method, device, equipment and readable storage medium |
-
2022
- 2022-08-02 CN CN202210921028.3A patent/CN115248737A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115904365A (en) * | 2023-02-14 | 2023-04-04 | 支付宝(杭州)信息技术有限公司 | Interface resource identification method, device, equipment and readable storage medium |
CN115904365B (en) * | 2023-02-14 | 2023-05-23 | 支付宝(杭州)信息技术有限公司 | Interface resource identification method, device, equipment and readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11689899B2 (en) | System and method for triggering on platform usage | |
CA2725274C (en) | Monitoring and tracking application usage | |
CN111708749B (en) | Operation log recording method and device, computer equipment and storage medium | |
EP3403187A1 (en) | Single click delta analysis | |
WO2020259003A1 (en) | Link tracking method and apparatus | |
CN111092745A (en) | Log processing method and device based on block chain, computer equipment and storage medium | |
CN112527414A (en) | Front-end-based data processing method, device, equipment and storage medium | |
CN107870762A (en) | SOA calls the method, apparatus and system of link trace | |
WO2020224100A1 (en) | Blockchain configuration file processing apparatus, system, and method, and storage medium | |
CN111131221A (en) | Interface checking device, method and storage medium | |
EP3213193A1 (en) | Monitoring and correlating a binary process in a distributed business transaction | |
CN112039701A (en) | Interface call monitoring method, device, equipment and storage medium | |
CN116893945A (en) | Operation and maintenance cloud platform service early warning method, system and device | |
CN115248737A (en) | Interface calling time-consuming calculation method and device for section-oriented programming | |
CN112187509A (en) | Multi-architecture cloud platform execution log management method, system, terminal and storage medium | |
CN114895879B (en) | Management system design scheme determining method, device, equipment and storage medium | |
CN113656795B (en) | Window operation behavior auditing method and system | |
CN113761524A (en) | Active window auditing method and system | |
CN114186958A (en) | Method, computing device and storage medium for exporting list data as spreadsheet | |
CN113364815A (en) | Cross-site scripting vulnerability attack defense method and device | |
CN112269941A (en) | Business real-time pushing method and system, electronic equipment and storage medium | |
CN112181535A (en) | Interface calling method, device, server and storage medium | |
Lencevicius et al. | Performance assertions for mobile devices | |
CN115242625B (en) | Service deployment method, device, computer equipment and readable storage medium | |
CN117978855A (en) | User operation termination method, device, server and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |