Search

CN-121996512-A - Front-end performance monitoring method and device

CN121996512ACN 121996512 ACN121996512 ACN 121996512ACN-121996512-A

Abstract

The invention discloses a front-end performance monitoring method and device, and relates to the technical field of computers. The method comprises the steps of responding to a starting event of a monitored service flow, creating a timer corresponding to the service flow and triggering the timer to start timing, monitoring each execution stage of the service flow through the timer, judging whether the execution stage needs to be dotted or not for each execution stage, and under the condition that the execution stage needs to be dotted, dotting the execution stage to obtain dotting information of the execution stage, responding to an ending event of the monitored service flow, triggering the timer to finish timing, and reporting the starting timing time and the finishing timing time of the timer and the dotting information of each execution stage to a monitoring system. According to the embodiment, fine-granularity performance monitoring of the business process can be realized, and the performance bottleneck can be accurately positioned, so that user experience is improved.

Inventors

  • CHEN YUNBIN

Assignees

  • 北京京东远升科技有限公司

Dates

Publication Date
20260508
Application Date
20260202

Claims (12)

  1. 1. A method for monitoring front-end performance, comprising: Responding to a starting event of a monitored business process, creating a timer corresponding to the business process and triggering the timer to start timing; monitoring each execution stage of the business flow through the timer, judging whether the execution stage needs to be dotted for each execution stage, and dotted the execution stage under the condition that the point needs to be dotted to obtain dotted information of the execution stage; And responding to the monitoring of the ending event of the business process, triggering the timer to finish timing, and reporting the starting timing time and the ending timing time of the timer and dotting information of each execution stage to a monitoring system.
  2. 2. The method of claim 1, wherein the timer has a corresponding timer identification, and determining whether the execution phase requires dotting comprises: Acquiring an execution method corresponding to the execution stage and a parameter entering corresponding to the execution method; Judging whether the parameter includes the timer mark or not; and under the condition that the timer mark is contained in the entry, determining that the execution stage needs to be clicked.
  3. 3. The method of claim 1, wherein the dotting information includes a first time interval and a second time interval, wherein the executing stage is dotted to obtain the dotting information of the executing stage, and further comprising: And respectively dotting the starting node and the ending node of the execution stage by calling a dotting method, calculating the first time interval according to the dotting time of the starting node and the dotting time of the last dotting, and calculating the second time interval according to the dotting time of the starting node and the dotting time of the ending node.
  4. 4. The method of claim 3, wherein the dotting information further comprises a dotting type and a stage identifier, the dotting information of the execution stage is obtained by dotting the execution stage, the dotting type corresponding to the execution stage is obtained according to the mapping relation between the execution stage and the dotting type, and the dotting information is obtained according to the dotting type and the stage identifier of the execution stage.
  5. 5. A method according to claim 3, wherein reporting the start and end times of the timer and the dotting information for each execution phase to a monitoring system comprises: Obtaining the total duration of the timer according to the starting timing time and the ending timing time of the timer; For each dotting type, obtaining dotting information of each execution stage corresponding to the dotting type, wherein the dotting information of each execution stage comprises execution time length of the execution stage; obtaining the execution time length corresponding to the dotting type according to the execution time length of each execution stage; And creating the report data according to the total time length of the timer and the execution time length corresponding to each dotting type, and reporting the report data to the monitoring system.
  6. 6. The method according to claim 1, wherein the method further comprises: acquiring each sub-process corresponding to the service process; for each sub-process, a sub-timer corresponding to the sub-process is established and triggered to start timing in response to the monitored starting event of the sub-process, each sub-execution stage of the sub-process is monitored through the sub-timer, whether the sub-execution stage needs to be clicked or not is judged for each sub-execution stage, the sub-execution stage is clicked in case that the sub-execution stage needs to be clicked, the clicking information of the sub-execution stage is obtained, the sub-timer is triggered to finish timing in response to the monitored ending event of the sub-process, and the starting timing time and the ending timing time of the sub-timer and the clicking information of each execution stage are sent to the timer to enable the timer to be reported to a monitoring system.
  7. 7. The method of claim 5, wherein creating the report data based on the total duration of the timer and the execution duration corresponding to each dotting type comprises: Calling a configured reporting function, wherein the reporting function indicates a user-defined parameter and a reporting format; Acquiring a parameter value corresponding to the custom parameter; and converting according to the total time length of the timer, the execution time length corresponding to each dotting type and the parameter value and the reporting format to obtain the reporting data.
  8. 8. The method according to claim 1, wherein the method further comprises: packaging a dotting method to a decorator, and mounting the decorator on a target execution method of the business process in an annotation form; When the target execution method is finished executing, the decorator is used for calling the dotting method, ending the timing, and calculating the execution duration of the target execution method according to the time of starting the timing and the time of ending the timing; And reporting the execution time of the target execution method to the monitoring system.
  9. 9. A front-end performance monitoring apparatus, comprising: The creation module is used for responding to the starting event of the monitored business process, creating a timer corresponding to the business process and triggering the timer to start timing; The dotting module monitors each execution stage of the business process through the timer, judges whether the execution stage needs dotting or not for each execution stage, and dotts the execution stage under the condition that dotting is needed to obtain dotting information of the execution stage; and the reporting module is used for triggering the timer to finish timing in response to the monitoring of the ending event of the business process and reporting the starting timing time and the ending timing time of the timer and dotting information of each execution stage to a monitoring system.
  10. 10. An electronic device, comprising: One or more processors; Storage means for storing one or more programs, When executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-8.
  11. 11. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-8.
  12. 12. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any of claims 1-8.

Description

Front-end performance monitoring method and device Technical Field The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for monitoring front end performance. Background In the field of front-end development, front-end performance monitoring is a key technology for improving user experience by front-end applications. In the related art, the performance monitoring technology mainly includes a browser global object interface, a manual timestamp record, a single timer tool for timing, and the like, and as the front-end application complexity is continuously improved, the service flow is increasingly complex, and the performance monitoring tool cannot meet the requirement of fine monitoring, for example, cannot monitor the time consumption of each stage in the service execution process in a fine-grained manner, so that the accuracy positioning bottleneck cannot be realized, and the user experience is not facilitated. Disclosure of Invention In view of this, the embodiment of the invention provides a front-end performance monitoring method and device, which can realize fine-granularity performance monitoring on a business process and accurately position a performance bottleneck, thereby improving user experience. To achieve the above object, according to an aspect of the embodiments of the present invention, there is provided a front-end performance monitoring method, including: Responding to a starting event of a monitored business process, creating a timer corresponding to the business process and triggering the timer to start timing; monitoring each execution stage of the business flow through the timer, judging whether the execution stage needs to be dotted for each execution stage, and dotted the execution stage under the condition that the point needs to be dotted to obtain dotted information of the execution stage; And responding to the monitoring of the ending event of the business process, triggering the timer to finish timing, and reporting the starting timing time and the ending timing time of the timer and dotting information of each execution stage to a monitoring system. Optionally, the timer has a corresponding timer identifier, and determining whether the execution stage needs to be dotted includes: Acquiring an execution method corresponding to the execution stage and a parameter entering corresponding to the execution method; Judging whether the parameter includes the timer mark or not; and under the condition that the timer mark is contained in the entry, determining that the execution stage needs to be clicked. Optionally, the dotting information includes a first time interval and a second time interval, and the dotting is performed on the execution stage to obtain the dotting information of the execution stage, and the method further includes: And respectively dotting the starting node and the ending node of the execution stage by calling a dotting method, calculating the first time interval according to the dotting time of the starting node and the dotting time of the last dotting, and calculating the second time interval according to the dotting time of the starting node and the dotting time of the ending node. Optionally, the dotting information further comprises a dotting type and a stage identifier, the dotting is carried out on the execution stage to obtain the dotting information of the execution stage, the dotting information further comprises the steps of obtaining the corresponding dotting type of the execution stage according to the mapping relation between the execution stage and the dotting type, and obtaining the dotting information according to the dotting type and the stage identifier of the execution stage. Optionally, reporting the starting timing time and the ending timing time of the timer and the dotting information of each execution stage to a monitoring system, including: Obtaining the total duration of the timer according to the starting timing time and the ending timing time of the timer; For each dotting type, obtaining dotting information of each execution stage corresponding to the dotting type, wherein the dotting information of each execution stage comprises execution time length of the execution stage; obtaining the execution time length corresponding to the dotting type according to the execution time length of each execution stage; And creating the report data according to the total time length of the timer and the execution time length corresponding to each dotting type, and reporting the report data to the monitoring system. Optionally, the method further comprises: acquiring each sub-process corresponding to the service process; for each sub-process, a sub-timer corresponding to the sub-process is established and triggered to start timing in response to the monitored starting event of the sub-process, each sub-execution stage of the sub-process is monitored through the sub-timer, whether the su