CN117459595A - Flow recording method and device, storage medium and computer equipment - Google Patents

Flow recording method and device, storage medium and computer equipment Download PDF

Info

Publication number
CN117459595A
CN117459595A CN202311448094.4A CN202311448094A CN117459595A CN 117459595 A CN117459595 A CN 117459595A CN 202311448094 A CN202311448094 A CN 202311448094A CN 117459595 A CN117459595 A CN 117459595A
Authority
CN
China
Prior art keywords
called
interface method
target interface
time
recording
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
Application number
CN202311448094.4A
Other languages
Chinese (zh)
Inventor
欧胜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Pinwei Software Co Ltd
Original Assignee
Guangzhou Pinwei Software Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Guangzhou Pinwei Software Co Ltd filed Critical Guangzhou Pinwei Software Co Ltd
Priority to CN202311448094.4A priority Critical patent/CN117459595A/en
Publication of CN117459595A publication Critical patent/CN117459595A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application provides a flow recording method, a device, a storage medium and computer equipment, and can determine the latest called moment corresponding to the target interface method in the called process and record the latest called moment in a target record file under the condition that the target interface method needing flow recording is called. According to the method and the device, whether the target interface method is frequently called at present can be dynamically judged according to the called time of each target interface method. If not, the flow data corresponding to the target interface method in the called process can be recorded so as to record the flow of the target interface method under the low-frequency call, and the flow recording is realized. If the target interface method is called frequently at present, the flow data corresponding to the target interface method in the called time can not be recorded so as to filter the flow of the target interface method under the high-frequency call, thereby dynamically reducing the flow recording times of the target interface method and further reducing the load of the central processing unit.

Description

Flow recording method and device, storage medium and computer equipment
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and apparatus for recording traffic, a storage medium, and a computer device.
Background
The JVM (Java Virtual Machine ) sandbox is a non-invasive AOP (Aspect Oriented Programming, tangent plane-oriented programming) scheme based on a JVM platform, and can perform test record behaviors such as on-line fault location, on-line system flow control, on-line fault simulation, log printing, flow recording and the like on JVM applications. However, the inventor researches and discovers that the existing flow recording scheme easily causes the problem that the load of the central processing unit is too high.
Disclosure of Invention
The present application aims to solve at least one of the above technical drawbacks, especially the technical drawbacks of the prior art that easily cause the cpu to be overloaded.
In a first aspect, an embodiment of the present application provides a method for recording a flow, where the method includes:
under the condition that the target interface method requiring flow recording is called, determining the latest called time, and recording the latest called time in a target record file; the latest called time is the called time corresponding to the target interface method in the called process;
judging whether the target interface method meets a preset high-frequency called rule or not according to each called moment recorded in the target record file;
if the high-frequency called rule is met, not recording the flow data corresponding to the target interface method in the called process, otherwise, recording the flow data corresponding to the target interface method in the called process.
In one embodiment, the determining, according to each called time recorded in the target record file, whether the target interface method meets a preset high-frequency called rule includes:
if the number of the time records corresponding to the target record file is greater than or equal to a preset number threshold N, determining N called times closest to the latest called time among all called times recorded by the target record file; wherein N is a positive integer greater than 1;
calculating the interval duration between the latest called time and the earliest called time in the N called times;
and judging whether the target interface method meets the high-frequency called rule or not based on the interval duration.
In one embodiment, the determining, based on the interval duration, whether the target interface method meets the high-frequency invoked rule includes:
if the interval duration is smaller than or equal to the preset duration, determining that the high-frequency called rule is met;
and if the interval time length is longer than the preset time length, determining that the high-frequency called rule is not satisfied.
In one embodiment, the determining, according to each called time recorded in the target record file, whether the target interface method meets a preset high-frequency called rule further includes:
and if the number of the time records is smaller than the preset number threshold, determining that the high-frequency called rule is not satisfied.
In one embodiment, the recording the latest called time in the target record file includes:
if the number of the time records corresponding to the target record file is greater than or equal to a preset number threshold, deleting the earliest called time in the target record file, and recording the latest called time in the target record file; wherein the preset number threshold is a positive integer greater than 1.
In one embodiment, the recording the flow data corresponding to the target interface method in the called time includes:
respectively acquiring corresponding input parameters and response data of the target interface method in the called process;
flow data is generated based on the input parameters and the response data.
In a second aspect, an embodiment of the present application provides a flow recording apparatus, where the apparatus includes:
the recording module is used for determining the latest called moment and recording the latest called moment in a target record file under the condition that the target interface method which needs to record the flow is called; the latest called time is the called time corresponding to the target interface method in the called process;
the high-frequency calling judging module is used for judging whether the target interface method meets a preset high-frequency called rule according to each called moment recorded in the target record file;
and the flow recording module is used for not recording the flow data corresponding to the target interface method in the current call if the high-frequency called rule is met, otherwise, recording the flow data corresponding to the target interface method in the current call.
In one embodiment, the high frequency call judging module includes:
the time determining unit is used for determining N called times closest to the latest called time among the called times recorded by the target record file under the condition that the number of the time records corresponding to the target record file is greater than or equal to a preset number threshold N; wherein N is a positive integer greater than 1;
an interval duration calculation unit, configured to calculate an interval duration between the latest called time and an earliest called time in the N called times;
and the rule judging unit is used for judging whether the target interface method meets the high-frequency called rule or not based on the interval duration.
In a third aspect, embodiments of the present application provide a storage medium having stored therein computer readable instructions that, when executed by one or more processors, cause the one or more processors to perform the steps of the flow recording method described in any of the above embodiments.
In a fourth aspect, embodiments of the present application provide a computer device, comprising: one or more processors, and memory;
the memory has stored therein computer readable instructions which, when executed by the one or more processors, perform the steps of the flow recording method of any of the embodiments described above.
In the flow recording method, the device, the storage medium and the computer equipment provided in some embodiments of the present application, when it is monitored that the target interface method that needs to perform flow recording is called, the latest called time corresponding to the target interface method in the current called time may be determined, and the latest called time is recorded in the target recording file, so as to record each called time of the target interface method. The computer equipment can dynamically judge whether the target interface method is frequently called at present according to each called moment of the target interface method. If not, the flow data corresponding to the target interface method in the called process can be recorded so as to record the flow of the target interface method under the low-frequency call, and the flow recording is realized. If the target interface method is called frequently at present, the flow data corresponding to the target interface method in the called time can not be recorded so as to filter the flow of the target interface method under the high-frequency call, thereby dynamically reducing the flow recording times of the target interface method and further reducing the load of the central processing unit.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive faculty for a person skilled in the art.
FIG. 1 is a flow chart of a flow recording method according to an embodiment;
FIG. 2 is a block diagram of a flow recording apparatus according to one embodiment;
FIG. 3 is an internal block diagram of a computer device in one embodiment.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
As described in the background art, the existing flow recording scheme easily causes the problem that the load of the central processing unit is too high. The inventor has found that the cause of this problem is: when the method is monitored to be called, the prior art records detailed calling information corresponding to the target interface method in the call so as to record flow data corresponding to the call. However, during the running of an application, some interface methods of the application have the possibility of being frequently invoked. For example, the average call frequency of an interface method may be as high as tens or even tens of times per minute during a particular period of time and/or for a particular generic interface method. When the target interface method related to the flow recording is frequently called, if the flow data corresponding to each call is recorded, the load of the central processing unit is too high due to the excessively large recording data volume, so that the problems of influence on the flow recording, such as blocking, downtime and the like, are easily caused.
In order to solve the above problems, some embodiments of the present application provide a flow recording method, a device, a storage medium, and a computer device, which can dynamically reduce the number of times of flow recording of a target interface method by filtering the flow of the target interface method required to record the flow under high frequency call, thereby reducing the load of a central processing unit.
In one embodiment, the present application provides a flow recording method, and the following embodiment uses the method as an example applied to a computer device. It will be appreciated that the computer device described herein may be any device having data processing capabilities, and may be, but is not limited to, various servers, personal computers, notebook computers, and tablet computers.
As shown in fig. 1, the flow recording method of the present application specifically includes the following steps:
s102: under the condition that the target interface method requiring flow recording is called, determining the latest called time, and recording the latest called time in a target record file; and the latest called time is the called time corresponding to the target interface method in the called process.
The target interface method may be an interface method that needs to record traffic. The latest called time may be the called time corresponding to the last called time of the target interface method, and when the target interface method is monitored to be called, the monitored current called time is the last called time of the target interface method, so the latest called time is the called time corresponding to the target interface method in the current call. The target record file may be a file for recording each called time of the target interface method, which may be stored in a computer device that performs the flow recording method or remotely in another computer device other than the computer device that performs the flow recording method, which is not particularly limited herein.
In particular, the computer device may monitor whether the target interface method is invoked, i.e., whether the target interface method or other interface methods invoke the target interface method, to perform the various method steps included by the target interface method. It will be appreciated that call snooping may be implemented in any manner, and in one example, the present application may snoop whether a target interface method is invoked based on a JVM sandbox.
Under the condition that the calling of the target interface method is monitored, the computer equipment can determine the corresponding called time of the target interface method in the current called time so as to determine the latest called time of the target interface method, and record the latest called time in the target record file. The computer equipment records the called time corresponding to the target interface method in the target record file under the condition that the computer equipment monitors that the target interface method is called each time, so that the target record file can record each called time corresponding to the target interface method.
S104: and judging whether the target interface method meets a preset high-frequency called rule or not according to each called moment recorded in the target record file.
The high-frequency called rule can be used for judging whether the target interface method is frequently called at present, namely judging whether the target interface method is in a high-frequency calling state or whether the target interface method is in a high-frequency calling period of the target interface method at present. It will be appreciated that the specific judgment rule of the high-frequency invoked rule may be determined according to the actual situation, which is not particularly limited in this embodiment.
The frequency of invocations of the same interface method may vary during the running of the program, for example over time and/or with the amount of active users. In order to dynamically determine whether the target interface method is frequently called at present, the computer device may determine whether the target interface method satisfies the high-frequency called rule according to each called time recorded in the target record file. For example, the call frequency of the target interface method may be calculated according to each called time, and whether the high-frequency called rule is satisfied may be determined based on the call frequency. For another example, a time interval between the latest called time and the called time corresponding to the target interface method in the previous called time may be calculated, and whether the high-frequency called rule is satisfied may be determined based on the time interval.
S106: if the high-frequency called rule is met, not recording the flow data corresponding to the target interface method in the called process, otherwise, recording the flow data corresponding to the target interface method in the called process.
Specifically, if a preset high-frequency called rule is met, the method indicates that the target interface method is frequently called at present. In this case, the computer device may filter the flow data corresponding to the target interface method in the current call, that is, the flow data corresponding to the current call is not recorded. Therefore, the flow recording times of the target interface method can be reduced, and the load of the central processing unit can be further reduced.
If the high-frequency called rule is not satisfied, the method indicates that the target interface method is not called frequently at present, namely the target interface method is in a low-frequency called state. Under the condition, the computer equipment can record the flow data corresponding to the target interface method in the called process so as to record the flow data of the target interface method under the low-frequency call, thereby realizing the flow recording.
It can be appreciated that when flow data needs to be recorded, the application can determine parameter information needing to be recorded according to actual needs, and complete recording based on any mode. In one example, the recording the flow data corresponding to the target interface method in the invoked process includes:
step A1: respectively acquiring corresponding input parameters and response data of the target interface method in the called process;
step A2: flow data is generated based on the input parameters and the response data.
The input parameters refer to parameters input to the target interface method when the target interface method is called, so that the target interface method can execute corresponding method steps based on the parameters. The response data is data returned by the target interface method after executing the corresponding method steps based on the input parameters. The computer equipment can generate flow data according to the input parameters and response data corresponding to the target interface method in the current call so as to accurately and comprehensively record the flow data corresponding to the target interface method in the current call.
For example, the first interface method calls the second interface method, and the first parameter is used as an input parameter of the second interface method when the first interface method is called. The second interface method performs the corresponding method steps based on the first parameters and returns the second parameters to the first interface method. In this example, the input parameter is a first parameter and the response data is a second parameter.
In the embodiment of the application, when the target interface method needing to record the flow is monitored to be called, the latest called time corresponding to the target interface method in the called process can be determined, and the latest called time is recorded in the target record file so as to record each called time of the target interface method. The computer equipment can dynamically judge whether the target interface method is frequently called at present according to each called moment of the target interface method. If not, the flow data corresponding to the target interface method in the called process can be recorded so as to record the flow of the target interface method under the low-frequency call, and the flow recording is realized. If the target interface method is called frequently at present, the flow data corresponding to the target interface method in the called time can not be recorded so as to filter the flow of the target interface method under the high-frequency call, thereby dynamically reducing the flow recording times of the target interface method and further reducing the load of the central processing unit.
In one embodiment, the determining whether the target interface method meets a preset high-frequency called rule according to each called time recorded in the target record file includes:
if the number of the time records corresponding to the target record file is greater than or equal to a preset number threshold N, determining N called times closest to the latest called time among all called times recorded by the target record file; wherein N is a positive integer greater than 1;
calculating the interval duration between the latest called time and the earliest called time in the N called times;
and judging whether the target interface method meets the high-frequency called rule or not based on the interval duration.
The time record number refers to the total number of called times corresponding to the target interface method, which is recorded by the target record file. The specific value of the preset number threshold may be determined according to practical situations, and for convenience of explanation, some embodiments are described herein with reference to the preset number threshold being equal to 10 as an example.
Specifically, when it is monitored that the target interface method is called, if the target record file records at least N called times, the computer device may screen N called times closest to the latest called time on the time axis from among the called times recorded in the target record file. In the case where N called times are determined, the computer device may determine an earliest called time among the N called times. The earliest called time may be the (N-1) th called time closest to the latest called time, recorded by the target record file. The computer device may calculate an interval duration between a latest called time and an earliest called time, and determine whether the target interface method is frequently called based on the interval duration.
For example, the target record file may record Y called times, where Y is greater than N and Y is a positive integer, and the Y called times are respectively in order from early to late: t (T) 1 、T 2 ……T Y ,T Y For the latest called time, T can be calculated Y 、T Y-1 、T Y-2 、……T Y-N+1 As the N called times closest to the latest called time. The computer device may calculate T Y And T is Y-N+1 And judging whether the high-frequency called rule is satisfied according to the interval duration between the two.
In this embodiment, by calculating the interval duration between the latest called time and the (N-1) -th called time closest to the latest called time, whether the target interface method meets the high-frequency called rule can be accurately determined according to the interval duration, so that erroneous judgment is reduced as far as possible, and the load of the central processing unit is further reduced.
It can be appreciated that the specific determination manner of determining whether the target interface method satisfies the high-frequency called rule based on the interval duration may be determined according to the actual situation. For example, the interval duration corresponding to the target interface method in the current time and the interval duration corresponding to the target interface method in the previous time can be compared, and whether the high-frequency called rule is satisfied or not can be judged according to the comparison.
In one embodiment, the determining whether the target interface method satisfies the high frequency called rule based on the interval duration includes:
if the interval duration is smaller than or equal to the preset duration, determining that the high-frequency called rule is met;
and if the interval time length is longer than the preset time length, determining that the high-frequency called rule is not satisfied.
In other words, the computer device may compare the interval duration corresponding to the current invoked time with the preset duration, and determine whether the high-frequency invoked rule is satisfied according to the magnitude relationship between the interval duration and the preset duration. Thus, whether the target interface method is frequently called can be accurately and rapidly judged. It will be appreciated that the specific value of the preset time period may be determined according to the actual situation, and may be 30 seconds or 60 seconds, for example.
In one embodiment, the determining, according to each called time recorded in the target record file, whether the target interface method meets a preset high-frequency called rule further includes: and if the number of the time records is smaller than the preset number threshold, determining that the high-frequency called rule is not satisfied.
Specifically, when the number of called times recorded in the target record file is smaller than the preset number threshold N, it indicates that the number of times of calling the target interface method is smaller than N, in this case, the computer device may determine that the target interface method does not satisfy the high-frequency called rule, and record flow data corresponding to the target interface method in the current call, so as to complete flow recording.
For example, when the preset number threshold is 10, the computer device may record the flow data corresponding to the 1 st to 9 th times of the target interface method. When the number of times of the called of the target interface method is greater than or equal to 10, the computer equipment can calculate the interval duration between the latest called time corresponding to the time and the called time corresponding to the (N-9) th time, and judge whether to record the flow data corresponding to the called time according to the interval duration.
In this embodiment, even if the target interface method is frequently called in a short time, the computer device may record part of the traffic data of the target interface method in the frequently called period. Thus, the computer equipment records partial flow data of the target interface method in the high-frequency called time period and the flow data of the target interface method in the low-frequency called time period, so that the flow data of the target interface method under various conditions can be recorded, and the comprehensiveness of the recorded flow data is improved.
In one embodiment, the recording the latest called time in the target record file includes:
if the number of the time records corresponding to the target record file is greater than or equal to a preset number threshold, deleting the earliest called time in the target record file, and recording the latest called time in the target record file; wherein the preset number threshold is a positive integer greater than 1.
The specific description of the number of time records refers to the above embodiments, and is not repeated herein. Specifically, when the latest called time is recorded in the target record file, the computer device may determine whether the number of time records recorded in the target record file is greater than or equal to a preset number threshold. If so, deleting the earliest called time recorded in the target record file, and writing the latest called time corresponding to the called time into the target record file, so that the time record number of the target record file can be fixed, and storage resources are saved. Further, in one example, the computer device may directly write the latest called time into the target record file when the number of time records is less than a preset number threshold.
The flow recording device provided in the embodiments of the present application is described below, and the flow recording device described below and the flow recording method described above may be referred to correspondingly.
In one embodiment, the present application also provides a flow recording device 200. As shown in fig. 2, the flow recording device 200 specifically includes:
a recording module 210, configured to determine a latest called time when a target interface method that needs to record a flow is called, and record the latest called time in a target record file; the latest called time is the called time corresponding to the target interface method in the called process;
a high-frequency call judging module 220, configured to judge whether the target interface method meets a preset high-frequency called rule according to each called time recorded in the target record file;
the flow recording module 230 is configured to, if the high-frequency called rule is satisfied, not record flow data corresponding to the target interface method in the called process, otherwise, record flow data corresponding to the target interface method in the called process.
In one embodiment, the high frequency call determination module 220 of the present application may include a time determining unit, an interval duration calculating unit, and a rule determining unit. The time determining unit is used for determining N called times closest to the latest called time among the called times recorded by the target record file under the condition that the number of the time records corresponding to the target record file is greater than or equal to a preset number threshold N; wherein N is a positive integer greater than 1. And the interval duration calculation unit is used for calculating the interval duration between the latest called time and the earliest called time in the N called times. And the rule judging unit is used for judging whether the target interface method meets the high-frequency called rule or not based on the interval duration.
In one embodiment, the rule determining unit of the present application may include a first determining unit and a second determining unit. The first judging unit is used for determining that the high-frequency called rule is met if the interval duration is smaller than or equal to a preset duration. And the second judging unit is used for determining that the high-frequency called rule is not satisfied if the interval time length is longer than the preset time length.
In one embodiment, the rule determining unit of the present application is further configured to determine that the high-frequency invoked rule is not satisfied if the number of time records is less than the preset number threshold.
In one embodiment, the recording module 210 of the present application includes a time deletion unit. The time deleting unit is used for deleting the earliest called time in the target record file and recording the latest called time in the target record file if the number of time records corresponding to the target record file is greater than or equal to a preset number threshold; wherein the preset number threshold is a positive integer greater than 1.
In one embodiment, the flow recording module 230 of the present application includes a parameter data obtaining unit and a flow data generating unit. The parameter data acquisition unit is used for respectively acquiring input parameters and response data corresponding to the target interface method in the called process. The flow data generation unit is used for generating flow data based on the input parameters and the response data.
In one embodiment, the present application also provides a storage medium having stored therein computer readable instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of the method of recording a stream as in any embodiment.
In one embodiment, the present application also provides a computer device having stored therein computer readable instructions that, when executed by one or more processors, cause the one or more processors to perform the steps of the method of recording a stream as in any embodiment.
Schematically, fig. 3 is a schematic internal structure of a computer device provided in an embodiment of the present application, where in an example, the computer device may be a server. Referring to FIG. 3, computer device 900 includes a processing component 902 that further includes one or more processors, and memory resources represented by memory 901, for storing instructions, such as applications, executable by processing component 902. The application program stored in the memory 901 may include one or more modules each corresponding to a set of instructions. In addition, the processing component 902 is configured to execute instructions to perform the steps of the flow recording method of any of the embodiments described above.
The computer device 900 may also include a power component 903 configured to perform power management of the computer device 900, a wired or wireless network interface 904 configured to connect the computer device 900 to a network, and an input output (I/O) interface 905. The computer device 900 may operate based on an operating system stored in memory 901, such as Windows Server TM, mac OS XTM, unix, linux, free BSDTM, or the like.
It will be appreciated by those skilled in the art that the internal structure of the computer device shown in the present application is merely a block diagram of some of the structures related to the aspects of the present application and does not constitute a limitation of the computer device to which the aspects of the present application apply, and that a particular computer device may include more or less components than those shown in the figures, or may combine some of the components, or have a different arrangement of the components.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element. Herein, "a," "an," "the," and "the" may also include plural forms, unless the context clearly indicates otherwise. Plural means at least two cases such as 2, 3, 5 or 8, etc. "and/or" includes any and all combinations of the associated listed items.
In the present specification, each embodiment is described in a progressive manner, and each embodiment focuses on the difference from other embodiments, and may be combined according to needs, and the same similar parts may be referred to each other.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A method for recording traffic, the method comprising:
under the condition that the target interface method requiring flow recording is called, determining the latest called time, and recording the latest called time in a target record file; the latest called time is the called time corresponding to the target interface method in the called process;
judging whether the target interface method meets a preset high-frequency called rule or not according to each called moment recorded in the target record file;
if the high-frequency called rule is met, not recording the flow data corresponding to the target interface method in the called process, otherwise, recording the flow data corresponding to the target interface method in the called process.
2. The method according to claim 1, wherein the determining whether the target interface method satisfies a preset high-frequency called rule according to each called time recorded in the target record file includes:
if the number of the time records corresponding to the target record file is greater than or equal to a preset number threshold N, determining N called times closest to the latest called time among all called times recorded by the target record file; wherein N is a positive integer greater than 1;
calculating the interval duration between the latest called time and the earliest called time in the N called times;
and judging whether the target interface method meets the high-frequency called rule or not based on the interval duration.
3. The method of claim 2, wherein the determining whether the target interface method satisfies the high frequency invoked rule based on the interval duration comprises:
if the interval duration is smaller than or equal to the preset duration, determining that the high-frequency called rule is met;
and if the interval time length is longer than the preset time length, determining that the high-frequency called rule is not satisfied.
4. The method according to claim 2, wherein the determining whether the target interface method satisfies a preset high-frequency called rule according to each called time recorded in the target record file further comprises:
and if the number of the time records is smaller than the preset number threshold, determining that the high-frequency called rule is not satisfied.
5. The method of claim 1, wherein the recording the latest called time in a target record file comprises:
if the number of the time records corresponding to the target record file is greater than or equal to a preset number threshold, deleting the earliest called time in the target record file, and recording the latest called time in the target record file; wherein the preset number threshold is a positive integer greater than 1.
6. The method according to any one of claims 1 to 5, wherein the recording the flow data corresponding to the target interface method in the current call includes:
respectively acquiring corresponding input parameters and response data of the target interface method in the called process;
flow data is generated based on the input parameters and the response data.
7. A flow recording apparatus, the apparatus comprising:
the recording module is used for determining the latest called moment and recording the latest called moment in a target record file under the condition that the target interface method which needs to record the flow is called; the latest called time is the called time corresponding to the target interface method in the called process;
the high-frequency calling judging module is used for judging whether the target interface method meets a preset high-frequency called rule according to each called moment recorded in the target record file;
and the flow recording module is used for not recording the flow data corresponding to the target interface method in the current call if the high-frequency called rule is met, otherwise, recording the flow data corresponding to the target interface method in the current call.
8. The apparatus of claim 7, wherein the high frequency call determination module comprises:
the time determining unit is used for determining N called times closest to the latest called time among the called times recorded by the target record file under the condition that the number of the time records corresponding to the target record file is greater than or equal to a preset number threshold N; wherein N is a positive integer greater than 1;
an interval duration calculation unit, configured to calculate an interval duration between the latest called time and an earliest called time in the N called times;
and the rule judging unit is used for judging whether the target interface method meets the high-frequency called rule or not based on the interval duration.
9. A storage medium having stored therein computer readable instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of the flow recording method of any of claims 1 to 6.
10. A computer device, comprising: one or more processors, and memory;
stored in the memory are computer readable instructions which, when executed by the one or more processors, perform the steps of the flow recording method of any one of claims 1 to 6.
CN202311448094.4A 2023-11-01 2023-11-01 Flow recording method and device, storage medium and computer equipment Pending CN117459595A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311448094.4A CN117459595A (en) 2023-11-01 2023-11-01 Flow recording method and device, storage medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311448094.4A CN117459595A (en) 2023-11-01 2023-11-01 Flow recording method and device, storage medium and computer equipment

Publications (1)

Publication Number Publication Date
CN117459595A true CN117459595A (en) 2024-01-26

Family

ID=89579610

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311448094.4A Pending CN117459595A (en) 2023-11-01 2023-11-01 Flow recording method and device, storage medium and computer equipment

Country Status (1)

Country Link
CN (1) CN117459595A (en)

Similar Documents

Publication Publication Date Title
US9015006B2 (en) Automated enablement of performance data collection
US8095641B2 (en) Method and system for virtualized health monitoring of resources
US9003239B2 (en) Monitoring and resolving deadlocks, contention, runaway CPU and other virtual machine production issues
US8886866B2 (en) Optimizing memory management of an application running on a virtual machine
JP5152186B2 (en) Computer system, management apparatus, and computer system management method
US8516499B2 (en) Assistance in performing action responsive to detected event
US9823994B2 (en) Dynamically identifying performance anti-patterns
KR20100107464A (en) Method and apparatus for operating system event notification mechanism using file system interface
US9311598B1 (en) Automatic capture of detailed analysis information for web application outliers with very low overhead
CA2982272C (en) Automatic task tracking
US9727394B2 (en) Establishing causality order of computer trace records
US8677370B2 (en) Generating resource consumption control limits
JP2005135130A (en) Load monitoring condition decision program, system and method, and load condition monitoring program
US20160050101A1 (en) Real-Time Network Monitoring and Alerting
CN117459595A (en) Flow recording method and device, storage medium and computer equipment
CN115828256A (en) Unauthorized and unauthorized logic vulnerability detection method
EP3640821B1 (en) Coefficient calculation method, component calling method, device, medium, server, and terminal
CN112925693B (en) System monitoring method, device, computer equipment and storage medium
CN104268057A (en) Android platform based monitoring system and method for modular system
US20180007152A1 (en) Asynchronous custom exit points
CN110032488B (en) Monitoring system, method and device for specific nodes in cluster and service server
CN116775364B (en) Application service health management method and device, electronic equipment and storage medium
CN117033084B (en) Virtual machine backup method and device, electronic equipment and storage medium
US20210279114A1 (en) Event loop diagnostics
US20150288584A1 (en) System and method for determining end user timing

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