CN113316125A - Monitoring method, distributed vehicle-mounted system, vehicle and readable storage medium - Google Patents

Monitoring method, distributed vehicle-mounted system, vehicle and readable storage medium Download PDF

Info

Publication number
CN113316125A
CN113316125A CN202110718161.4A CN202110718161A CN113316125A CN 113316125 A CN113316125 A CN 113316125A CN 202110718161 A CN202110718161 A CN 202110718161A CN 113316125 A CN113316125 A CN 113316125A
Authority
CN
China
Prior art keywords
interface
request
time
interceptor
preset
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
CN202110718161.4A
Other languages
Chinese (zh)
Other versions
CN113316125B (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.)
Guangzhou Xiaopeng Motors Technology Co Ltd
Original Assignee
Guangzhou Xiaopeng Motors Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Xiaopeng Motors Technology Co Ltd filed Critical Guangzhou Xiaopeng Motors Technology Co Ltd
Priority to CN202110718161.4A priority Critical patent/CN113316125B/en
Publication of CN113316125A publication Critical patent/CN113316125A/en
Application granted granted Critical
Publication of CN113316125B publication Critical patent/CN113316125B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/30Services specially adapted for particular environments, situations or purposes
    • H04W4/40Services specially adapted for particular environments, situations or purposes for vehicles, e.g. vehicle-to-pedestrians [V2P]
    • H04W4/48Services specially adapted for particular environments, situations or purposes for vehicles, e.g. vehicle-to-pedestrians [V2P] for in-vehicle communication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W12/00Security arrangements; Authentication; Protecting privacy or anonymity
    • H04W12/12Detection or prevention of fraud
    • H04W12/121Wireless intrusion detection systems [WIDS]; Wireless intrusion prevention systems [WIPS]
    • H04W12/122Counter-measures against attacks; Protection against rogue devices
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W12/00Security arrangements; Authentication; Protecting privacy or anonymity
    • H04W12/60Context-dependent security
    • H04W12/61Time-dependent
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W24/00Supervisory, monitoring or testing arrangements
    • H04W24/08Testing, supervising or monitoring using real traffic

Abstract

The application discloses a monitoring method, a distributed vehicle-mounted system, a vehicle and a readable storage medium. The monitoring method of the interface request is used for a distributed vehicle-mounted system. The monitoring method comprises the following steps: intercepting an interface request corresponding to a preset interface by using an interceptor; creating a sliding window based on the remote dictionary service, wherein the sliding window records a preset number of interface requests in an ordered set according to the request time of the interface requests; when the interceptor intercepts the interface request, determining the time difference between the current time and the request time of the interface request corresponding to the sequence head in the ordered set; and sending alarm information under the condition that the time difference is smaller than a preset time threshold. The monitoring method achieves the purpose of monitoring the interface by utilizing the sliding window algorithm to monitor the calling frequency of the interface request in the project based on the remote dictionary service, can find the conditions such as abnormal interface flow in real time, give an alarm in time, find the problem in time and rapidly process the problem, and reduces the loss.

Description

Monitoring method, distributed vehicle-mounted system, vehicle and readable storage medium
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a monitoring method, a distributed vehicle-mounted system, a vehicle, and a readable storage medium.
Background
At present, the situation that flow is excessively consumed due to the fact that acquired data are not wanted data and meaningless frequent requests are made on an application program interface can occur to a vehicle-mounted large screen or a client. It can be understood that, since the scene does not belong to the anomaly of the background application, it is difficult to find the anomaly in time, which causes the traffic of the client to increase suddenly, wastes the large screen traffic of the user, and causes loss.
The current solution to this situation is found by operation and maintenance, and the current common way to record the problem is by logging. Logging non-real-time data, however, can result in delay in problem discovery, thereby causing unnecessary loss.
Disclosure of Invention
The embodiment of the application provides a monitoring method, a distributed vehicle-mounted system, a vehicle and a readable storage medium.
The embodiment of the application provides a monitoring method of an interface request, which is used for a distributed vehicle-mounted system. The monitoring method comprises the following steps: intercepting an interface request corresponding to a preset interface by using an interceptor; creating a sliding window based on a remote dictionary service, wherein the sliding window records a preset number of interface requests in an ordered set according to the request time of the interface requests; when the interceptor intercepts the interface request, determining the time difference between the current time and the request time of the sequence head corresponding to the interface request in the ordered set; and sending alarm information under the condition that the time difference is smaller than a preset time threshold.
In some embodiments, before intercepting, by an interceptor, an interface request corresponding to a preset interface, the monitoring method includes: implementing the interceptor by inheriting an adapter class and setting preprocessing; the interceptor is registered by inheriting a configuration class.
In some embodiments, before determining the time difference between the current time and the request time of the sequence header corresponding to the interface request in the ordered set, the method further comprises: deleting the interface requests and the corresponding request time corresponding to the sequence head in the ordered set under the condition that the number of the interface requests of the ordered set reaches the preset number; adding the intercepted interface request and the current time to the tail of the sequence of the ordered set.
In some embodiments, the sending alarm information in the case that the time difference is smaller than a preset time threshold includes: and sending the alarm information through a mail, a short message and/or an instant messaging tool.
In some embodiments, the monitoring method comprises: after the alarm information is sent, recording the alarm information in a key value pair of the remote dictionary service and setting corresponding expiration time; under the condition that the interceptor intercepts the interface request and detects that the time difference is smaller than a preset time threshold value again, inquiring whether the alarm information exists in the remote dictionary service or not; if the alarm information does not exist, sending new alarm information again; and if the alarm information exists, canceling to send the new alarm information.
In some embodiments, the intercepting, by an interceptor, an interface request corresponding to a preset interface includes: and mapping the configuration file to the interceptor by using the annotation so as to enable the interceptor to intercept the interface request corresponding to the preset interface.
In some embodiments, the intercepting, by an interceptor, an interface request corresponding to a preset interface includes: acquiring a uniform resource identifier of the interface request; and intercepting the interface request under the condition that the preset interface is configured with the uniform resource identifier of the interface request.
The embodiment of the application also provides a distributed vehicle-mounted system. The distributed vehicle-mounted system comprises: the device comprises an interception module, a creation module, a time difference determination module and an alarm module. The interception module is used for intercepting an interface request corresponding to a preset interface by using an interceptor; the creation module is used for creating a sliding window based on remote dictionary service, and the sliding window records a preset number of interface requests in an ordered set according to the request time of the interface requests; the time difference determining module is used for determining the time difference between the current time and the request time of the sequence head corresponding to the interface request in the ordered set when the interceptor intercepts the interface request; and the alarm module is used for sending alarm information under the condition that the time difference is smaller than a preset time threshold value.
The embodiment of the application also provides a vehicle. The vehicle comprises a processor and a memory, the memory having stored thereon a computer program which, when executed by the processor, implements the monitoring method of any of the above embodiments.
The embodiment of the application also provides a nonvolatile computer readable storage medium of the computer program. The computer program, when executed by one or more processors, implements the monitoring method of any of the above embodiments.
The monitoring method achieves the purpose of monitoring the interface by utilizing the sliding window algorithm to monitor the calling frequency of the interface request in the project based on the remote dictionary service, can find the conditions such as abnormal interface flow in real time, give an alarm in time, find the problem in time and rapidly process the problem, and reduces the loss.
Additional aspects and advantages of embodiments of the present application will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the present application.
Drawings
The above and/or additional aspects and advantages of the present application will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 is a schematic flow chart of a monitoring method according to certain embodiments of the present application;
FIG. 2 is a schematic block diagram of a distributed on-board system according to certain embodiments of the present application;
FIG. 3 is a schematic view of a sliding window in a monitoring method according to some embodiments of the present disclosure;
FIG. 4 is a schematic flow chart of a monitoring method according to some embodiments of the present application;
FIG. 5 is a schematic block diagram of a distributed on-board system according to certain embodiments of the present application;
FIG. 6 is a schematic flow chart of a monitoring method according to certain embodiments of the present application;
FIG. 7 is a schematic block diagram of a distributed on-board system in accordance with certain embodiments of the present application;
FIG. 8 is a schematic flow chart of a monitoring method according to certain embodiments of the present application;
FIG. 9 is a schematic flow chart of a monitoring method according to certain embodiments of the present application;
FIG. 10 is a schematic block diagram of a distributed on-board system in accordance with certain embodiments of the present application;
FIG. 11 is a schematic flow chart of a monitoring method according to certain embodiments of the present application;
FIG. 12 is a block diagram illustrating the structure of an intercept module in a distributed on-board system according to some embodiments of the present disclosure;
FIG. 13 is a schematic flow chart of a monitoring method according to certain embodiments of the present application;
FIG. 14 is a schematic block diagram of an intercept module in a distributed on-board system according to some embodiments of the present application;
FIG. 15 is a schematic structural view of a vehicle according to certain embodiments of the present application;
FIG. 16 is a schematic diagram of a computer-readable storage medium according to some embodiments of the present application.
Detailed Description
Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below by referring to the drawings are exemplary only for the purpose of explaining the embodiments of the present application, and are not to be construed as limiting the embodiments of the present application.
At present, the situation that the flow is excessively consumed due to the fact that acquired data is not wanted data and meaningless frequent requests are made on an application program interface can occur to a vehicle-mounted large screen or a client. The current solution to this situation is found by operation and maintenance, wherein operation and maintenance generally refers to the maintenance of network software and hardware already established by large organizations, and wherein traditional operation and maintenance refers to information technology operation and maintenance (IT operation and maintenance). After the problem is found, the current common way to record the problem is through logging. Logging non-real-time data, however, can result in delay in problem discovery, thereby causing unnecessary loss.
In order to solve the above problem, please refer to fig. 1, the present application provides a monitoring method for an interface request, which is used for a distributed vehicle-mounted system. The monitoring method comprises the following steps:
02: intercepting an interface request corresponding to a preset interface by using an interceptor;
04: creating a sliding window based on the remote dictionary service, wherein the sliding window records a preset number of interface requests in an ordered set according to the request time of the interface requests;
06: when the interceptor intercepts the interface request, determining the time difference between the current time and the request time of the interface request corresponding to the sequence head in the ordered set;
08: and sending alarm information under the condition that the time difference is smaller than a preset time threshold.
Referring to fig. 2, the present application further provides a distributed vehicle-mounted system 10. The distributed vehicle-mounted system 10 includes an intercept module 12, a creation module 14, a time difference determination module 16, and an alert module 18.
Step 01 may be implemented by the interception module 12, step 02 may be implemented by the creation module 14, step 03 may be implemented by the time difference determination module, and step 04 may be implemented by the alarm module 18. That is, the intercepting module 12 is configured to intercept, by using an interceptor, an interface request corresponding to a preset interface; the creating module 14 is configured to create a sliding window based on the remote dictionary service, where the sliding window records a preset number of interface requests in the ordered set according to the request time of the interface requests; the time difference determining module 16 is configured to determine, when the interface request is intercepted by the interceptor, a time difference between a current time and a request time of the interface request corresponding to the sequence header in the ordered set; the alarm module 18 is configured to send alarm information when the time difference is smaller than a preset time threshold.
Specifically, the background service corresponding to the vehicle-mounted large screen avoids a single point of failure (the single point of failure refers to a single failure causing system failure and may bring catastrophic damage to the entire system), and therefore, the current background service system of the vehicle-mounted large screen adopts a distributed system architecture. The distributed system architecture, as the name implies, disperses the design of multiple software architectures to run on multiple servers.
It can be understood that errors may occur if the alarm information is issued for the modern distributed system architecture by the conventional method of implementing the alarm by using the sliding window. Specifically, the conventional method of generating an alarm for a modern distributed architecture with multiple server ends may be: if one client side simultaneously requests access to a plurality of server sides in the same time and the specified access times in the specified time are reached, the system sends out alarm information. Correspondingly, for example, the server 1 and the server 2 are both accessed by the same client 1, and if the number of times that the client 1 accesses the server in 20 seconds is set to be 20, the system will send out the alarm information. When the client 1 sends 20 access requests to the server 1 within 20 seconds, the client 1 also sends 19 access requests to the server 2 within 20 seconds at the same time. Therefore, at this time, the number of times that the server 1 and the server 2 are accessed by the client 1 in 20 seconds is 39 in total, and the system sends the alarm information, so that the time when the system sends the alarm information is deviated from the standard of sending the alarm information when the system is accessed 20 times in 20 seconds.
The monitoring method of the interface request aims at the distributed system architecture, different access request times and access time for sending the alarm information are respectively set for different interfaces of different server ends corresponding to different client ends, and the monitoring method can adapt to the modern distributed system architecture.
It is understood that in the present application, the client is a terminal requesting a service, i.e., a terminal used by a user. The client of the software layer refers to an IE browser, a QQ, a storm video and the like. The software-level server refers to a web server, such as Apache, which externally publishes a service to provide the service, and the service is installed on hardware for use. For simple Apache, a web service is opened for a computer, a port is set, and a client can access the server computer through a browser. For example, a user inputs a hundred-degree ip in a Firefox browser, and searches for content 1 after a hundred-degree home page is popped out from the browser, so that a webpage related to the content 1 is obtained. At this time, the searching user is just receiving the service of the hundredth server side. At this time, the Firefox browser is the client of the user, and the server is a remote hundred-degree computer.
The preset interface refers to an Application Program Interface (API), that is, an application program interface connected between the client and the server. In some embodiments of the application, a distributed vehicle-mounted system using the springboot1.5.12 version is taken as an example for description, in a development process of the distributed vehicle-mounted system using the springboot1.5.12 version, an alarm interceptor may be newly added in a code to intercept an interface request in the application program interface first, and then the number of accesses and the access time of the interface request in the preset interface may be monitored by the interceptor.
Then, a sliding window is created based on the remote dictionary service, and the sliding window records a preset number of interface requests in the ordered set according to the request time of the interface requests. The Remote Dictionary service (Redis) is an open source, written in ANSIC language, supporting network, log type based on memory and persistent, Key-Value database, and provides Application Program Interface (API) of multiple languages. Redis is a memory database, and compared with the traditional relational databases such as MySQL, Oracle and the like, which directly store the contents in a hard disk, the read-write efficiency of the memory database is much higher than that of the traditional database.
Ordered sets are one of five data structures of the remote dictionary service (Redis). The ordered set is used to store key-value pairs (key-value). Keys (keys) of an ordered set are called members (members), each member being distinct. The value of the ordered set (value) is then called the score (score), which must be a floating point number. The ordered set is the only structure in the Redis, which can access the elements according to the members and the scores and the arrangement order of the scores.
It can be understood that the monitoring method of the present application may define the size of the sliding window of the request interface in the remote dictionary service by using the ordered set data interface according to the parameter configuration in the interceptor. When the interceptor intercepts the interface request with the interception time still within the request time, but the number of the interface request exceeds the size of the sliding window, the interface request is added at the tail part of the sliding window, and the request data of the interface request corresponding to the head part of the sliding window at the interception time is removed, so that the sliding window with a fixed size is provided.
The preset number of interface requests refers to the number of access requests, for example, the maximum number of access requests is: when the request time is 60 seconds, the preset number in 60 seconds is 60 interface requests, the size of the sliding window may be recorded and defined as 60 access requests, that is, the size of the sliding window only allows to store up to 60 interface requests, and if there are more than 60 interface requests in the sliding window, the interface request data of the header (as shown in the request indicated by the dotted line in fig. 3) is removed, and only 60 interface requests (as shown in fig. 3) are maintained. It should be noted that, although the size of the sliding window is fixed, the current time corresponding to the last interface request access is not fixed in the monitoring method of the present application.
In addition, the monitoring method can dynamically define the sizes of sliding windows of different interfaces, realizes fixed-length sequence queues by utilizing orderly combined data structures for different interfaces, and is suitable for the architecture of a modern distributed system.
Therefore, when the interface request is intercepted by the interceptor, the time difference between the current time and the request time of the sequence head corresponding to the interface request in the ordered set is determined, and the alarm information is sent under the condition that the time difference is smaller than the preset time threshold. Specifically, the monitoring method of the present application may determine whether the time for requesting the number of times (e.g., 60 times described above) is less than a preset time threshold (e.g., 60 seconds described above) by comparing the time difference between the current time of the latest intercepted interface request and the request time of the corresponding interface request at the head, and further determine whether the number of times of access is frequent, and if the number of times of access is less than the request time (60 seconds), control the alarm module 18 of the distributed vehicle-mounted system 10 to send out alarm information.
The preset time threshold is determined according to the required normal request time corresponding to the request times. For example, if a certain interface requests 60 times in 60 seconds, the preset time threshold is 60 seconds. For another example, if a certain interface requests a normal access time of 20 seconds and 2 times, the preset time threshold is 20 seconds.
The monitoring method achieves the purpose of monitoring the interface by utilizing the sliding window algorithm to monitor the calling frequency of the interface request in the project based on the remote dictionary service, can find the conditions such as abnormal interface flow in real time, give an alarm in time, find the problem in time and rapidly process the problem, and reduces the loss.
Referring to fig. 4, in some embodiments, before step 02, the monitoring method further includes:
011: an interceptor is realized by inheriting an adapter class and setting preprocessing;
012: the interceptor is registered by inheriting the configuration class.
Referring to fig. 5, the distributed on-board system 10 further includes an interceptor generating module 11.
Step 011 and step 012 can be implemented by interceptor generating module 11. That is, the interceptor generating module 11 is configured to implement an interceptor by inheriting an adapter class and setting preprocessing, and register the interceptor by inheriting a configuration class.
Specifically, the interceptor in the present application is a segment of the code, and the interceptor may be generated based on android system registration, or based on apple system or other system registration. That is, the adapter class may be a manual interception adapter (handlentercaptoraadapter) based on the android system, and the setup preprocess is a rewrite preHandler. The configuration class may also be a configuration mode based on the desk security system (webmvcconfigurerradtier). In other embodiments of the application, if the monitoring method is based on an apple system or other systems, an adapter class and a configuration class corresponding to the system are set to generate an interceptor matched with the system, so that the monitoring method of the application can be applied to different operating systems.
Referring to fig. 6, before step 06, the method further includes:
051: under the condition that the number of the interface requests of the ordered set reaches a preset number, deleting the interface requests corresponding to the sequence head in the ordered set and the corresponding request time;
052: the intercepted interface request and the current time are added to the end of the sequence of the ordered set.
Referring to fig. 7, the distributed on-board system 10 further includes a deletion and addition module 15.
Steps 051 and 052 may be implemented by the delete and add module 15. That is to say, the deleting and adding module 15 is configured to delete the interface request and the corresponding request time corresponding to the sequence header in the ordered set when the number of the interface requests of the ordered set reaches the preset number; the intercepted interface request and the current time are added to the end of the sequence of the ordered set.
Specifically, when the interface requests stored in the ordered set (zset) reach a preset number, for example, the preset number is 60 interface requests, the interface request corresponding to the head of the sequence in the ordered set at this time and the corresponding request time may be deleted, and the newly intercepted interface request and the current time are added to the tail of the sequence in the ordered set, so as to ensure that the size of the sliding window is fixed. In addition, the monitoring method can compare the time difference between the request time of the head and the current time by recording the latest intercepted interface request and the corresponding current time, and sends alarm information under the condition that the time difference is smaller than a preset time threshold.
In addition, when the interface requests stored in the ordered set do not reach the preset number, the intercepted interface requests are directly added to the tail of the ordered set.
Referring to fig. 8, in some embodiments, step 08 includes:
081: and sending alarm information through mails, short messages and/or instant messaging tools.
Referring to FIG. 2, step 081 may be implemented by alarm module 18. That is, the alarm module 18 is used to send alarm information via mail, text message and/or instant messaging.
Specifically, when the alarm module 18 detects that the time difference between the time of the latest intercepted request of the interface request and the time of receiving the interface request of the header sequence of the interface request for the first time is smaller than the preset time threshold, the alarm module 18 may send alarm information through an email, a short message and/or an instant messaging tool (e.g., qq, a WeChat, a nail, etc.) to prompt a user of the client side that the abnormal interface request is sent correspondingly, and prompt that the request access is abnormal, so that the user may find the abnormality in time, and make a corresponding processing action to stop loss in time.
Referring to fig. 9, in some embodiments, the monitoring method includes:
091: after the alarm information is sent, recording the alarm information in a key value pair of the remote dictionary service and setting corresponding expiration time;
092: under the condition that the interceptor intercepts the interface request and detects that the time difference is smaller than the preset time threshold value again, inquiring whether alarm information exists in the remote dictionary service or not;
093: if the alarm information does not exist, sending new alarm information again; and if the alarm information exists, canceling to send new alarm information.
Referring to fig. 10, the distributed vehicle-mounted system 10 further includes an expiration time recording module 191, an alarm information query module 192, and an alarm processing module 193.
Step 091 may be implemented by expiration time recording module 191, step 092 may be implemented by alarm information query module 192, and step 093 may be implemented by alarm processing module 193. That is, the expiration time recording module 191 is configured to record the alarm information in the key value pair of the remote dictionary service and set the corresponding expiration time after sending the alarm information; the alarm information query module 192 is configured to query whether alarm information exists in the remote dictionary service or not when the interceptor intercepts the interface request and detects that the time difference is smaller than the preset time threshold again; the alarm processing module 193 is configured to send new alarm information again if no alarm information exists; and if the alarm information exists, canceling to send new alarm information.
In particular, a key-value pair (key-value) of a remote dictionary service (Redis) may record alarm information and set a corresponding expiration time.
For example, assume that the set expiration time is 1 minute, i.e., the alarm frequency for each frequently requested interface request is 1 minute.
In an example, if the expiration time is less than 1 minute, the interceptor intercepts an interface request 1, and detects that the time difference is less than the preset time threshold again, that is, the intercepted interface request 1 also belongs to one of the frequently requested requests. When the distributed vehicle-mounted system 10 inquires that the alarm information record corresponding to the interface request 1 exists in the remote dictionary service through the alarm information inquiry module 192, the alarm processing module 193 does not need to send new alarm information again, so that frequent sending of the alarm information is avoided, and user experience is improved.
In another example, if the time difference is detected to be less than the preset time threshold again within 1 minute of the expiration time, the interceptor intercepts an interface request 2, that is, the intercepted interface request 2 also belongs to one of the frequently requested requests. When the distributed vehicle-mounted system 10 inquires through the alarm information inquiry module 192 that there is no alarm information record corresponding to the interface request 2 in the remote dictionary service, the alarm processing module 193 needs to send new alarm information again, that is, this alarm information represents that there is a frequent request in the application program interface again. It can be understood that, during the expiration time, the remote dictionary service always records the alarm information record corresponding to the interface request 2, and after the expiration time elapses, the remote dictionary service deletes the alarm information record corresponding to the interface request 2, that is, after the expiration time, the alarm information record does not exist in the remote dictionary service.
According to the monitoring method, the remote dictionary service is used for recording the alarm information and setting the expiration time of the alarm information, the same abnormal interface request can be prevented from frequently sending the alarm information, and the user experience is improved.
Referring to fig. 11, step 02 includes:
021: and mapping the configuration file to an interceptor by using the annotation so as to intercept the interface request corresponding to the preset interface by using the interceptor.
Referring to fig. 12, the interception module 12 includes an annotation mapping unit 121.
Step 021 may be implemented by the annotation mapping unit 121. That is, the annotation mapping unit 121 is configured to map the configuration file to the interceptor using the annotation, so that the interceptor is used to intercept the interface request corresponding to the preset interface.
It will be appreciated that if the annotation is said to be written to the viewer, the annotation is written to the viewer of the program. The annotation is more like a tag, attached to a class, a method, or a field. The annotation is intended to provide a basis for the judgment of the program currently reading the annotation. For example, a program only reads the method added with @ Test and knows that the method is the method to be tested, and for example, the @ Before annotation, and the program knows that the method is to be executed Before the @ Test method when seeing the annotation.
According to the monitoring method, the configuration file is mapped to the interceptor through the annotation, the configuration file comprises the related information of the preset interface, and therefore the configuration file is mapped to the interceptor, and the interface request intercepted by the interceptor can be guaranteed to correspond to the preset interface in the configuration file. For example, if a certain interface request a does not have a corresponding preset interface a' in the configuration file, the interceptor will not intercept the interface request a, and will directly let the interface request a pass through. If a certain interface request B has a corresponding preset interface B' in the configuration file, the interceptor intercepts the interface request B.
Referring to fig. 13, in some embodiments, step 02 further includes:
022: acquiring a uniform resource identifier of an interface request;
023: and intercepting the interface request under the condition that the preset interface is configured with the uniform resource identifier of the interface request.
Referring to fig. 14, the intercepting module 12 further includes an obtaining unit 122 and an intercepting unit 123.
Step 022 may be implemented by the obtaining unit 122 and step 023 may be implemented by the intercepting unit 123. That is, the obtaining unit 122 is configured to obtain a Uniform Resource Identifier (URI) of the interface request; the intercepting unit 123 is configured to intercept the interface request when the predetermined interface is configured with the uniform resource identifier of the interface request.
In particular, the uniform resource identifier may be a URI or other identifier. In some embodiments of the present application, the interface request may be provided with uniform resource identifiers corresponding to the preset interfaces one to one, so that the interceptor is convenient to quickly intercept the interface request corresponding to the preset interface.
Referring to fig. 15, a vehicle 20 is also provided. The vehicle 20 comprises a processor 21 and a memory 22, the memory 22 having stored thereon a computer program 221, the computer program 221, when executed by the processor 21, implementing the monitoring method as described in any of the above embodiments. Vehicle 20 may refer to any type of vehicle or other vehicle employing a distributed on-board system.
Referring to fig. 16, the present application also provides a non-volatile computer readable storage medium 200 of a computer program. The monitoring method of any of the embodiments described above is implemented when the computer program 210 is executed by the one or more processors 220.
For example, the computer program 210, when executed by the processor 220, implements the following steps of the application management method:
02: intercepting an interface request corresponding to a preset interface by using an interceptor;
04: creating a sliding window based on the remote dictionary service, wherein the sliding window records a preset number of interface requests in an ordered set according to the request time of the interface requests;
06: when the interceptor intercepts the interface request, determining the time difference between the current time and the request time of the interface request corresponding to the sequence head in the ordered set;
08: and sending alarm information under the condition that the time difference is smaller than a preset time threshold.
It will be appreciated that the computer program 211 comprises computer program code. The computer program code may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable storage medium may include: any entity or device capable of carrying computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), software distribution medium, and the like.
The vehicle 20 and the computer-readable storage medium 200 of the application realize monitoring of the calling frequency of the interface request in the project by using the sliding window algorithm based on the remote dictionary service, achieve the purpose of monitoring the interface, can find the conditions such as abnormal interface flow in real time, give an alarm in time, can find the problem in time, can rapidly process and reduce the loss.

Claims (10)

1. A monitoring method of an interface request is used for a distributed vehicle-mounted system, and is characterized by comprising the following steps:
intercepting an interface request corresponding to a preset interface by using an interceptor;
creating a sliding window based on a remote dictionary service, wherein the sliding window records a preset number of interface requests in an ordered set according to the request time of the interface requests;
when the interceptor intercepts the interface request, determining the time difference between the current time and the request time of the sequence head corresponding to the interface request in the ordered set;
and sending alarm information under the condition that the time difference is smaller than a preset time threshold.
2. The monitoring method according to claim 1, wherein before intercepting the interface request corresponding to the preset interface by using the interceptor, the monitoring method comprises:
implementing the interceptor by inheriting an adapter class and setting preprocessing;
the interceptor is registered by inheriting a configuration class.
3. The method of monitoring of claim 1, wherein prior to determining the time difference between the current time and the request time for the interface request at the sequence header in the ordered set, further comprising:
deleting the interface requests and the corresponding request time corresponding to the sequence head in the ordered set under the condition that the number of the interface requests of the ordered set reaches the preset number;
adding the intercepted interface request and the current time to the tail of the sequence of the ordered set.
4. The monitoring method according to claim 1, wherein the sending alarm information in case the time difference is smaller than a preset time threshold comprises:
and sending the alarm information through a mail, a short message and/or an instant messaging tool.
5. The monitoring method according to claim 1, characterized in that the monitoring method comprises:
after the alarm information is sent, recording the alarm information in a key value pair of the remote dictionary service and setting corresponding expiration time;
under the condition that the interceptor intercepts the interface request and detects that the time difference is smaller than a preset time threshold value again, inquiring whether the alarm information exists in the remote dictionary service or not;
if the alarm information does not exist, sending new alarm information again;
and if the alarm information exists, canceling to send the new alarm information.
6. The monitoring method according to claim 1, wherein intercepting, by the interceptor, the interface request corresponding to the preset interface comprises:
and mapping the configuration file to the interceptor by using the annotation so as to enable the interceptor to intercept the interface request corresponding to the preset interface.
7. The monitoring method according to claim 1, wherein intercepting, by the interceptor, the interface request corresponding to the preset interface comprises:
acquiring a uniform resource identifier of the interface request;
and intercepting the interface request under the condition that the preset interface is configured with the uniform resource identifier of the interface request.
8. A distributed, on-board system, comprising:
the interception module is used for intercepting an interface request corresponding to a preset interface by using an interceptor;
the creating module is used for creating a sliding window based on remote dictionary service, and the sliding window records a preset number of interface requests in an ordered set according to the request time of the interface requests;
a time difference determining module, configured to determine, when the interface request is intercepted by the interceptor, a time difference between a current time and a request time of the sequence header corresponding to the interface request in the ordered set;
and the alarm module is used for sending alarm information under the condition that the time difference is smaller than a preset time threshold value.
9. A vehicle comprising a processor and a memory, the memory having stored thereon a computer program which, when executed by the processor, carries out the monitoring method of any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium of a computer program, wherein the computer program, when executed by one or more processors, implements the monitoring method of any one of claims 1-7.
CN202110718161.4A 2021-06-28 2021-06-28 Monitoring method, distributed vehicle-mounted system, vehicle and readable storage medium Active CN113316125B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110718161.4A CN113316125B (en) 2021-06-28 2021-06-28 Monitoring method, distributed vehicle-mounted system, vehicle and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110718161.4A CN113316125B (en) 2021-06-28 2021-06-28 Monitoring method, distributed vehicle-mounted system, vehicle and readable storage medium

Publications (2)

Publication Number Publication Date
CN113316125A true CN113316125A (en) 2021-08-27
CN113316125B CN113316125B (en) 2022-08-16

Family

ID=77380578

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110718161.4A Active CN113316125B (en) 2021-06-28 2021-06-28 Monitoring method, distributed vehicle-mounted system, vehicle and readable storage medium

Country Status (1)

Country Link
CN (1) CN113316125B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090130984A1 (en) * 2006-10-20 2009-05-21 Samsung Electronics Co., Ltd. Apparatus and method for intercepting packet data in mobile communication system
US20180287972A1 (en) * 2017-03-31 2018-10-04 Bmc Software, Inc. Systems and methods for intercepting access to messaging systems
CN110808877A (en) * 2019-10-30 2020-02-18 深圳前海环融联易信息科技服务有限公司 Statistical analysis method and device based on interface response duration and computer equipment
CN111224939A (en) * 2019-11-15 2020-06-02 上海钧正网络科技有限公司 Task request intercepting method and device, computer equipment and storage medium
CN112202682A (en) * 2020-09-27 2021-01-08 平安国际智慧城市科技股份有限公司 Interface flow control method and device, computer equipment and storage medium
CN112367269A (en) * 2020-10-30 2021-02-12 深圳壹账通智能科技有限公司 Double-pointer-based sliding window current limiting method, device, equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090130984A1 (en) * 2006-10-20 2009-05-21 Samsung Electronics Co., Ltd. Apparatus and method for intercepting packet data in mobile communication system
US20180287972A1 (en) * 2017-03-31 2018-10-04 Bmc Software, Inc. Systems and methods for intercepting access to messaging systems
CN110808877A (en) * 2019-10-30 2020-02-18 深圳前海环融联易信息科技服务有限公司 Statistical analysis method and device based on interface response duration and computer equipment
CN111224939A (en) * 2019-11-15 2020-06-02 上海钧正网络科技有限公司 Task request intercepting method and device, computer equipment and storage medium
CN112202682A (en) * 2020-09-27 2021-01-08 平安国际智慧城市科技股份有限公司 Interface flow control method and device, computer equipment and storage medium
CN112367269A (en) * 2020-10-30 2021-02-12 深圳壹账通智能科技有限公司 Double-pointer-based sliding window current limiting method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN113316125B (en) 2022-08-16

Similar Documents

Publication Publication Date Title
US11960485B2 (en) User interface for event data store
US10983961B2 (en) De-duplicating distributed file system using cloud-based object store
US11360957B2 (en) Searchable investigation history for event data store
US20150288711A1 (en) Network analysis apparatus and method
US11805151B2 (en) Low-latency, outbound message monitoring, control, and authentication
KR20110027688A (en) Method and system of using a local hosted cache and cryptographic hash functions to reduce network traffic
CN111522703B (en) Method, apparatus and computer program product for monitoring access requests
WO2018233630A1 (en) Fault discovery
US11556400B2 (en) Handling large messages via pointer and log
CN113660275B (en) Domain name system request processing method and device, electronic equipment and storage medium
CN111241104A (en) Operation auditing method and device, electronic equipment and computer-readable storage medium
CN111666205A (en) Data auditing method, system, computer equipment and storage medium
WO2017174013A1 (en) Data storage management method and apparatus, and data storage system
CN112052227A (en) Data change log processing method and device and electronic equipment
CN113316125B (en) Monitoring method, distributed vehicle-mounted system, vehicle and readable storage medium
CN113778709B (en) Interface calling method, device, server and storage medium
US9852031B2 (en) Computer system and method of identifying a failure
CN112835863A (en) Processing method and processing device of operation log
US10848559B2 (en) Malware scan status determination for network-attached storage systems
CN114969450B (en) User behavior analysis method, device, equipment and storage medium
CN112347066B (en) Log processing method and device, server and computer readable storage medium
US11973793B2 (en) Bifurcating security event processing
US11340811B2 (en) Determining reclaim information for a storage block based on data length and matching write and delete parameters
US20220086149A1 (en) Method, electronic device and computer program product for storage management
CN117640754A (en) Request processing method, device, equipment 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