CN110888731A - Route data acquisition method, device, equipment and storage medium - Google Patents

Route data acquisition method, device, equipment and storage medium Download PDF

Info

Publication number
CN110888731A
CN110888731A CN201911250796.5A CN201911250796A CN110888731A CN 110888731 A CN110888731 A CN 110888731A CN 201911250796 A CN201911250796 A CN 201911250796A CN 110888731 A CN110888731 A CN 110888731A
Authority
CN
China
Prior art keywords
routing
route
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.)
Granted
Application number
CN201911250796.5A
Other languages
Chinese (zh)
Other versions
CN110888731B (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 routing data. The method is applied to the single-page application program and comprises the following steps: if the routing change is detected, the global routing hook function of the routing object is called back, and routing parameters, routing switching start time and routing switching error information are obtained; respectively calling back the component routing hook functions of the routing components to be mounted, which are matched with the routing parameters, and acquiring switching end time; reporting the acquired routing data; the routing data includes: route parameters, route switching start time, route switching end time, and route switching error information. The technical scheme of the embodiment of the invention realizes that the routing performance data in the routing switching process is obtained through the probe in the single-page application program.

Description

Route data acquisition method, device, equipment and storage medium
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 routing data.
Background
The page access experience is a matter of great concern to the user. Currently, mainstream front-end performance monitoring software acquires performance data of a loaded page by calling a Navigation Timing API. The Navigation Timing API is a JavaScript API that can accurately measure the loading performance of a web page, and provides a simple method for obtaining the accurate and detailed time state of a page Navigation and loading event.
In the prior art, the Navigation Timing API can only record performance data in the Page loading process, but for a currently popular Single Page Application (SPA), one Application only has one Page, view switching by a user is realized through front-end routing, and the Page reloading is not triggered, and at the moment, the performance data recorded by the 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 routing data, which are used for acquiring routing performance data in a routing switching process through a probe in a single-page application program.
In a first aspect, an embodiment of the present invention provides a method for acquiring routing data, which is applied to a single-page application program, and includes:
if the routing change is detected, the global routing hook function of the routing object is called back, and routing parameters, routing switching start time and routing switching error information are obtained;
respectively calling back the component routing hook functions of the routing components to be mounted, which are matched with the routing parameters, and acquiring switching end time;
reporting the acquired routing data; the routing data includes: route parameters, route switching start time, route switching end time, and route switching error information.
Optionally, before performing callback on the global routing hook function of the routing object, the method further includes:
predefining a component routing hook function and a global routing hook function; the component routing hook function includes: a beforeCreate function, a beforrouteenenter function, and a beforrouteupdate function; the global routing hook function includes: a before Each function, an after Each function, and an oneerror function;
registering a component routing hook function with the probe on all vue components of the single-page application;
before each vue component is created, a call back is performed on the before update 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.
Optionally, after obtaining the route object corresponding to the vue component by calling back the before update function of each vue component through a probe, the method further includes:
acquiring routing object definition information corresponding to the routing object through the probe; the routing object definition information includes: a route component to mount that matches the specified route of the vue component.
Optionally, the recalling the global routing hook function of the routing object, and acquiring the routing parameter, the routing switching start time, and the routing switching error information includes:
calling back a before Each function of the routing object to acquire a routing parameter; the routing parameters include a current route to leave and a new route to enter;
switching the route from the current route to be departed to the new route to be entered, and recording the starting time of route switching through a probe;
and calling back an oneerror function of the routing object, and acquiring routing switching error information.
Optionally, after recording the start time of the route switching by the probe, the method further includes:
calling back an afterEach function of the routing object to acquire the number of the routing components to be mounted;
and if the number of the routing components to be mounted is greater than 0, initializing the value of the component counter according to the number of the routing components to be mounted.
Optionally, the calling back the component routing hook function of each to-be-mounted routing component matched with the routing parameter, and obtaining the route switching end time includes:
if the route switching error information is not acquired, calling back a beforeRouteEnter function or a beforeRouteUpdate function of the current route component to be mounted so as to mount the current route component to be mounted;
if the mounting of the current routing component to be mounted is finished, subtracting 1 from the value of the component counter, and updating the current routing component to be mounted;
and returning to execute the callback operation of the beforeRouteEnter function or the beforeRouteUpdate function of the current 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 becomes 0 as the routing switching ending time.
Optionally, reporting the acquired routing data includes:
if the number of the routing components to be mounted is 0, reporting the acquired routing data;
alternatively, the first and second electrodes may be,
if the routing switching is wrong, reporting the acquired routing data;
alternatively, the first and second electrodes may be,
and if all the routing components to be mounted are mounted, reporting the acquired routing data.
In a second aspect, an embodiment of the present invention further provides a routing data collecting device, which is applied to a single-page application program, and includes:
the first data acquisition module is used for calling back a global routing hook function of a routing object if routing change is detected, and acquiring routing parameters, routing switching start time and routing switching error information;
the second data acquisition module is used for respectively calling back the component routing hook functions of the routing components to be mounted, which are matched with the routing parameters, and acquiring the routing switching end time;
a routing data reporting module, configured to report the acquired routing data; the routing data includes: route parameters, route switching start time, route switching end time, and route switching error information.
In a third aspect, an embodiment of the present invention further provides an apparatus, where the apparatus includes:
one or more processors;
a storage device for storing one or more programs,
when executed by one or more processors, cause the one or more processors to implement a method for route data collection as provided by any of the embodiments of the 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, where the computer program, when executed by a processor, implements the routing data acquisition method provided in any embodiment of the present invention.
According to the technical scheme of the embodiment of the invention, if the route change is detected, the global route hook function of the route object is called back, and the route parameter, the route switching starting time and the route switching error information are obtained; respectively calling back the component routing hook functions of the routing components to be mounted, which are matched with the routing parameters, and acquiring the routing switching end time; the obtained routing parameters, the routing switching starting time, the routing switching finishing time and the routing switching error information are reported, the problem that routing performance data in the routing switching process cannot be captured in the prior art is solved, routing switching is detected by calling a routing hook function through a probe in a single-page application program, and the routing performance data in the routing switching process is obtained.
Drawings
Fig. 1 is a flowchart of a route data acquisition method according to a first embodiment of the present invention;
fig. 2a is a flowchart of a route data acquisition method in the second embodiment of the present invention;
FIG. 2b is a flowchart illustrating a registration procedure of a routing hook function according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a route data acquisition device in a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an apparatus in the fourth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of a routing data acquiring method in one embodiment of the present invention, where this embodiment is applicable to a case of acquiring routing performance data in a single-page application, and the method may be executed by a routing data acquiring apparatus, which may be implemented by hardware and/or software, and may be generally integrated in a device providing a routing performance data acquiring service, for example, a terminal device, as shown in fig. 1, and the method includes:
and step 110, if the route change is detected, calling back a global route hook function of the route object, and acquiring a route parameter, a route switching starting time and route switching error information.
In this embodiment, the route navigation menu includes a plurality of routes, and when a user clicks a specific route in the route navigation menu, a change in the route is detected, and at this time, the specific route is activated, and it is necessary to implement route switching from a current route to the specific route. In order to acquire the routing data generated in the routing switching process, a probe is embedded in the single-page application program, and a routing hook function is respectively registered for the vue object and the routing object through the probe, so that the routing data generated in the routing switching process is acquired by calling back the routing hook function. The probe is a browser probe, can acquire page performance data according to the browser state, is essentially a JavaScript code, and can acquire and send some data accessed by a page in real time.
Optionally, before performing callback on 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 beforeCreate function, a beforrouteenenter function, and a beforrouteupdate function; the global routing hook function includes: a before Each function, an after Each function, and an oneerror function; registering a component routing hook function with the probe on all vue components of the single-page application; before each vue component is created, a call back is performed on the before update 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.
In this embodiment, the probe registers, through a Mixin mechanism provided by the vue framework, a component routing hook function, such as a beforedate function, a beforeroute enter function, and a beforeroute update function, one-to-one corresponding to the creation, mounting, activation, and destruction stages of the component, respectively, for each vue component in the single-page application program, so that when the vue component is in the corresponding stage, the probe may call back the corresponding component routing hook function to obtain corresponding routing data. Before each vue component is created, a probe calls a before-update function to detect whether a route object exists, if the route object is obtained, global routing hook functions such as a before-Each function, an after-Each function and an oneerror function are registered on the route object to monitor the route components, and the route object assembles or unloads the corresponding route components when the route changes.
Optionally, after obtaining the route object corresponding to the vue component by calling back the before update function of each vue component through a probe, the method may further include: acquiring routing object definition information corresponding to the routing object through the probe; the routing object definition information includes: a route component to mount that matches the specified route of the vue component.
In this embodiment, after the route object corresponding to the vue component is obtained, the route component to be mounted that matches the specified route of the vue component may also be obtained through the probe, so that when the user activates the specified route, it may be determined which route components that need to be mounted for route switching need to be re-rendered, corresponding to which vue component.
Optionally, the recalling the global routing hook function of the routing object, and acquiring the routing parameter, the routing switching start time, and the routing switching error information may include: calling back a before Each function of the routing object to acquire a routing parameter; the routing parameters include a current route to leave and a new route to enter; switching the route from the current route to be departed to the new route to be entered, and recording the starting time of route switching through a probe; and calling back an oneerror function of the routing object, and acquiring routing switching error information.
In this embodiment, the routing parameters include a current route to leave and a new route to enter; the method comprises the steps of calling back a before Each function of a routing 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, and then switching from the current route to be exited to the new route to be entered, wherein at the moment, a probe records the starting time of route switching, and the starting time of route switching is reported after the whole route is switched. In order to know whether a switching error occurs in the process of route switching in time, the onError function of the route object can be called back after the switching is started, so that route switching error information can be acquired in time when the route switching error occurs, the route switching error information is reported immediately, and the number of times of route switching errors, the route switching error frequency and the route switching error rate in the preset number of times of route switching are calculated through the reported route switching error information.
Optionally, after recording the start time of the route switching by the probe, the method may further include: calling back an afterEach function of the routing object to acquire the number of the routing components to be mounted; and if the number of the routing components to be mounted is greater 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 routing switch needs to mount a plurality of routing components, the number of the routing components that have been mounted needs to be counted by a component counter, so as to ensure that the mounting of all routing components to be mounted is completed, and it is avoided that some routing components to be mounted are missed, which results in an error in the end time record of the routing switch.
And 120, respectively calling back the component routing hook functions of the routing components to be mounted, which are matched with the routing parameters, and acquiring the switching end time.
In this embodiment, after obtaining the routing parameter to determine the specified route, the routing component to be mounted that is matched with the specified route may be determined according to the routing object definition information, and then each routing component to be mounted is mounted in sequence, when each routing component to be mounted is mounted, the beforrouteunteter function or the beforrouteupdate 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 of entering the routing component, the time of mounting, the time of completing mounting, and the like, may be obtained.
Optionally, respectively calling back the component routing hook functions of the to-be-mounted routing components that are matched with the routing parameters, and obtaining the route switching end time may include: if the route switching error information is not acquired, calling back a beforeRouteEnter function or a beforeRouteUpdate function of the current route component to be mounted so as to mount the current route component to be mounted; if the mounting of the current routing component to be mounted is finished, subtracting 1 from the value of the component counter, and updating the current routing component to be mounted; and returning to execute the callback operation of the beforeRouteEnter function or the beforeRouteUpdate function of the current 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 becomes 0 as the routing switching ending time.
In this embodiment, before starting to mount the to-be-mounted routing component, it needs to first determine whether a routing switching error occurs at present, if not, the function of beforeRouteEnter or the function of beforeRouteUpdate of the current routing component to be mounted is called back according to the situation to realize the mounting of the current routing component to be mounted, if the mounting of the current routing component to be mounted is finished, subtracting 1 from the value of the component counter, judging whether the value of the component counter is 0 at the moment, if not, it means that there are still routing components to be mounted, a routing component to be mounted needs to be selected as the current routing component to be mounted, then returning to the step of executing callback on the beforerouteunteter function or the beforeRouteUpdate function of the current routing component to be mounted, repeating the above process until the value of the component counter is 0, the time at which the value of the component counter becomes 0 is recorded by the probe as the route switching end time.
When a new route is entered, for example, a homepage enters a login interface, a function of beforeRouteUpdate of a route component to be currently mounted is called back, and when the route is updated, for example, when a child route under a parent route jumps, a function of beforeRouteUpdate of a route component to be currently mounted is called back.
And step 130, reporting the acquired routing data.
Wherein routing data comprises: route parameters, route switching start time, route switching end time, and route switching error information.
Optionally, reporting the acquired routing data may include: if the number of the routing components to be mounted is 0, reporting the acquired routing data; or if the routing switching is wrong, reporting the acquired routing data; or if all the mounted routing components to be mounted are completed, reporting the acquired routing data.
In this embodiment, after the number of the routing components to be mounted is obtained, it is first determined whether the number of the routing components to be mounted is 0, and if so, the obtained routing data is reported; when the number of the routing components to be mounted is larger than 0, if an error occurs in the process of switching the routing, reporting the acquired routing data, otherwise, reporting the acquired routing data when all the routing components to be mounted are mounted.
According to the technical scheme of the embodiment of the invention, if the route change is detected, the global route hook function of the route object is called back, and the route parameter, the route switching starting time and the route switching error information are obtained; respectively calling back the component routing hook functions of the routing components to be mounted, which are matched with the routing parameters, and acquiring the routing switching end time; the obtained routing parameters, the routing switching starting time, the routing switching finishing time and the routing switching error information are reported, the problem that routing performance data in the routing switching process cannot be captured in the prior art is solved, routing switching is detected by calling a routing hook function through a probe in a single-page application program, and the routing performance data in the routing switching process is obtained.
Example two
Fig. 2a is a flowchart of a route data collection method in the second embodiment of the present invention, and this embodiment may be combined with various alternatives in the above embodiments. Specifically, referring to fig. 2a, the method may include the steps of:
at step 210, when the single-page application has not been launched, the hook function is routed through the probe to all vue component registration components.
As shown in fig. 2b, when the single-page application is not started, the probe registers, through a Mixin mechanism provided by the vue framework, component routing hook functions, such as a beforeReate function, a beforRouteEnter function, and a beforRouteUpdate function, for each vue component in the single-page application, which correspond to the creation, mounting, activation, destruction, and the like of the component one to one, respectively.
And step 220, when the single-page application program is started, registering a global routing hook function on the routing object through the probe.
In this embodiment, as shown in fig. 2b, when a single-page application is started, before each vue component is created, a callback is performed to the before-mentioned function of each vue component by a probe, whether a routing object exists is detected, if yes, a routing object corresponding to the vue component and definition information of the routing object are acquired, and the before-mentioned function, the after-mentioned function and the onError function are registered on the routing object.
And step 230, if the routing change is detected, calling back the before Each function of the routing object, and acquiring the routing parameters.
In this embodiment, when the user clicks the specified route in the route navigation menu, the specified route is activated, at this time, the beforeEach function of the route object is called back, a new route to be entered is obtained according to the to parameter in the beforeEach function, and a current route to be exited is obtained according to the from parameter.
Step 240, switching the route from the current route to be exited to the new route to be entered, and recording the switching start time of the route through the probe.
And step 250, calling back the afterEach function of the routing object to acquire the number of the routing components to be mounted.
In this embodiment, the af tereach function of the routing object is called back by the probe, and the number of routing components to be mounted is calculated according to the to parameter and the from parameter of the af tereach function.
Step 260, judging whether the number of the routing components to be mounted is 0, if so, 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, determining whether an error occurs in the route switching process, if yes, executing step 2110, otherwise, executing step 280.
Step 280, a function of beforeRouteEnter or a function of beforeRouteUpdate of the current routing component to be mounted is called back, 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 entering a new route, for example, when a homepage enters a login interface, a function of beforeRouteEnter of a route component to be mounted at present is called back; when a route is updated, for example, when a child route under a parent route jumps, a function of beforeRouteUpdate of a route component to be currently mounted is called back.
And 290, judging whether the current value of the component counter is 0, if so, executing a step 2110, otherwise, updating the current routing component to be mounted, and returning to execute the step 280.
And step 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 the routing components to be mounted is 0, recording the time when the number of the routing components to be mounted is obtained as the routing switching end time, and reporting the obtained routing data; when the number of the routing components to be mounted is larger than 0, if an error occurs in the process of routing switching, recording the time for acquiring the routing switching error information as the routing switching ending time, and then reporting the acquired routing data, otherwise, recording the time with the current value of 0 of a component counter as the routing switching ending time when all the routing components to be mounted are mounted, and then reporting the acquired routing data.
And step 2120, ending.
EXAMPLE III
Fig. 3 is a schematic structural diagram of a route data acquisition device in a third embodiment of the present invention. The embodiment is applicable to the case of acquiring the routing performance data in the single-page application. As shown in fig. 3, the route data collecting apparatus includes:
a first data obtaining module 310, configured to, if a route change is detected, call back a global routing hook function of a routing object, and obtain a routing parameter, a routing switching start time, and routing switching error information;
a second data obtaining module 320, configured to respectively call back component routing hook functions of each to-be-mounted routing component that is matched with the routing parameter, and obtain a routing switching end time;
a routing data reporting module 330, configured to report the acquired routing data; the routing data includes: route parameters, route switching start time, route switching end time, and route switching error information.
According to the technical scheme of the embodiment of the invention, if the route change is detected, the global route hook function of the route object is called back, and the route parameter, the route switching starting time and the route switching error information are obtained; respectively calling back the component routing hook functions of the routing components to be mounted, which are matched with the routing parameters, and acquiring the routing switching end time; the obtained routing parameters, the routing switching starting time, the routing switching finishing time and the routing switching error information are reported, the problem that routing performance data in the routing switching process cannot be captured in the prior art is solved, routing switching is detected by calling a routing hook function through a probe in a single-page application program, and the routing performance data in the routing switching process is obtained.
Optionally, the method further includes: the routing hook function definition module is used for predefining a component routing hook function and a global routing hook function before the global routing hook function of the routing object is called back; the component routing hook function includes: a beforeCreate function, a beforrouteenenter function, and a beforrouteupdate function; the global routing hook function includes: a before Each function, an after Each function, and an oneerror function; registering a component routing hook function with the probe on all vue components of the single-page application; before each vue component is created, a call back is performed on the before update 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.
Optionally, the routing hook function defining module is further configured to, after a probe calls back a before function of each vue component to obtain a routing object corresponding to the vue component, obtain routing object definition information corresponding to the routing object through the probe; the routing object definition information includes: a route component to mount that matches the specified route of the vue component.
Optionally, the first data obtaining module 310 is specifically configured to: calling back a before Each function of the routing object to acquire a routing parameter; the routing parameters include a current route to leave and a new route to enter; switching the route from the current route to be departed to the new route to be entered, and recording the starting time of route switching through a probe; and calling back an oneerror function of the routing object, and acquiring routing switching error information.
Optionally, the first data obtaining module 310 is further configured to: after the starting time of route switching is recorded through the probe, callback is carried out on an afterEach function of a route object, and the number of route components to be mounted is acquired; and if the number of the routing components to be mounted is greater than 0, initializing the value of the component counter according to the number of the routing components to be mounted.
Optionally, the second data obtaining module 320 is specifically configured to: if the route switching error information is not acquired, calling back a beforeRouteEnter function or a beforeRouteUpdate function of the current route component to be mounted so as to mount the current route component to be mounted; if the mounting of the current routing component to be mounted is finished, subtracting 1 from the value of the component counter, and updating the current routing component to be mounted; and returning to execute the callback operation of the beforeRouteEnter function or the beforeRouteUpdate function of the current 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 becomes 0 as the routing switching ending time.
Optionally, the routing data reporting module 330 is specifically configured to: if the number of the routing components to be mounted is 0, reporting the acquired routing data; or if the routing switching is wrong, reporting the acquired routing data; or if all the mounted routing components to be mounted are completed, reporting the acquired routing data.
The routing data acquisition device provided by the embodiment of the invention can execute the routing data acquisition method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Example four
Fig. 4 is a schematic structural diagram of an apparatus according to a fourth embodiment of the present invention. Fig. 4 illustrates 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 only an example and should not bring any limitation to the function and scope of use of the embodiments of the present invention.
As shown in FIG. 4, the device 12 is embodied in the form of a general purpose computing device, which may be a PC terminal or a mobile terminal. The components of device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that couples various system components including the system memory 28 and the processing unit 16.
Bus 18 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, 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 may 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 and write to non-removable, nonvolatile magnetic media (not shown in FIG. 4, and commonly referred to as a "hard drive"). Although not shown in FIG. 4, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are 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, for example, in 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 of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally carry out the functions and/or methodologies of the described embodiments of the invention.
Device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), with one or more devices that enable a user to interact with device 12, and/or with any devices (e.g., network card, modem, etc.) that enable device 12 to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface 22. Also, the device 12 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet) via the network adapter 20. As shown, the network adapter 20 communicates with the other modules of the device 12 via the bus 18. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 16 executes programs stored in the system memory 28 to execute various functional applications and data processing, for example, to implement the route data collection method provided by the embodiment of the present invention.
Namely: the method for realizing the routing data acquisition is applied to a single-page application program and comprises the following steps:
if the routing change is detected, the global routing hook function of the routing object is called back, and routing parameters, routing switching start time and routing switching error information are obtained;
respectively calling back the component routing hook functions of the routing components to be mounted, which are matched with the routing parameters, and acquiring switching end time;
reporting the acquired routing data; the routing data includes: route parameters, route switching start time, route switching end time, and route switching error information.
EXAMPLE five
An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is used to execute any routing data collection method provided in the foregoing embodiments when executed by a computer processor, where the routing data collection method is applied to a single-page application program, and includes:
if the routing change is detected, the global routing hook function of the routing object is called back, and routing parameters, routing switching start time and routing switching error information are obtained;
respectively calling back the component routing hook functions of the routing components to be mounted, which are matched with the routing parameters, and acquiring switching end time;
reporting the acquired routing data; the routing data includes: route parameters, route switching start time, route switching end time, and route switching error information.
Computer storage media for embodiments of the invention may employ 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. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination 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 the context of 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.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. 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 for aspects 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 + +, or the like, as well as 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 type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. 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, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A route data acquisition method is applied to a single-page application program and comprises the following steps:
if the routing change is detected, the global routing hook function of the routing object is called back, and routing parameters, routing switching start time and routing switching error information are obtained;
respectively calling back the component routing hook functions of the routing components to be mounted, which are matched with the routing parameters, and acquiring the routing switching end time;
reporting the acquired routing data; the routing data includes: route parameters, route switching start time, route switching end time, and route switching error information.
2. The method of claim 1, further comprising, prior to making a callback to a global routing hook function of a routing object:
predefining a component routing hook function and a global routing hook function; the component routing hook function comprises: a beforeCreate function, a beforrouteenenter function, and a beforrouteupdate function; the global routing hook function comprises: a before Each function, an after Each function, and an oneerror function;
registering the component routing hook function with a probe on all vue components of the single-page application;
before each vue component is created, a probe calls back a before-update function of each vue component, a route object corresponding to the vue component is obtained, and a global route hook function is registered in the route object.
3. The method of claim 2, wherein after the probe calls back the before update function of each vue component to obtain the route object corresponding to the vue component, the method further comprises:
acquiring routing object definition information corresponding to the routing object through a probe; the routing object definition information includes: a route component to mount that matches the specified route of the vue component.
4. The method of claim 2, wherein the callback to the global routing hook function of the route object and obtaining the routing parameters, the route switching start time, and the route switching error information comprises:
calling back a before Each function of the routing object to acquire a routing parameter; the routing parameters include a current route to leave and a new route to enter;
switching the route from the current route to be departed to the new route to be entered, and recording the starting time of route switching through a probe;
and calling back an oneerror function of the routing object, and acquiring routing switching error information.
5. The method of claim 4, further comprising, after recording a route switch start time by the probe:
calling back an afterEach function of the routing object to acquire the number of the routing components to be mounted;
and if the number of the routing components to be mounted is greater than 0, initializing the value of the component counter according to the number of the routing components to be mounted.
6. The method according to claim 5, wherein respectively calling back the component routing hook function of each to-be-mounted routing component matching the routing parameter, and obtaining the route switching end time comprises:
if the route switching error information is not acquired, calling back a beforeRouteEnter function or a beforeRouteUpdate function of the current route component to be mounted so as to mount the current route component to be mounted;
if the mounting of the current routing component to be mounted is finished, subtracting 1 from the value of the component counter, and updating the current routing component to be mounted;
and returning to execute the callback operation of the beforeRouteEnter function or the beforeRouteUpdate function of the current 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 becomes 0 as the routing switching ending time.
7. The method of claim 6, wherein reporting the acquired routing data comprises:
if the number of the routing components to be mounted is 0, reporting the acquired routing data;
alternatively, the first and second electrodes may be,
if the routing switching is wrong, reporting the acquired routing data;
alternatively, the first and second electrodes may be,
and if all the routing components to be mounted are mounted, reporting the acquired routing data.
8. A routing data acquisition device is applied to a single-page application program and comprises the following components:
the first data acquisition module is used for calling back a global routing hook function of a routing object if routing change is detected, and acquiring routing parameters, routing switching start time and routing switching error information;
the second data acquisition module is used for respectively calling back the component routing hook functions of the routing components to be mounted, which are matched with the routing parameters, and acquiring the routing switching end time;
a routing data reporting module, configured to report the acquired routing data; the routing data includes: route parameters, route switching start time, route switching end time, and route switching error information.
9. An apparatus, characterized in that the apparatus comprises:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the route data collection method of any one of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out a method for route data acquisition according to any one of claims 1 to 7.
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 true CN110888731A (en) 2020-03-17
CN110888731B 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)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113392032A (en) * 2021-08-17 2021-09-14 北京安普诺信息技术有限公司 API (application program interface) discovery method, test coverage rate determining method and device
CN113392347A (en) * 2021-08-18 2021-09-14 北京安普诺信息技术有限公司 Instrumentation-based Web backend API (application program interface) acquisition method and device and storage medium
CN113472752A (en) * 2021-06-11 2021-10-01 北京达佳互联信息技术有限公司 Authority processing method and device, electronic equipment and storage medium

Citations (13)

* 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
US20030076780A1 (en) * 2001-07-27 2003-04-24 Thales Task management method for a packet switch routing automaton forming part of a secured packet-switching transmission network
CN105917621A (en) * 2014-01-14 2016-08-31 华为技术有限公司 Methods and systems for data routing
CN107562425A (en) * 2017-08-07 2018-01-09 上海斐讯数据通信技术有限公司 Single-page application creation method and device based on Hybrid applications
CN108416038A (en) * 2018-03-14 2018-08-17 北京网信云服信息科技有限公司 A kind of data statistical approach and device of single page application
CN109542530A (en) * 2018-10-26 2019-03-29 深圳点猫科技有限公司 A kind of hierarchical loading method and device based on small routine framework
CN109669597A (en) * 2018-10-31 2019-04-23 武汉艺果互动科技股份有限公司 Front end authority control method, equipment and storage equipment when user browses web sites
US20190140919A1 (en) * 2018-04-12 2019-05-09 Ned M. Smith Edge computing service global validation
CN109933349A (en) * 2019-01-28 2019-06-25 优信拍(北京)信息科技有限公司 A kind of method to be timely updated based on vue spa, system and equipment
CN109976973A (en) * 2019-02-19 2019-07-05 深圳点猫科技有限公司 Abnormality monitoring method and electronic equipment on a kind of small routine line
CN110472178A (en) * 2019-08-20 2019-11-19 北京博睿宏远数据科技股份有限公司 A kind of probe method for implanting, device, computer equipment and storage medium
CN110535774A (en) * 2019-07-24 2019-12-03 平安科技(深圳)有限公司 Dynamic routing processing method, device, computer equipment and storage medium

Patent Citations (13)

* 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
US20030076780A1 (en) * 2001-07-27 2003-04-24 Thales Task management method for a packet switch routing automaton forming part of a secured packet-switching transmission network
CN105917621A (en) * 2014-01-14 2016-08-31 华为技术有限公司 Methods and systems for data routing
CN107562425A (en) * 2017-08-07 2018-01-09 上海斐讯数据通信技术有限公司 Single-page application creation method and device based on Hybrid applications
CN108416038A (en) * 2018-03-14 2018-08-17 北京网信云服信息科技有限公司 A kind of data statistical approach and device of single page application
US20190140919A1 (en) * 2018-04-12 2019-05-09 Ned M. Smith 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
CN109669597A (en) * 2018-10-31 2019-04-23 武汉艺果互动科技股份有限公司 Front end authority control method, equipment and storage equipment when user browses web sites
CN109933349A (en) * 2019-01-28 2019-06-25 优信拍(北京)信息科技有限公司 A kind of method to be timely updated based on vue spa, system and equipment
CN109976973A (en) * 2019-02-19 2019-07-05 深圳点猫科技有限公司 Abnormality monitoring method and electronic equipment on a kind of small routine line
CN110535774A (en) * 2019-07-24 2019-12-03 平安科技(深圳)有限公司 Dynamic routing processing method, device, computer equipment and storage medium
CN110472178A (en) * 2019-08-20 2019-11-19 北京博睿宏远数据科技股份有限公司 A kind of probe method for implanting, device, computer equipment and storage medium

Non-Patent Citations (10)

* Cited by examiner, † Cited by third party
Title
FABIAN KAIMER 等: "Return of the JS: Towards a Node.js-Based Software Architecture for Combined CMS/CRM Applications", PROCEDIA COMPUTER SCIENCE 141 (2018), pages 454 - 459 *
YI-FAN SONG等: "Automatic data archiving and visualization at HLS-Ⅱ", 《NUCLEAR SCIENCE AND TECHNIQUES》 *
YI-FAN SONG等: "Automatic data archiving and visualization at HLS-Ⅱ", 《NUCLEAR SCIENCE AND TECHNIQUES》, no. 09, 7 September 2018 (2018-09-07), pages 11 - 16 *
广积粮缓称王: "vue-router进阶:路由使用归纳、路由导航守卫、导航守卫 解析流程", Retrieved from the Internet <URL:https://blog.csdn.net/zhouzuoluo/article/details/84839419> *
邓雯婷: "基于Vue.js构建单页面GIS应用的方法研究", 《科技创新与应用》 *
邓雯婷: "基于Vue.js构建单页面GIS应用的方法研究", 《科技创新与应用》, no. 14, 18 May 2018 (2018-05-18), pages 11 - 13 *
陈辰等: "基于路由模式的前端框架设计与改进", 《电脑知识与技术》 *
陈辰等: "基于路由模式的前端框架设计与改进", 《电脑知识与技术》, no. 12, 25 April 2018 (2018-04-25), pages 59 - 60 *
雨点的名字: "VueJs(12)---vue-router", 《HTTPS://WWW.CNBLOGS.COM/QDHXHZ/P/9016792.HTML》 *
雨点的名字: "VueJs(12)---vue-router", 《HTTPS://WWW.CNBLOGS.COM/QDHXHZ/P/9016792.HTML》, 9 May 2018 (2018-05-09) *

Cited By (6)

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

Also Published As

Publication number Publication date
CN110888731B (en) 2023-07-07

Similar Documents

Publication Publication Date Title
CN110457277B (en) Service processing performance analysis method, device, equipment and storage medium
CN110888731B (en) Method, device, equipment and storage medium for acquiring route data
CN109783345B (en) Method and system for testing small program performance
CN110320378B (en) Method, apparatus, device and computer readable storage medium for applying for a quality control test
CN111367814A (en) Embedded point testing method and device, terminal equipment and storage medium
CN108874441B (en) Board card configuration method, device, server and storage medium
CN110597704B (en) Pressure test method, device, server and medium for application program
CN109165372B (en) Webpage loading method, device, equipment and storage medium
CN109753437B (en) Test program generation method and device, storage medium and electronic equipment
CN111241043A (en) Multimedia file sharing method, terminal and storage medium
CN113886264A (en) Embedded method, device, equipment and storage medium of distributed database
CN115022201B (en) Data processing function test method, device, equipment and storage medium
CN111198853B (en) Data processing method, device, electronic equipment and computer readable storage medium
CN110769316A (en) Method, device, equipment and storage medium for calculating first frame time
CN107168776B (en) Event statistical method, device, equipment and storage medium
CN114116480A (en) Method, device, medium and equipment for determining application program test coverage rate
CN111741046B (en) Data reporting method, data acquisition method, device, equipment and medium
CN111309583B (en) Interface overdrawing detection method, device, medium and computing equipment
CN113760696A (en) Program problem positioning method and device, electronic equipment and storage medium
CN112084114A (en) Method and apparatus for testing an interface
CN115484200B (en) Buried point testing method, buried point testing device, server, storage medium and buried point testing system
CN110968519A (en) Game testing method, device, server and storage medium
CN113986517B (en) API call log acquisition method and device, electronic equipment and storage medium
CN116955118B (en) Performance analysis method, system, computing device and storage medium
CN114116291B (en) Log detection method, log detection device, computer device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant