Nothing Special   »   [go: up one dir, main page]

CN110888731B - Method, device, equipment and storage medium for acquiring route data - Google Patents

Method, device, equipment and storage medium for acquiring route data Download PDF

Info

Publication number
CN110888731B
CN110888731B CN201911250796.5A CN201911250796A CN110888731B CN 110888731 B CN110888731 B CN 110888731B CN 201911250796 A CN201911250796 A CN 201911250796A CN 110888731 B CN110888731 B CN 110888731B
Authority
CN
China
Prior art keywords
route
routing
component
function
switching
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.)
Active
Application number
CN201911250796.5A
Other languages
Chinese (zh)
Other versions
CN110888731A (en
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.)
Beijing Bo Hongyuan Data Polytron Technologies Inc
Original Assignee
Beijing Bo Hongyuan Data Polytron Technologies Inc
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 Beijing Bo Hongyuan Data Polytron Technologies Inc filed Critical Beijing Bo Hongyuan Data Polytron Technologies Inc
Priority to CN201911250796.5A priority Critical patent/CN110888731B/en
Publication of CN110888731A publication Critical patent/CN110888731A/en
Application granted granted Critical
Publication of CN110888731B publication Critical patent/CN110888731B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Tests Of Electronic Circuits (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the invention discloses a method, a device, equipment and a storage medium for acquiring route data. The method is applied to a single page application program and comprises the following steps: if the route change is detected, the global route hook function of the route object is recalled, and the route parameter, the route switching starting time and the route switching error information are obtained; callback is respectively carried out on the component routing hook functions of each to-be-mounted routing component matched with the routing parameters, and the switching ending time is obtained; reporting the obtained route data; the routing data includes: routing parameters, routing switch start time, routing switch end time, and routing switch error information. The technical scheme of the embodiment of the invention realizes that the route performance data in the route switching process is acquired through the probe in the single-page application program.

Description

Method, device, equipment and storage medium for acquiring route data
Technical Field
The embodiment of the invention relates to the technical field of data acquisition, in particular to a method, a device, equipment and a storage medium for acquiring route data.
Background
The page access experience is a matter of great concern to users. Currently, the front-end performance monitoring software of the main stream obtains the performance data of the loading page through calling Navigation Timing API. Navigation Timing API is a JavaScript API that can accurately measure the loading performance of a web page, providing a simple way to obtain an accurate and detailed time state of the page navigation, loading event.
In the prior art, navigation Timing API can only record performance data in the page loading process, but for currently popular single-page application programs (Single Page web Application, SPA), one application program only has one page, the user performs view switching through front-end routing, and the user cannot trigger page reloading, and at the moment, the performance data recorded by Navigation Timing API cannot be updated. Therefore, the existing performance data acquisition mode cannot capture the routing performance data in the routing switching process, and cannot meet the user requirements.
Disclosure of Invention
The embodiment of the invention provides a method, a device, equipment and a storage medium for acquiring route data, which are used for acquiring route performance data in a route switching process through a probe in a single-page application program.
In a first aspect, an embodiment of the present invention provides a routing data collection method, which is applied to a single page application program, including:
if the route change is detected, the global route hook function of the route object is recalled, and the route parameter, the route switching starting time and the route switching error information are obtained;
callback is respectively carried out on the component routing hook functions of each to-be-mounted routing component matched with the routing parameters, and the switching ending time is obtained;
reporting the obtained route data; the routing data includes: routing parameters, routing switch start time, routing switch end time, and routing switch error information.
Optionally, before callback is performed on the global routing hook function of the routing object, the method further comprises:
predefining a component routing hook function and a global routing hook function; the component routing hook function includes: a before-c-re function, a before-routeenter function, and a before-routeupdate function; the global routing hook function includes: a before Each function, an after Each function, and an onError function;
registering the component routing hook function with probes on all vue components of the single page application;
before each vue component is created, callback is made to the before-date function of each vue component through the probe, the route object corresponding to the vue component is obtained, and the global route hook function is registered on the route object.
Optionally, after callback is performed on the before-c-reate function of each vue component by using the probe, obtaining the routing object corresponding to the vue component, the method further includes:
acquiring route object definition information corresponding to the route object through a probe; the route object definition information includes: the routing component to be mounted matches the specified route of the vue component.
Optionally, callback is performed on the global routing hook function of the routing object, and a routing parameter, a routing switching start time and routing switching error information are obtained, including:
callback is carried out on the before Each function of the route object, and route parameters are obtained; the routing parameters include a current route to be left and a new route to be entered;
switching the route from the current route to be left to the new route to be entered, and recording the route switching start time through the probe;
and callback is carried out on the onError function of the route object, and route switching error information is obtained.
Optionally, after recording the route switching start time by the probe, the method further includes:
callback is carried out on an afterEach function of the routing object, and the number of the routing components to be mounted is obtained;
if the number of the routing components to be mounted is larger than 0, initializing the value of the component counter according to the number of the routing components to be mounted.
Optionally, callback is performed on the component routing hook function of each to-be-mounted routing component matched with the routing parameter, and the route switching end time is obtained, including:
if the route switching error information is not obtained, callback is carried out on a before router function or a before router update function of the current to-be-mounted route component so as to mount the current to-be-mounted route component;
if the current routing component to be mounted is mounted, subtracting 1 from the value of the component counter, and updating the current routing component to be mounted;
and returning to execute callback operation on the before router function or before router update function of the currently-to-be-mounted routing component until the value of the component counter is 0, and taking the time when the value of the component counter is changed to 0 as the route switching ending time.
Optionally, reporting the obtained routing data includes:
if the number of the route components to be mounted is 0, reporting the acquired route data;
or,
if the route switching is wrong, the acquired route data is reported;
or,
and if the route components to be mounted are completely mounted, reporting the acquired route data.
In a second aspect, an embodiment of the present invention further provides a routing data collection device, which is applied to a single-page application program, including:
the first data acquisition module is used for callback the global route hook function of the route object if the route change is detected, and acquiring the route parameter, the route switching starting time and the route switching error information;
the second data acquisition module is used for respectively calling back the component route hook functions of each to-be-mounted route component matched with the route parameters and acquiring the route switching ending time;
the route data reporting module is used for reporting the acquired route data; the routing data includes: routing parameters, routing switch start time, routing switch end time, and routing switch error information.
In a third aspect, an embodiment of the present invention further provides an apparatus, including:
one or more processors;
storage means for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the route data collection method as provided by any embodiment of the present invention.
In a fourth aspect, an embodiment of the present invention further provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor, implements a routing data collection method as provided in any embodiment of the present invention.
According to the technical scheme, if the route change is detected, the global route hook function of the route object is recalled, and the route parameter, the route switching starting time and the route switching error information are obtained; callback is respectively carried out on the component route hook functions of each to-be-mounted route component matched with the route parameters, and the route switching ending time is obtained; the acquired route parameters, route switching starting time, route switching ending time and route switching error information are reported, the problem that route performance data in the route switching process cannot be captured in the prior art is solved, and the purposes that in a single-page application program, route switching is detected through a probe calling route hook function and route performance data in the route switching process are acquired are achieved.
Drawings
FIG. 1 is a flow chart of a method of route data acquisition in accordance with a first embodiment of the present invention;
fig. 2a is a flowchart of a routing data collection method in a second embodiment of the present invention;
FIG. 2b is a registration flow chart of a routing hook function in a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a routing data acquisition device according to a third embodiment of the present invention;
fig. 4 is a schematic structural view of an apparatus according to a fourth embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present invention are shown in the drawings.
Example 1
Fig. 1 is a flowchart of a routing data acquisition method in accordance with a first embodiment of the present invention, where the method may be applied to obtain routing performance data in a single page application, and the method may be performed by a routing data acquisition device, which may be implemented by hardware and/or software, and may be generally integrated in a device that provides a routing performance data acquisition service, for example, a terminal device, as shown in fig. 1, and includes:
step 110, if the route change is detected, the global route hook function of the route object is recalled, and the route parameter, the route switching starting time and the route switching error information are obtained.
In this embodiment, the route navigation menu includes a plurality of routes, and when the user clicks on a specified route in the route navigation menu, a change of the route is detected, and at this time, the specified route is activated, so that a route switch from the current route to the specified route needs to be implemented. In order to acquire the route data generated in the route switching process, a probe is embedded in the single-page application program, and a route hook function is respectively registered for the vue object and the route object through the probe, so that the route data generated in the route switching process is acquired through callback of the route hook function. The probe is a browser probe, page performance data can be collected according to the browser state, the essence of the probe is a section of JavaScript code, and some data of page access can be obtained and sent in real time.
Optionally, before callback of the global routing hook function of the routing object, the method may further include: predefining a component routing hook function and a global routing hook function; the component routing hook function includes: a before-c-re function, a before-routeenter function, and a before-routeupdate function; the global routing hook function includes: a before Each function, an after Each function, and an onError function; registering the component routing hook function with probes on all vue components of the single page application; before each vue component is created, callback is made to the before-date function of each vue component through the probe, the route object corresponding to the vue component is obtained, and the global route hook function is registered on the route object.
In this embodiment, the probe registers, for each vue component in the single-page application program, a component routing hook function, for example, a before-code function, a before-code router function, and a before-code router update function, which are in one-to-one correspondence with the stages of component creation, mounting, activation, and destruction, respectively, through a micin mechanism provided by the vue framework, so that when the vue component is in the corresponding stage, the probe can acquire corresponding routing data through the callback corresponding to the component routing hook function. Before each vue component is created, the probe firstly calls the before-update function to detect whether a routing object exists or not, if the routing object is acquired, global routing hook functions such as the before-update function, the after-update function, the onError function and the like are registered on the routing object so as to monitor the routing component, and the corresponding routing component is assembled or unloaded when the routing object changes.
Optionally, after callback is performed on the before-c-reate function of each vue component by using the probe, obtaining the routing object corresponding to the vue component may further include: acquiring route object definition information corresponding to the route object through a probe; the route object definition information includes: the routing component to be mounted matches the specified route of the vue component.
In this embodiment, after the route object corresponding to the vue component is acquired, the to-be-mounted route component matching the designated route of the vue component may also be acquired through the probe, so that when the user activates the designated route, it may be determined which route components to be mounted need to be switched to route, and which vue component needs to be re-rendered.
Optionally, callback is performed on the global routing hook function of the routing object, and a routing parameter, a routing switching start time and routing switching error information are obtained, which may include: callback is carried out on the before Each function of the route object, and route parameters are obtained; the routing parameters include the current route to be left and the new route to be entered; switching the route from the current route to be left to the new route to be entered, and recording the route switching start time through the probe; and callback is carried out on the onError function of the route object, and route switching error information is obtained.
In this embodiment, the routing parameters include a current route to be left and a new route to be entered; the method comprises the steps of calling back a before Each function of a route object, obtaining a new route to be entered according to a to parameter in the before Each function, obtaining a current route to be exited according to a from parameter, switching from the current route to be exited to the new route to be entered, recording a route switching start time by a probe at the moment, and reporting the route switching start time after the whole route switching is completed. In order to timely know whether a switching error occurs in the routing switching process, the onError function of the routing object can be recalled after switching is started, so that routing switching error information can be timely obtained when the routing switching error occurs, and immediately the routing switching error information is reported, so that the number of routing switching errors, the routing switching error frequency and the routing switching error rate in the preset number of routing switching are calculated through the reported routing switching error information.
Optionally, after recording the route switching start time by the probe, it may further include: callback is carried out on an afterEach function of the routing object, and the number of the routing components to be mounted is obtained; if the number of the routing components to be mounted is larger than 0, initializing the value of the component counter according to the number of the routing components to be mounted.
In this embodiment, when the route switching needs to mount a plurality of route components, the number of route components that have been mounted is counted by the component counter, so as to ensure that all route components to be mounted are mounted, and avoid that some route components to be mounted are missed, resulting in the error record of the end time of the route switching.
And 120, respectively calling back the component route hook functions of each to-be-mounted route component matched with the route parameters, and obtaining the switching end time.
In this embodiment, after the designated route is determined by obtaining the route parameters, the routing component to be mounted that matches the designated route may be determined according to the route object definition information, then each routing component to be mounted is mounted in turn, and when each routing component to be mounted is mounted, the before routing end function or before routing update function corresponding to the routing component is called, so that the relevant routing time corresponding to the routing component to be mounted, for example, the time for entering the routing component, the time for mounting, and the like, can be obtained.
Optionally, the callback is performed on the component routing hook function of each to-be-mounted routing component matched with the routing parameter, and the route switching end time is obtained, which may include: if the route switching error information is not obtained, callback is carried out on a before router function or a before router update function of the current to-be-mounted route component so as to mount the current to-be-mounted route component; if the current routing component to be mounted is mounted, subtracting 1 from the value of the component counter, and updating the current routing component to be mounted; and returning to execute callback operation on the before router function or before router update function of the currently-to-be-mounted routing component until the value of the component counter is 0, and taking the time when the value of the component counter is changed to 0 as the route switching ending time.
In this embodiment, before the installation of the routing component to be installed is started, it is required to determine whether a routing component to be installed is currently in error, if not, callback is performed on the before router end function or the before router update function of the routing component to be installed according to the situation, the installation of the routing component to be installed is implemented, if the installation of the routing component to be installed is completed, the value of the component counter is reduced by 1, it is determined whether the value of the component counter is 0 at this time, if not, it is required to select a routing component to be installed as the routing component to be installed currently, then, the step of callback is performed on the before router end function or the before router update function of the routing component to be installed is returned, the above-mentioned process is repeated until the value of the component counter is 0, and the time when the value of the component counter becomes 0 is recorded by the probe as the routing switch end time.
When a new route is entered, for example, when a homepage enters a login interface, a before router function of a currently-to-be-installed route component is called back, and when a route is updated, for example, when a child route under a parent route jumps, a before router update function of the currently-to-be-installed route component is called back.
And 130, reporting the acquired routing data.
Wherein the routing data comprises: routing parameters, routing switch start time, routing switch end time, and routing switch error information.
Optionally, reporting the obtained routing data may include: if the number of the route components to be mounted is 0, reporting the acquired route data; or if the route switching is wrong, reporting the acquired route data; or if the route components to be mounted are all mounted, reporting the acquired route data.
In this embodiment, after the number of routing components to be mounted is obtained, whether the number of routing components to be mounted is 0 is first determined, and if so, the obtained routing data is reported; when the number of the routing components to be mounted is greater than 0, if errors occur in the routing switching process, the acquired routing data are reported, otherwise, when all the routing components to be mounted are mounted, the acquired routing data are reported.
According to the technical scheme, if the route change is detected, the global route hook function of the route object is recalled, and the route parameter, the route switching starting time and the route switching error information are obtained; callback is respectively carried out on the component route hook functions of each to-be-mounted route component matched with the route parameters, and the route switching ending time is obtained; the acquired route parameters, route switching starting time, route switching ending time and route switching error information are reported, the problem that route performance data in the route switching process cannot be captured in the prior art is solved, and the purposes that in a single-page application program, route switching is detected through a probe calling route hook function and route performance data in the route switching process are acquired are achieved.
Example two
Fig. 2a is a flowchart of a routing data collection method according to a second embodiment of the present invention, which can be combined with the various alternatives of the above-described embodiment. Specifically, referring to fig. 2a, the method may comprise the steps of:
step 210, when the single page application has not been started, the hook function is routed through the probe to register components for all vue components.
As shown in fig. 2b, when the single-page application is not yet started, the probe registers component routing hook functions, such as a before-code function, a before-code router function, and a before-code router update function, for each vue component in the single-page application through the micin mechanism provided by the vue framework, where the component routing hook functions are in one-to-one correspondence with the stages of component creation, mounting, activation, destruction, and the like.
Step 220, when the single page application is started, registering the global routing hook function on the routing object through the probe.
In this embodiment, as shown in fig. 2b, when the single page application is started, before each vue component is created, a probe is used to call back the before-break function of each vue component, whether a route object exists or not is detected, if so, the route object corresponding to the vue component and definition information of the route object are obtained, and the before-break function, the after-break function and the onError function are registered on the route object.
Step 230, if the route change is detected, callback is performed on the before Each function of the route object, and the route parameter is obtained.
In this embodiment, when a user clicks a designated route in a route navigation menu, the designated route is activated, and a before-entering new route is obtained according to the to parameter in the before-entering new route and the before-leaving current route is obtained according to the from parameter.
Step 240, switching the route from the current route to be left to the new route to be entered, and recording the route start switching time by the probe.
And 250, callback is conducted on the afterEach function of the routing object, and the number of the routing components to be mounted is obtained.
In this embodiment, a probe is used to callback an afterEach function of a routing object, and the number of routing components to be mounted is calculated according to the to parameter and the from parameter of the afterEach function.
Step 260, judging whether the number of the routing components to be mounted is 0, if yes, executing step 2110, otherwise, initializing the value of the component counter to the number of the routing components to be mounted, and executing step 270.
Step 270, judging whether an error occurs in the route switching process, if yes, executing step 2110, otherwise executing step 280.
Step 280, callback is performed on the before routeenter function or before routeupdate function of the current routing component to be mounted, and the value of the component counter is reduced by 1 after the mounting of the current routing component to be mounted is completed.
When a new route is entered, for example, when a homepage enters a login interface, a before router enter function of a currently-to-be-installed route component is called back; when a route is updated, for example, when a child route under a parent route jumps, a call back is performed on the before routeupdate function of the currently-to-be-installed route component.
Step 290, judging whether the current value of the component counter is 0, if so, executing step 2110, otherwise, updating the current routing component to be mounted, and returning to execute step 280.
And 2110, recording the route switching end time through the probe, and reporting the route switching end time and the acquired route data.
In this embodiment, when the number of routing components to be mounted is 0, recording the time when the number of routing components to be mounted is obtained as the end time of routing switching, and then reporting the obtained routing data; when the number of the route components to be mounted is greater than 0, if an error occurs in the route switching process, recording the time for acquiring the route switching error information as route switching end time, and reporting the acquired route data, otherwise, when the whole mounting of the route components to be mounted is completed, recording the time for the current value of the component counter to be 0 as route switching end time, and reporting the acquired route data.
Step 2120 ends.
Example III
Fig. 3 is a schematic structural diagram of a routing data acquisition device in a third embodiment of the present invention. The embodiment can be applied to the case of acquiring the routing performance data in the single-page application program. As shown in fig. 3, the routing data acquisition apparatus includes:
a first data obtaining module 310, configured to, if a route change is detected, callback a global route hook function of a route object, and obtain a route parameter, a route switching start time, and route switching error information;
a second data obtaining module 320, configured to callback component routing hook functions of each to-be-mounted routing component that matches the routing parameter, and obtain a routing switch end time;
a route data reporting module 330, configured to report the obtained route data; the routing data includes: routing parameters, routing switch start time, routing switch end time, and routing switch error information.
According to the technical scheme, if the route change is detected, the global route hook function of the route object is recalled, and the route parameter, the route switching starting time and the route switching error information are obtained; callback is respectively carried out on the component route hook functions of each to-be-mounted route component matched with the route parameters, and the route switching ending time is obtained; the acquired route parameters, route switching starting time, route switching ending time and route switching error information are reported, the problem that route performance data in the route switching process cannot be captured in the prior art is solved, and the purposes that in a single-page application program, route switching is detected through a probe calling route hook function and route performance data in the route switching process are acquired are achieved.
Optionally, the method further comprises: the route hook function definition module is used for predefining a component route hook function and a global route hook function before callback is carried out on the global route hook function of the route object; the component routing hook function includes: a before-c-re function, a before-routeenter function, and a before-routeupdate function; the global routing hook function includes: a before Each function, an after Each function, and an onError function; registering the component routing hook function with probes on all vue components of the single page application; before each vue component is created, callback is made to the before-date function of each vue component through the probe, the route object corresponding to the vue component is obtained, and the global route hook function is registered on the route object.
Optionally, the route hook function definition module is further configured to, after performing callback on the before-compare function of each vue component by using the probe, obtain a route object corresponding to the vue component, and obtain route object definition information corresponding to the route object by using the probe; the route object definition information includes: the routing component to be mounted matches the specified route of the vue component.
Optionally, the first data acquisition module 310 is specifically configured to: callback is carried out on the before Each function of the route object, and route parameters are obtained; the routing parameters include a current route to be left and a new route to be entered; switching the route from the current route to be left to the new route to be entered, and recording the route switching start time through the probe; and callback is carried out on the onError function of the route object, and route switching error information is obtained.
Optionally, the first data acquisition module 310 is further configured to: after the route switching starting time is recorded through the probe, callback is carried out on an afterEach function of the route object, and the number of route components to be mounted is obtained; if the number of the routing components to be mounted is larger than 0, initializing the value of the component counter according to the number of the routing components to be mounted.
Optionally, the second data acquisition module 320 is specifically configured to: if the route switching error information is not obtained, callback is carried out on a before router function or a before router update function of the current to-be-mounted route component so as to mount the current to-be-mounted route component; if the current routing component to be mounted is mounted, subtracting 1 from the value of the component counter, and updating the current routing component to be mounted; and returning to execute callback operation on the before router function or before router update function of the currently-to-be-mounted routing component until the value of the component counter is 0, and taking the time when the value of the component counter is changed to 0 as the route switching ending time.
Optionally, the route data reporting module 330 is specifically configured to: if the number of the route components to be mounted is 0, reporting the acquired route data; or if the route switching is wrong, reporting the acquired route data; or if the route components to be mounted are all mounted, reporting the acquired route data.
The route data acquisition device provided by the embodiment of the invention can execute the route data acquisition method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Example IV
Fig. 4 is a schematic structural diagram of an apparatus according to a fourth embodiment of the present invention. Fig. 4 shows a block diagram of an exemplary device 12 suitable for use in implementing embodiments of the present invention. The device 12 shown in fig. 4 is merely an example and should not be construed as limiting the functionality and scope of use of embodiments of the present invention.
As shown in fig. 4, the device 12 is in the form of a general purpose computing device, which may be a PC terminal or a mobile terminal. Components of device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, a bus 18 that connects the various system components, including the system memory 28 and the processing units 16.
Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, and a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include Industry Standard Architecture (ISA) bus, micro channel architecture (MAC) bus, enhanced ISA bus, video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Device 12 typically includes a variety of computer system readable media. Such media can be any available media that is accessible by device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM) 30 and/or cache memory 32. Device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from or write to non-removable, nonvolatile magnetic media (not shown in FIG. 4, commonly referred to as a "hard disk drive"). Although not shown in fig. 4, a magnetic disk drive for reading from and writing to a removable non-volatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive for reading from or writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In such cases, each drive may be coupled to bus 18 through one or more data medium interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored in, for example, memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment. Program modules 42 generally perform the functions and/or methods of the embodiments described herein.
Device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), one or more devices that enable a user to interact with device 12, and/or any devices (e.g., network card, modem, etc.) that enable device 12 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 22. Also, device 12 may communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet, via network adapter 20. As shown, network adapter 20 communicates with other modules of device 12 over bus 18. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with device 12, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, for example, implementing the routing data acquisition method provided by the embodiment of the present invention.
Namely: a method for collecting route data is applied to a single page application program and comprises the following steps:
if the route change is detected, the global route hook function of the route object is recalled, and the route parameter, the route switching starting time and the route switching error information are obtained;
callback is respectively carried out on the component routing hook functions of each to-be-mounted routing component matched with the routing parameters, and the switching ending time is obtained;
reporting the obtained route data; the routing data includes: routing parameters, routing switch start time, routing switch end time, and routing switch error information.
Example five
The fifth embodiment of the present invention further provides a computer readable storage medium having a computer program stored thereon, which when executed by a computer processor is configured to perform any of the routing data collection methods provided in the foregoing embodiments, where a routing data collection method is applied to a single page application program, and includes:
if the route change is detected, the global route hook function of the route object is recalled, and the route parameter, the route switching starting time and the route switching error information are obtained;
callback is respectively carried out on the component routing hook functions of each to-be-mounted routing component matched with the routing parameters, and the switching ending time is obtained;
reporting the obtained route data; the routing data includes: routing parameters, routing switch start time, routing switch end time, and routing switch error information.
The computer storage media of embodiments of the invention may take the form of any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.

Claims (9)

1. A method for collecting routing data, which is applied to a single-page application program, comprising:
if the route change is detected, the global route hook function of the route object is recalled, and the route parameter, the route switching starting time and the route switching error information are obtained;
callback is respectively carried out on the component route hook functions of each to-be-mounted route component matched with the route parameters, and the route switching ending time is obtained;
reporting the obtained route data; the routing data includes: routing parameters, routing switching start time, routing switching end time and routing switching error information; calculating the number of route switching errors, the route switching error frequency and the size of the route switching error rate in the preset number of route switching through the reported route switching error information;
before callback is performed on the global routing hook function of the routing object, the method further comprises the following steps:
predefining a component routing hook function and a global routing hook function; the component routing hook function includes: a before-c-re function, a before-routeenter function, and a before-routeupdate function; the global routing hook function includes: a before Each function, an after Each function, and an onError function;
registering the component routing hook function with probes on all vue components of the single page application;
before each vue component is created, callback is conducted on the before-date function of each vue component through a probe, a route object corresponding to the vue component is obtained, and a global route hook function is registered on the route object.
2. The method of claim 1, further comprising, after retrieving the routing object corresponding to the vue component by callback to the before-c reate function of each of the vue components by probe:
acquiring route object definition information corresponding to the route object through a probe; the route object definition information includes: and the routing component to be mounted is matched with the designated route of the vue component.
3. The method of claim 1, wherein recalling the global routing hook function of the routing object and obtaining the routing parameters, the routing switch start time, and the routing switch error information comprises:
callback is carried out on the before Each function of the route object, and route parameters are obtained; the routing parameters include a current route to be left and a new route to be entered;
switching the route from the current route to be left to the new route to be entered, and recording the route switching start time through the probe;
and callback is carried out on the onError function of the route object, and route switching error information is obtained.
4. A method according to claim 3, further comprising, after recording the route switch start time by the probe:
callback is carried out on an afterEach function of the routing object, and the number of the routing components to be mounted is obtained;
if the number of the routing components to be mounted is larger than 0, initializing the value of the component counter according to the number of the routing components to be mounted.
5. The method of claim 4, wherein the callback is performed on the component routing hook function of each to-be-mounted routing component matched with the routing parameter, and the route switching end time is obtained, which comprises:
if the route switching error information is not obtained, callback is carried out on a before router function or a before router update function of the current to-be-mounted route component so as to mount the current to-be-mounted route component;
if the current routing component to be mounted is mounted, subtracting 1 from the value of the component counter, and updating the current routing component to be mounted;
and returning to execute callback operation on the before router function or before router update function of the currently-to-be-mounted routing component until the value of the component counter is 0, and taking the time when the value of the component counter is changed to 0 as the route switching ending time.
6. The method of claim 5, wherein reporting the acquired routing data comprises:
if the number of the route components to be mounted is 0, reporting the acquired route data;
or,
if the route switching is wrong, the acquired route data is reported;
or,
and if the route components to be mounted are completely mounted, reporting the acquired route data.
7. A routing data acquisition device, characterized by being applied to a single page application program, comprising:
the first data acquisition module is used for callback the global route hook function of the route object if the route change is detected, and acquiring the route parameter, the route switching starting time and the route switching error information;
the second data acquisition module is used for respectively calling back the component route hook functions of each to-be-mounted route component matched with the route parameters and acquiring the route switching ending time;
the route data reporting module is used for reporting the acquired route data; the routing data includes: routing parameters, routing switching start time, routing switching end time and routing switching error information; calculating the number of route switching errors, the route switching error frequency and the size of the route switching error rate in the preset number of route switching through the reported route switching error information;
the route hook function definition module is used for predefining a component route hook function and a global route hook function before callback is carried out on the global route hook function of the route object;
the component routing hook function includes: a before-c-re function, a before-routeenter function, and a before-routeupdate function; the global routing hook function includes: a before Each function, an after Each function, and an onError function;
registering the component routing hook function with probes on all vue components of the single page application;
before each vue component is created, callback is made to the before-date function of each vue component through the probe, the route object corresponding to the vue component is obtained, and the global route hook function is registered on the route object.
8. An apparatus, the apparatus comprising:
one or more processors;
storage means for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the routing data collection method of any of claims 1-6.
9. A computer readable storage medium having stored thereon a computer program, which when executed by a processor implements a routing data collection method according to any of claims 1-6.
CN201911250796.5A 2019-12-09 2019-12-09 Method, device, equipment and storage medium for acquiring route data Active CN110888731B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911250796.5A CN110888731B (en) 2019-12-09 2019-12-09 Method, device, equipment and storage medium for acquiring route data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911250796.5A CN110888731B (en) 2019-12-09 2019-12-09 Method, device, equipment and storage medium for acquiring route data

Publications (2)

Publication Number Publication Date
CN110888731A CN110888731A (en) 2020-03-17
CN110888731B true CN110888731B (en) 2023-07-07

Family

ID=69751082

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911250796.5A Active CN110888731B (en) 2019-12-09 2019-12-09 Method, device, equipment and storage medium for acquiring route data

Country Status (1)

Country Link
CN (1) CN110888731B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113472752B (en) * 2021-06-11 2023-12-01 北京达佳互联信息技术有限公司 Authority processing method and device, electronic equipment and storage medium
CN113392032B (en) * 2021-08-17 2021-11-19 北京安普诺信息技术有限公司 API (application program interface) discovery method, test coverage rate determining method and device
CN113392347B (en) * 2021-08-18 2021-11-09 北京安普诺信息技术有限公司 Instrumentation-based Web backend API (application program interface) acquisition method and device and storage medium
CN114637673A (en) * 2022-03-16 2022-06-17 京东科技信息技术有限公司 Micro front end performance monitoring method, device, equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US3401235A (en) * 1964-12-29 1968-09-10 Bell Telephone Labor Inc Time division communication system
WO1998047298A2 (en) * 1997-04-15 1998-10-22 Mci Worldcom, Inc. A system, method and article of manufacture for switched telephony communication
CN105917621A (en) * 2014-01-14 2016-08-31 华为技术有限公司 Methods and systems for data routing
CN108416038A (en) * 2018-03-14 2018-08-17 北京网信云服信息科技有限公司 A kind of data statistical approach and device of single page application
CN109669597A (en) * 2018-10-31 2019-04-23 武汉艺果互动科技股份有限公司 Front end authority control method, equipment and storage equipment when user browses web sites
CN110535774A (en) * 2019-07-24 2019-12-03 平安科技(深圳)有限公司 Dynamic routing processing method, device, computer equipment and storage medium

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR2828046B1 (en) * 2001-07-27 2003-10-10 Thales Sa TASK MANAGEMENT METHOD FOR A PACKET SWITCHING ROUTER AUTOMATION PART OF A SECURE PACKET SWITCHED TRANSMISSION NETWORK
CN107562425A (en) * 2017-08-07 2018-01-09 上海斐讯数据通信技术有限公司 Single-page application creation method and device based on Hybrid applications
US11611491B2 (en) * 2018-04-12 2023-03-21 Intel Corporation Edge computing service global validation
CN109542530A (en) * 2018-10-26 2019-03-29 深圳点猫科技有限公司 A kind of hierarchical loading method and device based on small routine framework
CN109933349A (en) * 2019-01-28 2019-06-25 优信拍(北京)信息科技有限公司 A kind of method to be timely updated based on vue spa, system and equipment
CN109976973B (en) * 2019-02-19 2021-05-25 深圳点猫科技有限公司 Online exception monitoring method for small program and electronic equipment
CN110472178A (en) * 2019-08-20 2019-11-19 北京博睿宏远数据科技股份有限公司 A kind of probe method for implanting, device, computer equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US3401235A (en) * 1964-12-29 1968-09-10 Bell Telephone Labor Inc Time division communication system
WO1998047298A2 (en) * 1997-04-15 1998-10-22 Mci Worldcom, Inc. A system, method and article of manufacture for switched telephony communication
CN105917621A (en) * 2014-01-14 2016-08-31 华为技术有限公司 Methods and systems for data routing
CN108416038A (en) * 2018-03-14 2018-08-17 北京网信云服信息科技有限公司 A kind of data statistical approach and device of single page application
CN109669597A (en) * 2018-10-31 2019-04-23 武汉艺果互动科技股份有限公司 Front end authority control method, equipment and storage equipment when user browses web sites
CN110535774A (en) * 2019-07-24 2019-12-03 平安科技(深圳)有限公司 Dynamic routing processing method, device, computer equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Return of the JS: Towards a Node.js-Based Software Architecture for Combined CMS/CRM Applications;Fabian Kaimer 等;Procedia Computer Science 141 (2018);第454-459页 *

Also Published As

Publication number Publication date
CN110888731A (en) 2020-03-17

Similar Documents

Publication Publication Date Title
CN110888731B (en) Method, device, equipment and storage medium for acquiring route data
CN110457277B (en) Service processing performance analysis method, device, equipment and storage medium
CN112436968B (en) Network traffic monitoring method, device, equipment and storage medium
CN109783345B (en) Method and system for testing small program performance
CN111813641B (en) Method, device, medium and equipment for collecting crash information
CN111813465B (en) Information acquisition method, device, medium and equipment
CN110515758B (en) Fault positioning method and device, computer equipment and storage medium
CN111367814A (en) Embedded point testing method and device, terminal equipment and storage medium
CN110990842A (en) Recurrence method and device of small probability event, storage medium and electronic equipment
CN110597704B (en) Pressure test method, device, server and medium for application program
EP4160421A1 (en) Method and apparatus for obtaining browser running data, and storage medium
CN110569182B (en) Crash rate calculation method and device, computer equipment and storage medium
CN109165372B (en) Webpage loading method, device, equipment and storage medium
CN108647284B (en) Method and device for recording user behavior, medium and computing equipment
CN111124627B (en) Method and device for determining call initiator of application program, terminal and storage medium
CN110443062B (en) Operation method and device of multi-tenant database and computer equipment
CN108399128A (en) A kind of generation method of user data, device, server and storage medium
CN112527643A (en) Front-end error detection method and device, electronic equipment and readable storage medium
CN113448795A (en) Method, apparatus and computer program product for obtaining system diagnostic information
CN115022201B (en) Data processing function test method, device, equipment and storage medium
CN111930385A (en) Data acquisition method, device, equipment and storage medium
CN107342917B (en) Method and apparatus for detecting network device performance
CN110769316A (en) Method, device, equipment and storage medium for calculating first frame time
CN111382017A (en) Fault query method, device, server and storage medium
CN111741046B (en) Data reporting method, data acquisition method, device, equipment and 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
GR01 Patent grant
GR01 Patent grant