CN110673973B - Exception determination method and device for application programming interface API - Google Patents
Exception determination method and device for application programming interface API Download PDFInfo
- Publication number
- CN110673973B CN110673973B CN201910927838.8A CN201910927838A CN110673973B CN 110673973 B CN110673973 B CN 110673973B CN 201910927838 A CN201910927838 A CN 201910927838A CN 110673973 B CN110673973 B CN 110673973B
- Authority
- CN
- China
- Prior art keywords
- request data
- api
- current
- acquisition period
- period
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/008—Reliability or availability analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/34—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
- G06F11/3452—Performance evaluation by statistical analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/34—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
- G06F11/3466—Performance evaluation by tracing or monitoring
- G06F11/3476—Data logging
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Life Sciences & Earth Sciences (AREA)
- Bioinformatics & Computational Biology (AREA)
- Evolutionary Biology (AREA)
- Probability & Statistics with Applications (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Debugging And Monitoring (AREA)
Abstract
本发明提供一种应用程序编程接口API的异常确定方法和装置。该方法包括:从日志系统中获取云平台的各个API的当前请求数据,所述请求数据用于表示对应API被请求调用的次数;从数据库中获取所述各个API的历史请求数据;根据所述当前请求数据和所述历史请求数据,确定对应API是否异常。和现有技术中直接将各个API被调用的次数作为异常分析的依据相比,提高了准确度。
The present invention provides an application programming interface API exception determination method and device. The method includes: obtaining the current request data of each API of the cloud platform from the log system, the request data being used to represent the number of times the corresponding API has been requested to be called; obtaining the historical request data of each API from the database; according to the The current request data and the historical request data are used to determine whether the corresponding API is abnormal. Compared with the existing technology that directly uses the number of times each API is called as the basis for abnormal analysis, the accuracy is improved.
Description
技术领域Technical field
本发明涉及云平台技术,尤其涉及一种应用程序编程接口API的异常确定方法和装置。The present invention relates to cloud platform technology, and in particular to an application programming interface API exception determination method and device.
背景技术Background technique
随着云技术的发展,云产品日趋多样化,目前的云产品涉及到的种类有云计算、云空间和云平台。云平台相较传统服务器来说,具有稳定性较高、更安全可靠、存储更方便以及更容易协作和共享等优点。云平台提供的线上业务的可用性本质上体现在每一个细分的应用程序编程接口(Application Programming Interface,简称API)的可用性上,因此API监控对于线上业务是否正常运行起着非常重要的判断作用,通过API监控可以快速发现线上业务问题,从而给线上业务问题解决提供宝贵时间。With the development of cloud technology, cloud products are becoming increasingly diversified. Current cloud products include cloud computing, cloud space and cloud platform. Compared with traditional servers, cloud platforms have the advantages of higher stability, more security and reliability, more convenient storage, and easier collaboration and sharing. The availability of online services provided by cloud platforms is essentially reflected in the availability of each segmented Application Programming Interface (API). Therefore, API monitoring plays a very important role in determining whether online services are running normally. Function, API monitoring can quickly detect online business problems, thereby providing valuable time to solve online business problems.
目前,在得到一段时间内云平台的每个API被调用的次数后,业务人员多数是直接将各个API被调用的次数作为判断对应API是否异常的依据,然而,这种方法得到的结果并不准确。At present, after obtaining the number of times each API of the cloud platform has been called within a period of time, most business personnel directly use the number of times each API is called as the basis for judging whether the corresponding API is abnormal. However, the results obtained by this method are not precise.
发明内容Contents of the invention
本发明提供一种API的异常确定方法和装置,用以解决现有技术API异常判断准确度不高的问题。The present invention provides an API abnormality determination method and device to solve the problem of low accuracy of API abnormality determination in the prior art.
第一方面,本发明提供一种API的异常确定方法,包括:In a first aspect, the present invention provides an API exception determination method, including:
从日志系统中获取云平台的各个API的当前请求数据,所述请求数据用于表示对应API被请求调用的次数;Obtain the current request data of each API of the cloud platform from the log system, where the request data is used to represent the number of times the corresponding API has been requested to be called;
从数据库中获取所述各个API的历史请求数据;Obtain the historical request data of each API from the database;
根据所述当前请求数据和所述历史请求数据,确定对应API是否异常。Determine whether the corresponding API is abnormal based on the current request data and the historical request data.
可选的,所述当前请求数据为当前获取周期内的请求数据,所述历史请求数据包括:所述当前获取周期之前目标获取周期内的请求数据;Optionally, the current request data is request data in the current acquisition cycle, and the historical request data includes: request data in the target acquisition cycle before the current acquisition cycle;
根据所述当前请求数据和所述历史请求数据,确定对应API是否异常,包括:Determine whether the corresponding API is abnormal based on the current request data and the historical request data, including:
根据所述当前获取周期内的请求数据和所述目标获取周期内的请求数据,确定所述目标获取周期对应的计数值;Determine the count value corresponding to the target acquisition cycle according to the request data in the current acquisition cycle and the request data in the target acquisition cycle;
根据所述计数值,确定对应API是否异常。According to the count value, it is determined whether the corresponding API is abnormal.
可选的,所述目标获取周期包括:当前获取周期的前一个获取周期、前一天与所述当前获取周期对应的获取周期以及前一周与所述当前获取周期对应的获取周期;Optionally, the target acquisition cycle includes: the acquisition cycle before the current acquisition cycle, the acquisition cycle corresponding to the current acquisition cycle the previous day, and the acquisition cycle corresponding to the current acquisition cycle one week ago;
相应的,所述目标获取周期内的请求数据包括:所述前一个获取周期内的第一请求数据、所述前一天与所述当前获取周期对应的获取周期内的第二请求数据以及所述前一周与所述当前获取周期对应的获取周期内的第三请求数据;Correspondingly, the request data within the target acquisition cycle includes: the first request data within the previous acquisition cycle, the second request data within the acquisition cycle corresponding to the current acquisition cycle the day before, and the The third request data in the acquisition cycle corresponding to the current acquisition cycle in the previous week;
相应的,所述根据所述当前获取周期内的请求数据和所述目标获取周期内的请求数据,确定所述目标获取周期对应的计数值,包括:Correspondingly, determining the count value corresponding to the target acquisition period based on the request data in the current acquisition period and the request data in the target acquisition period includes:
根据所述当前获取周期内的请求数据和所述第一请求数据,确定所述前一个获取周期所对应的第一计数值;Determine the first count value corresponding to the previous acquisition cycle according to the request data in the current acquisition cycle and the first request data;
根据所述当前获取周期内的请求数据和所述第二请求数据,确定前一天与所述当前获取周期对应的获取周期所对应的第二计数值;According to the request data in the current acquisition cycle and the second request data, determine the second count value corresponding to the acquisition cycle corresponding to the current acquisition cycle on the previous day;
根据所述当前获取周期内的请求数据和所述第三请求数据,确定前一周与所述当前获取周期对应的获取周期所对应的第三计数值;According to the request data in the current acquisition cycle and the third request data, determine the third count value corresponding to the acquisition cycle corresponding to the current acquisition cycle in the previous week;
相应的,所述根据所述计数值,确定对应API是否异常,包括:Correspondingly, determining whether the corresponding API is abnormal based on the count value includes:
计算所述第一计数值、所述第二计数值和所述第三计数值的和值;Calculate the sum of the first count value, the second count value and the third count value;
根据所述和值,确定对应API是否异常。Based on the sum value, determine whether the corresponding API is abnormal.
可选的,所述当前请求数据为预设时间段内的请求数据,所述历史请求数据包括:目标日期中所述预设时间段内的目标请求数据;Optionally, the current request data is request data within a preset time period, and the historical request data includes: target request data within the preset time period on the target date;
所述根据所述当前请求数据和所述历史请求数据,确定对应API是否异常,包括:Determining whether the corresponding API is abnormal based on the current request data and the historical request data includes:
根据所述预设时间段内的请求数据,确定各API的当前排名;Determine the current ranking of each API based on the request data within the preset time period;
根据所述目标请求数据,确定各API的历史排名;Determine the historical ranking of each API based on the target request data;
根据所述当前排名和所述历史排名,确定各API的排名变化;Determine the ranking changes of each API based on the current ranking and the historical ranking;
根据各API的排名变化,确定对应API是否异常。Based on the ranking changes of each API, determine whether the corresponding API is abnormal.
可选的,上述方法,还包括:Optionally, the above methods also include:
通过配置中心显示各API的当前排名以及所述各API的排名变化。The current ranking of each API and the ranking changes of each API are displayed through the configuration center.
可选的,所述从日志系统中获取云平台的各个API的当前请求数据,包括:Optionally, obtaining the current request data of each API of the cloud platform from the log system includes:
从所述日志系统中获取云平台的各个API的原始请求数据;Obtain the original request data of each API of the cloud platform from the log system;
对所述原始请求数据进行聚合和清洗,得到各个API的当前请求数据。The original request data is aggregated and cleaned to obtain the current request data of each API.
可选的,上述方法,还包括:Optionally, the above methods also include:
将各个API的当前请求数据持久化到对应的数据库中。Persist the current request data of each API to the corresponding database.
第二方面,本发明提供一种API的异常确定装置,包括:In a second aspect, the present invention provides an API exception determination device, including:
获取模块,用于从日志系统中获取云平台的各个API的当前请求数据,所述请求数据用于表示对应API被请求调用的次数;The acquisition module is used to obtain the current request data of each API of the cloud platform from the log system, and the request data is used to represent the number of times the corresponding API has been requested to be called;
所述获取模块,还用于从数据库中获取所述各个API的历史请求数据;The acquisition module is also used to obtain the historical request data of each API from the database;
确定模块,用于根据所述当前请求数据和所述历史请求数据,确定对应API是否异常。A determination module, configured to determine whether the corresponding API is abnormal based on the current request data and the historical request data.
可选的,所述当前请求数据为当前获取周期内的请求数据,所述历史请求数据包括:所述当前获取周期之前目标获取周期内的请求数据;Optionally, the current request data is request data in the current acquisition cycle, and the historical request data includes: request data in the target acquisition cycle before the current acquisition cycle;
相应的,所述确定模块,具体用于:Correspondingly, the determination module is specifically used for:
根据所述当前获取周期内的请求数据和所述目标获取周期内的请求数据,确定所述目标获取周期对应的计数值;Determine the count value corresponding to the target acquisition cycle according to the request data in the current acquisition cycle and the request data in the target acquisition cycle;
根据所述计数值,确定对应API是否异常。According to the count value, it is determined whether the corresponding API is abnormal.
可选的,所述目标获取周期包括:当前获取周期的前一个获取周期、前一天与所述当前获取周期对应的获取周期以及前一周与所述当前获取周期对应的获取周期;Optionally, the target acquisition cycle includes: the acquisition cycle before the current acquisition cycle, the acquisition cycle corresponding to the current acquisition cycle the previous day, and the acquisition cycle corresponding to the current acquisition cycle one week ago;
相应的,所述目标获取周期内的请求数据包括:所述前一个获取周期内的第一请求数据、所述前一天与所述当前获取周期对应的获取周期内的第二请求数据以及所述前一周与所述当前获取周期对应的获取周期内的第三请求数据;Correspondingly, the request data within the target acquisition cycle includes: the first request data within the previous acquisition cycle, the second request data within the acquisition cycle corresponding to the current acquisition cycle the day before, and the The third request data in the acquisition cycle corresponding to the current acquisition cycle in the previous week;
相应的,所述确定模块,具体用于:Correspondingly, the determination module is specifically used for:
根据所述当前获取周期内的请求数据和所述第一请求数据,确定所述前一个获取周期所对应的第一计数值;Determine the first count value corresponding to the previous acquisition cycle according to the request data in the current acquisition cycle and the first request data;
根据所述当前获取周期内的请求数据和所述第二请求数据,确定前一天与所述当前获取周期对应的获取周期所对应的第二计数值;According to the request data in the current acquisition cycle and the second request data, determine the second count value corresponding to the acquisition cycle corresponding to the current acquisition cycle on the previous day;
根据所述当前获取周期内的请求数据和所述第三请求数据,确定前一周与所述当前获取周期对应的获取周期所对应的第三计数值;According to the request data in the current acquisition cycle and the third request data, determine the third count value corresponding to the acquisition cycle corresponding to the current acquisition cycle in the previous week;
计算所述第一计数值、所述第二计数值和所述第三计数值的和值;Calculate the sum of the first count value, the second count value and the third count value;
根据所述和值,确定对应API是否异常。Based on the sum value, determine whether the corresponding API is abnormal.
可选的,所述当前请求数据为预设时间段内的请求数据,所述历史请求数据包括:目标日期中所述预设时间段内的目标请求数据;Optionally, the current request data is request data within a preset time period, and the historical request data includes: target request data within the preset time period on the target date;
相应的,所述确定模块,具体用于:Correspondingly, the determination module is specifically used for:
根据所述预设时间段内的请求数据,确定各API的当前排名;Determine the current ranking of each API based on the request data within the preset time period;
根据所述目标请求数据,确定各API的历史排名;Determine the historical ranking of each API based on the target request data;
根据所述当前排名和所述历史排名,确定各API的排名变化;Determine the ranking changes of each API based on the current ranking and the historical ranking;
根据各API的排名变化,确定对应API是否异常。Based on the ranking changes of each API, determine whether the corresponding API is abnormal.
可选的,上述装置,还包括:Optional, the above devices also include:
显示模块,用于通过配置中心显示各API的当前排名以及所述各API的排名变化。The display module is used to display the current ranking of each API and the ranking changes of each API through the configuration center.
可选的,所述获取模块具体用于:Optionally, the acquisition module is specifically used for:
从所述日志系统中获取云平台的各个API的原始请求数据;Obtain the original request data of each API of the cloud platform from the log system;
对所述原始请求数据进行聚合和清洗,得到各个API的当前请求数据。The original request data is aggregated and cleaned to obtain the current request data of each API.
可选的,上述装置,还包括:Optional, the above devices also include:
持久化模块,用于将各个API的当前请求数据持久化到对应的数据库中。The persistence module is used to persist the current request data of each API to the corresponding database.
第三方面,本发明提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述API的异常确定方法。In a third aspect, the present invention provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the above-mentioned API exception determination method is implemented.
第四方面,本发明提供一种服务器,包括:In a fourth aspect, the present invention provides a server, including:
处理器;以及processor; and
存储器,用于存储所述处理器的可执行指令;memory for storing executable instructions for the processor;
其中,所述处理器配置为经由执行所述可执行指令来实现上述API的异常确定方法。Wherein, the processor is configured to implement the exception determination method of the above-mentioned API by executing the executable instructions.
本发明提供的API的异常确定方法和装置,首先从日志系统中获取云平台的各个API的当前请求数据,所述请求数据用于表示对应API被请求调用的次数;然后,从数据库中获取所述各个API的历史请求数据;最后,根据所述当前请求数据和所述历史请求数据,确定对应API是否异常。和现有技术中直接将各个API被调用的次数作为异常分析的依据相比,提高了准确度。The API exception determination method and device provided by the present invention first obtain the current request data of each API of the cloud platform from the log system. The request data is used to represent the number of times the corresponding API has been requested to be called; then, obtain all the request data from the database. The historical request data of each API is described; finally, based on the current request data and the historical request data, it is determined whether the corresponding API is abnormal. Compared with the existing technology that directly uses the number of times each API is called as the basis for abnormal analysis, the accuracy is improved.
附图说明Description of the drawings
图1为本发明提供的API的异常确定方法的一种可选的应用场景图;Figure 1 is an optional application scenario diagram of the API exception determination method provided by the present invention;
图2为本发明提供的API的异常确定方法的实施例一的流程示意图;Figure 2 is a schematic flow chart of Embodiment 1 of the API exception determination method provided by the present invention;
图3为本发明提供的API的异常确定方法的实施例二的流程示意图;Figure 3 is a schematic flow chart of Embodiment 2 of the API exception determination method provided by the present invention;
图4为本发明提供的异常API的定位方法的实施例三的流程示意图;Figure 4 is a schematic flow chart of Embodiment 3 of the abnormal API locating method provided by the present invention;
图5为本发明提供的API的异常确定装置的结构示意图;Figure 5 is a schematic structural diagram of an API exception determination device provided by the present invention;
图6为本发明提供的服务器的硬件结构示意图。Figure 6 is a schematic diagram of the hardware structure of the server provided by the present invention.
具体实施方式Detailed ways
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments These are some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without making creative efforts fall within the scope of protection of the present invention.
此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, e.g., a process, method, system, product, or apparatus that encompasses a series of steps or units and need not be limited to those explicitly listed. Those steps or elements may instead include other steps or elements not expressly listed or inherent to the process, method, product or apparatus.
云平台提供的线上业务的可用性本质上体现在每一个细分的API的可用性上,如果云平台上有API出现异常,则可能导致相关的业务无法正常运行。现有技术中,通过API监控得到一段时间内云平台的各个API被调用的次数后,直接将各个API被调用的次数作为判断对应API是否异常的依据,然而这样得到的结果并不准确。The availability of online services provided by the cloud platform is essentially reflected in the availability of each segmented API. If an API on the cloud platform is abnormal, it may cause the related business to fail to operate normally. In the existing technology, after obtaining the number of times each API of the cloud platform is called within a period of time through API monitoring, the number of times each API is called is directly used as a basis for judging whether the corresponding API is abnormal. However, the results obtained in this way are not accurate.
基于现有技术存在的上述技术问题,本发明提供了一种应用程序编程接口API的异常确定方法和装置。首先从日志系统中获取云平台的各个API的当前请求数据,所述请求数据用于表示对应API被请求调用的次数;然后,从数据库中获取所述各个API的历史请求数据;最后,根据所述当前请求数据和所述历史请求数据,确定对应API是否异常。和现有技术中业务人员直接将各个API被调用的次数作为异常分析的依据相比,提高了准确度。Based on the above technical problems existing in the prior art, the present invention provides an application programming interface API exception determination method and device. First, the current request data of each API of the cloud platform is obtained from the log system. The request data is used to represent the number of times the corresponding API has been requested to be called; then, the historical request data of each API is obtained from the database; finally, according to the requested Describe the current request data and the historical request data to determine whether the corresponding API is abnormal. Compared with the existing technology where business personnel directly use the number of times each API is called as the basis for abnormal analysis, the accuracy is improved.
图1为本发明提供的API的异常确定方法的一种可选的应用场景图。图1所示的应用场景图涉及到的模块有:日志系统、接口监控模块、监控系统和数据库。可选的,这几个模块可以通过有线或者无线技术连接,本发明对此不作限定。Figure 1 is an optional application scenario diagram of the API exception determination method provided by the present invention. The application scenario diagram shown in Figure 1 involves modules: log system, interface monitoring module, monitoring system and database. Optionally, these modules can be connected through wired or wireless technology, which is not limited by the present invention.
其中,接口监控模块和监控系统可用于执行本发明的方案,接口监控模块可以是一个独立的模块,也可以是属于监控系统的一个模块,图1以监控模块为一个独立的模块进行示意。以下实施例均以接口监控模块是一个独立的模块对本发明的方案进行描述。Among them, the interface monitoring module and the monitoring system can be used to implement the solution of the present invention. The interface monitoring module can be an independent module or a module belonging to the monitoring system. Figure 1 illustrates the monitoring module as an independent module. The following embodiments describe the solution of the present invention with the interface monitoring module being an independent module.
其中,日志系统可用于记录云平台发生的事件。每个API被调用时,会产生一个事件记录在日志系统中。接口监控模块可从日志系统中获取某段时间内各个API被调用的次数,即各个API在这段时间内的请求数据。Among them, the log system can be used to record events that occur on the cloud platform. When each API is called, an event will be generated and recorded in the log system. The interface monitoring module can obtain the number of times each API is called within a certain period of time from the log system, that is, the request data of each API during this period of time.
其中,数据库可以包括时序数据库和关系型数据库管理系统。数据库中存储有云平台各个API的历史请求数据。接口监控模块可从数据库中获取各个API的历史请求数据。Among them, the database can include time series database and relational database management system. The database stores historical request data for each API of the cloud platform. The interface monitoring module can obtain historical request data of each API from the database.
下面以具体地实施例对本发明的技术方案以及本申请的技术方案如何解决上述技术问题进行详细说明。下面这几个具体的实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例中不再赘述。下面将结合附图,对本发明的实施例进行描述。The technical solution of the present invention and how the technical solution of the present application solves the above technical problems will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of the present invention will be described below with reference to the accompanying drawings.
图2为本发明提供的API的异常确定方法的实施例一的流程示意图。本实施例提供的API的异常确定方法可由图1所示接口监控模块和监控系统来执行。如图2所示,本实施例提供的API的异常确定方法,包括:FIG. 2 is a schematic flowchart of Embodiment 1 of the API exception determination method provided by the present invention. The API exception determination method provided in this embodiment can be executed by the interface monitoring module and monitoring system shown in Figure 1 . As shown in Figure 2, the API exception determination method provided by this embodiment includes:
S201、从日志系统中获取云平台的各个API的当前请求数据,所述请求数据用于表示对应API被请求调用的次数。S201. Obtain the current request data of each API of the cloud platform from the log system. The request data is used to represent the number of times the corresponding API is requested to be called.
下面分两种场景来说明上述当前请求数据的含义:The following are two scenarios to illustrate the meaning of the above current request data:
场景一,接口监控模块周期性地从日志系统中获取各个API的请求数据。这种场景下,当前获取周期内的请求数据即为上述当前请求数据。Scenario 1: The interface monitoring module periodically obtains the request data of each API from the log system. In this scenario, the request data within the current acquisition cycle is the current request data mentioned above.
比如:接口监控模块可每隔10分钟从日志系统中获取一次各个API的请求数据,这种场景下,接口监控模块从日志系统中获取到的过去10分钟内各个API的请求数据即为上述当前请求数据。For example: the interface monitoring module can obtain the request data of each API from the log system every 10 minutes. In this scenario, the request data of each API in the past 10 minutes obtained by the interface monitoring module from the log system is the current Request data.
其中,请求数据的含义是对应API被请求调用的次数,在上例中,各个API在过去10分钟内的请求数据则表示的是过去10分钟内各个API被请求调用的次数。Among them, the meaning of the request data is the number of times the corresponding API has been requested and called. In the above example, the request data of each API in the past 10 minutes represents the number of times each API has been requested and called in the past 10 minutes.
场景二,接口监控模块可定时从日志系统中获取各个API的请求数据。这种场景下,预设时间段内的请求数据即为上述当前请求数据。预设时间段可以是云平台使用高峰期对应的时间段。Scenario 2: The interface monitoring module can regularly obtain the request data of each API from the log system. In this scenario, the request data within the preset time period is the current request data mentioned above. The preset time period may be a time period corresponding to the peak usage period of the cloud platform.
比如:接口监控模块可每天20:00定时从日志系统中获取过去30分钟内各个API的请求数据。这种场景下,接口监控模块本日20:00从日志系统中获取到的过去30分钟内各个API的请求数据即为各个API的当前请求数据。For example: the interface monitoring module can regularly obtain the request data of each API in the past 30 minutes from the log system at 20:00 every day. In this scenario, the request data of each API in the past 30 minutes obtained by the interface monitoring module from the log system at 20:00 today is the current request data of each API.
同上,请求数据的含义是对应API被请求调用的次数,那么在上例中,各个API在本日20:00开始30分钟内的请求数据表示的是该30分钟内各个API被请求调用的次数。As above, the meaning of the request data is the number of times the corresponding API has been requested and called. In the above example, the request data for each API within 30 minutes starting from 20:00 today represents the number of times each API has been requested and called within the 30 minutes.
可选的,从日志系统中获取到云平台的各个API的原始请求数据后,可对该原始请求数据进行聚合和清洗,从而得到各个API的当前请求数据。Optionally, after obtaining the original request data of each API of the cloud platform from the log system, the original request data can be aggregated and cleaned to obtain the current request data of each API.
上述聚合操作的实现方式为,将云平台的所有API中功能相同的API的请求数据合并为一个请求数据。上述功能相同的API视为一个API,合并后的请求数据为该API的请求数据。The above aggregation operation is implemented by merging the request data of APIs with the same function among all APIs of the cloud platform into one request data. The above APIs with the same functions are regarded as one API, and the combined request data is the request data of the API.
上述清洗的实现方式为,将所有API中与预设匹配规则无法匹配成功的API做舍弃处理。The above cleaning is implemented by discarding all APIs that cannot successfully match the preset matching rules.
S202、从数据库中获取所述各个API的历史请求数据。S202. Obtain the historical request data of each API from the database.
参见S101,在场景一的情况下,接口监控模块从数据库中需获取的历史请求数据是:当前获取周期之前目标获取周期内的请求数据。比如:目标周期可以是当前获取周期的前一个获取周期、前一天与所述当前获取周期对应的获取周期以及前一周与所述当前获取周期对应的获取周期等。Refer to S101. In scenario 1, the historical request data that the interface monitoring module needs to obtain from the database is: the request data in the target acquisition cycle before the current acquisition cycle. For example, the target cycle may be the acquisition cycle before the current acquisition cycle, the acquisition cycle corresponding to the current acquisition cycle the previous day, the acquisition cycle corresponding to the current acquisition cycle one week ago, etc.
参见A101对应的例子,假设获取周期为10分钟,那么接口监控模块从数据库中获取的各个API的历史请求数据可以为前一个10分钟、昨天同时间段的10分钟或者前一周同时间段的10分钟等。See the example corresponding to A101. Assume that the acquisition cycle is 10 minutes. Then the historical request data of each API obtained by the interface monitoring module from the database can be the previous 10 minutes, the 10 minutes of the same time period yesterday, or the 10 minutes of the same time period last week. Minutes to wait.
参见S101,在场景二的情况下,接口监控模块从数据库中需获取的历史请求数据是目标日期中所述预设时间段内的目标请求数据。比如:昨天同一预设时间段内的请求数据、前一周同一预设时间段内的请求数据以及前两周同一预设时间段内的请求数据等。Referring to S101, in scenario two, the historical request data that the interface monitoring module needs to obtain from the database is the target request data within the preset time period in the target date. For example: request data in the same preset time period yesterday, request data in the same preset time period in the previous week, request data in the same preset time period in the previous two weeks, etc.
参见A101对应的例子,假设预设时间段为20:00开始30分钟内,那么接口监控模块从数据库中获取的各个API的历史请求数据可以为昨天20:00-20:30,前一周20:00-20:30以及前两周20:00-20:30等。See the example corresponding to A101. Assume that the preset time period is within 30 minutes starting from 20:00, then the historical request data of each API obtained by the interface monitoring module from the database can be 20:00-20:30 yesterday, and 20:00 the previous week. 00-20:30 and 20:00-20:30 in the first two weeks, etc.
S203、根据所述当前请求数据和所述历史请求数据,确定对应API是否异常。S203. Determine whether the corresponding API is abnormal based on the current request data and the historical request data.
可选的,在S101获取到当前请求数据以及S102获取到历史请求数据的基础上,可通过异常检测算法等方式对各个API进行检测,以确定对应API是否异常,方便了运维人员对接口流控能力进行维护。Optionally, based on the current request data obtained by S101 and the historical request data obtained by S102, each API can be detected through anomaly detection algorithms and other methods to determine whether the corresponding API is abnormal, which facilitates operation and maintenance personnel to understand the interface flow. Ability to maintain control.
本实施例提供的API的异常确定方法,首先从日志系统中获取云平台的各个API的当前请求数据,所述请求数据用于表示对应API被请求调用的次数;然后,从数据库中获取所述各个API的历史请求数据;最后,根据所述当前请求数据和所述历史请求数据,确定对应API是否异常。和现有技术中直接将各个API被调用的次数作为异常分析的依据相比,提高了准确度。The API exception determination method provided in this embodiment first obtains the current request data of each API of the cloud platform from the log system. The request data is used to represent the number of times the corresponding API has been requested to be called; then, the request data is obtained from the database. Historical request data of each API; finally, determine whether the corresponding API is abnormal based on the current request data and the historical request data. Compared with the existing technology that directly uses the number of times each API is called as the basis for abnormal analysis, the accuracy is improved.
图3为本发明提供的API的异常确定方法的实施例二的流程示意图。本实施例将对上述实施例中场景一的情况下,确定对应API是否异常的实现方式进行说明。如图3所示,本实施例提供的API的异常确定方法,包括:FIG. 3 is a schematic flowchart of Embodiment 2 of the API exception determination method provided by the present invention. This embodiment will describe the implementation method of determining whether the corresponding API is abnormal in the case of scenario 1 in the above embodiment. As shown in Figure 3, the API exception determination method provided by this embodiment includes:
S301、从日志系统中获取云平台的各个API在当前获取周期内的请求数据。S301. Obtain the request data of each API of the cloud platform in the current acquisition cycle from the log system.
可选的,在获取到各个API在当前获取周期内的请求数据,可将其持久化到时序数据库中。Optionally, after obtaining the request data of each API in the current acquisition cycle, it can be persisted to the time series database.
S302、从数据库中获取所述各个API在当前获取周期之前目标获取周期内的请求数据。S302. Obtain the request data of each API in the target acquisition cycle before the current acquisition cycle from the database.
S303、根据所述当前获取周期内的请求数据和所述目标获取周期内的请求数据,确定所述目标获取周期对应的计数值。S303. Determine the count value corresponding to the target acquisition cycle based on the request data in the current acquisition cycle and the request data in the target acquisition cycle.
下面,以目标获取周期包括:当前获取周期的前一个获取周期、前一天与所述当前获取周期对应的获取周期以及前一周与所述当前获取周期对应的获取周期为例对本实施例的方案进行说明。In the following, the solution of this embodiment will be described by taking the target acquisition cycle including: the acquisition cycle before the current acquisition cycle, the acquisition cycle corresponding to the current acquisition cycle the previous day, and the acquisition cycle corresponding to the current acquisition cycle one week ago as an example. illustrate.
在目标获取周期包括上述三个获取周期的情况下,目标获取周期内的请求数据包括:所述前一个获取周期内的第一请求数据、所述前一天与所述当前获取周期对应的获取周期内的第二请求数据以及所述前一周与所述当前获取周期对应的获取周期内的第三请求数据。In the case where the target acquisition cycle includes the above three acquisition cycles, the request data within the target acquisition cycle includes: the first request data in the previous acquisition cycle, the acquisition cycle corresponding to the current acquisition cycle on the previous day The second request data within the previous week and the third request data within the acquisition cycle corresponding to the current acquisition cycle.
为方便描述,将当前获取周期的请求数据记为QPS_CURRENT,第一请求数据记为QPS_LASTSTEP,第二请求数据记为QPS_LASTDAY,第三请求数据记为QPS_LASTWEEK。For convenience of description, the request data of the current acquisition cycle is recorded as QPS_CURRENT, the first request data is recorded as QPS_LASTSTEP, the second request data is recorded as QPS_LASTDAY, and the third request data is recorded as QPS_LASTWEEK.
则S303具体包括如下步骤:Then S303 specifically includes the following steps:
步骤A:根据所述当前获取周期内的请求数据和所述第一请求数据,确定所述前一个获取周期所对应的第一计数值。Step A: Determine the first count value corresponding to the previous acquisition cycle based on the request data in the current acquisition cycle and the first request data.
具体的,若(QPS_CURRENT-QPS_LASTSTEP)/QPS_LASTSTEP>1或者<-1,说明当前获取周期和前一个获取周期相比变化幅度超过一倍,认为当前获取周期和前一个获取周期相比,对应API存在异常,可确定第一计数值为1。Specifically, if (QPS_CURRENT-QPS_LASTSTEP)/QPS_LASTSTEP>1 or <-1, it means that the current acquisition cycle has changed more than double compared with the previous acquisition cycle. It is considered that compared with the previous acquisition cycle, the corresponding API exists. Abnormal, it can be determined that the first count value is 1.
步骤B、根据所述当前获取周期内的请求数据和所述第二请求数据,确定前一天与所述当前获取周期对应的获取周期所对应的第二计数值。Step B: Determine the second count value corresponding to the acquisition cycle corresponding to the current acquisition cycle on the previous day based on the request data and the second request data in the current acquisition cycle.
具体的,若(QPS_CURRENT-QPS_LASTDAY)/QPS_LASTDAY>1或者<-1,说明当前获取周期和前一天与所述当前获取周期对应的获取周期相比变化幅度超过一倍,认为当前获取周期和前一天与所述当前获取周期对应的获取周期相比,对应API存在异常,可确定第二计数值为10。Specifically, if (QPS_CURRENT-QPS_LASTDAY)/QPS_LASTDAY>1 or <-1, it means that the current acquisition period and the previous day have changed more than double compared to the acquisition period corresponding to the current acquisition period, and it is considered that the current acquisition period and the previous day have changed Compared with the acquisition cycle corresponding to the current acquisition cycle, there is an abnormality in the corresponding API, and it can be determined that the second count value is 10.
步骤C、根据所述当前获取周期内的请求数据和所述第三请求数据,确定前一周与所述当前获取周期对应的获取周期所对应的第三计数值。Step C: Determine the third count value corresponding to the acquisition cycle corresponding to the current acquisition cycle in the previous week based on the request data in the current acquisition cycle and the third request data.
具体的,若(QPS_CURRENT-QPS_LASTWEEK)/QPS_LASTWEEK>1或者<-1,说明当前获取周期和前一周与所述当前获取周期对应的获取周期相比变化幅度超过一倍,认为当前获取周期和前一周与所述当前获取周期对应的获取周期相比,对应API存在异常,则可确定第三计数值为100。Specifically, if (QPS_CURRENT-QPS_LASTWEEK)/QPS_LASTWEEK>1 or <-1, it means that the current acquisition period and the previous week have changed by more than double the acquisition period corresponding to the current acquisition period, and it is considered that the current acquisition period and the previous week have changed Compared with the acquisition cycle corresponding to the current acquisition cycle, if there is an abnormality in the corresponding API, it can be determined that the third count value is 100.
S304、根据所述计数值,确定对应API是否异常。S304. Determine whether the corresponding API is abnormal according to the count value.
具体的,在上述步骤A-步骤C得到第一计数值、第二计数值和第三计数值的情况下,通过下面的步骤确定对应API是否异常。Specifically, when the first count value, the second count value and the third count value are obtained from the above steps A to C, the following steps are used to determine whether the corresponding API is abnormal.
步骤D、计算所述第一计数值、所述第二计数值和所述第三计数值的和值。Step D. Calculate the sum of the first count value, the second count value and the third count value.
步骤E、根据所述和值,确定对应API是否存在异常。Step E: Determine whether there is an exception in the corresponding API based on the sum value.
继续参见上述步骤A-步骤C,第一计数值、第二计数值和第三计数值的和值的个位、十位以及百位是否为1表征了与对应获取周期相比API是否存在异常。举例来说,如果计算得到的和值为0,则说明对应API不存在异常;如果计算得到的和值为111,则说明与前一个获取周期、前一天与所述当前获取周期对应的获取周期以及前一周与所述当前获取周期对应的获取周期相比,对应的API均存在异常;如果计算得到的和值为110,则说明与前一天与所述当前获取周期对应的获取周期,前一周与所述当前获取周期对应的获取周期相比,对应的API均存在异常,与前一个获取周期相比,不存在异常;如果计算得到的和值为101,则说明对应的API与前一个获取周期以及前一周与所述当前获取周期对应的获取周期相比,对应的API均存在异常,与前一天与所述当前获取周期对应的获取周期相比,不存在异常。Continue to refer to the above steps A to C. Whether the ones, tens and hundreds digits of the sum of the first count value, the second count value and the third count value are 1 indicates whether there is an abnormality in the API compared with the corresponding acquisition cycle. . For example, if the calculated sum value is 0, it means that there is no exception in the corresponding API; if the calculated sum value is 111, it means that the acquisition cycle corresponds to the previous acquisition cycle, the previous day and the current acquisition cycle. And compared with the acquisition cycle corresponding to the current acquisition cycle in the previous week, the corresponding API has abnormalities; if the calculated sum value is 110, it means that the acquisition cycle corresponding to the current acquisition cycle in the previous day, the previous week Compared with the acquisition cycle corresponding to the current acquisition cycle, the corresponding API has abnormalities, and compared with the previous acquisition cycle, there is no exception; if the calculated sum value is 101, it means that the corresponding API is different from the previous acquisition cycle. Compared with the acquisition cycle corresponding to the current acquisition cycle and the previous week, there are abnormalities in the corresponding API. Compared with the acquisition cycle corresponding to the current acquisition cycle the previous day, there is no abnormality.
可选的,在得到上述计数值得和值后,可将上述和值上报给监控系统,监控系统进一步配置告警策略,并将告警信息发送至业务人员的终端。Optionally, after obtaining the above-mentioned count value sum, the above-mentioned sum value can be reported to the monitoring system. The monitoring system further configures the alarm policy and sends the alarm information to the terminal of the business personnel.
本实施例提供的API的异常确定方法,描述了当前请求数据为当前获取周期内的请求数据,历史请求数据包括所述当前获取周期之前目标获取周期内的请求数据的情况下,确定对应API是否异常的方案进行了描述,和现有技术中直接将各个API被调用的次数作为确定API是否异常的依据相比,提高了判断结果的准确度。The API exception determination method provided by this embodiment describes that when the current request data is the request data in the current acquisition cycle, and the historical request data includes the request data in the target acquisition cycle before the current acquisition cycle, it is determined whether the corresponding API The abnormal solution is described. Compared with the existing technology that directly uses the number of times each API is called as the basis for determining whether the API is abnormal, the accuracy of the judgment result is improved.
图4为本发明提供的异常API的定位方法的实施例三的流程示意图。本实施例将对上述实施例中场景二的情况下,确定对应API是否异常的实现方式进行说明。如图4所示,本实施例提供的API的异常确定方法,包括:Figure 4 is a schematic flowchart of Embodiment 3 of the abnormal API locating method provided by the present invention. This embodiment will describe the implementation method of determining whether the corresponding API is abnormal in the second scenario in the above embodiment. As shown in Figure 4, the API exception determination method provided by this embodiment includes:
S401、从日志系统中获取云平台的各个API在预设时间段内的请求数据。S401. Obtain the request data of each API of the cloud platform within the preset time period from the log system.
可选的,在获取到各个API在预设时间段内的请求数据,可将其持久化到关系型数据库管理系统中。Optionally, after obtaining the request data of each API within a preset time period, it can be persisted to the relational database management system.
S402、从数据库中获取所述各个API在目标日期中所述预设时间段内的目标请求数据。S402. Obtain the target request data of each API within the preset time period in the target date from the database.
S403、根据所述预设时间段内的请求数据,确定各API的当前排名。S403. Determine the current ranking of each API based on the request data within the preset time period.
S404、根据所述目标请求数据,确定各API的历史排名。S404. Determine the historical ranking of each API based on the target request data.
S405、根据所述当前排名和所述历史排名,确定各API的排名变化。S405. Determine the ranking change of each API based on the current ranking and the historical ranking.
S406、根据各API的排名变化,确定对应API是否异常。S406. Determine whether the corresponding API is abnormal based on the ranking changes of each API.
下面,以S401中的预设时间段为本日20:00-20:30,目标日期包括前一天、一周前以及两周前为例对S403-S406的过程进行说明:Next, take the preset time period in S401 as 20:00-20:30 today, and the target date includes the previous day, one week ago, and two weeks ago as an example to explain the process of S403-S406:
根据本日20:00-20:30内各API的请求数据,确定各API的当前排名,根据前一天20:00-20:30内各API的请求数据,确定各API在前一天的排名,根据一周前20:00-20:30内各API的请求数据,确定各API在一周前的排名,根据两周前20:00-20:30内各API的请求数据,确定各API在两周前的排名。将每个API的当前排名和前一天、一周前以及两周前进行比较,若排名变化幅度均在预设范围内,认为对应API没有异常,若每个API的当前排名和前一天、一周前以及两周前相比,变化幅度均超过预设范围,认为对应API出现了异常。Based on the request data of each API between 20:00-20:30 today, determine the current ranking of each API. Based on the request data of each API between 20:00-20:30 the previous day, determine the ranking of each API on the previous day. The request data of each API between 20:00-20:30 a week ago is used to determine the ranking of each API one week ago. Based on the request data of each API between 20:00-20:30 two weeks ago, the ranking of each API two weeks ago is determined. ranking. Compare the current ranking of each API with the previous day, one week ago, and two weeks ago. If the ranking changes are within the preset range, the corresponding API is considered to be normal. If the current ranking of each API is the same as the previous day, one week ago, Compared with two weeks ago, the change range exceeds the preset range, and it is considered that there is an abnormality in the corresponding API.
需要说明的是:上例中API是否出现异常的分析规则仅是一种示例,本领域技术人员可以根据实际情况设定其他的规则,本发明不以上例为限。It should be noted that the analysis rule for whether an API exception occurs in the above example is only an example. Those skilled in the art can set other rules according to actual conditions. The present invention is not limited to the above example.
可选的,在得到上述当前排名以及排名变化后,可通过配置中心将当前排名和排名变化显示出来,以供业务人员查看。另外,配置中心可配置流控能力的界面化操作,使得业务人员可以对流量异常的API根据该API的流控能力做出相应的操作,为业务运维提供了故障治理的可视化维护能力。Optionally, after obtaining the above-mentioned current ranking and ranking changes, the current ranking and ranking changes can be displayed through the configuration center for business personnel to view. In addition, the configuration center can configure interface operations for flow control capabilities, allowing business personnel to perform corresponding operations on APIs with abnormal traffic based on the API's flow control capabilities, providing visual maintenance capabilities for fault management for business operation and maintenance.
本实施例提供的API的异常确定方法,描述了当前请求数据为预设时间段内的请求数据,历史请求数据包括目标日期中所述预设时间段内的目标请求数据的情况下,确定对应API是否异常的方案进行了描述,和现有技术中直接将各个API被调用的次数作为确定API是否异常的依据相比,提高了判断结果的准确度。The API exception determination method provided by this embodiment describes that the current request data is the request data within the preset time period, and the historical request data includes the target request data within the preset time period in the target date, determine the corresponding A solution for determining whether an API is abnormal is described. Compared with the existing technology that directly uses the number of times each API is called as a basis for determining whether an API is abnormal, the accuracy of the judgment result is improved.
图5为本发明提供的API的异常确定装置的结构示意图。如图5所示,本发明提供的API的异常确定装置,包括:Figure 5 is a schematic structural diagram of an API exception determination device provided by the present invention. As shown in Figure 5, the API exception determination device provided by the present invention includes:
获取模块501,用于从日志系统中获取云平台的各个API的当前请求数据,所述请求数据用于表示对应API被请求调用的次数;The acquisition module 501 is used to obtain the current request data of each API of the cloud platform from the log system, where the request data is used to represent the number of times the corresponding API has been requested to be called;
所述获取模块501,还用于从数据库中获取所述各个API的历史请求数据;The acquisition module 501 is also used to obtain the historical request data of each API from the database;
确定模块502,用于根据所述当前请求数据和所述历史请求数据,确定对应API是否异常。The determination module 502 is used to determine whether the corresponding API is abnormal based on the current request data and the historical request data.
可选的,所述当前请求数据为当前获取周期内的请求数据,所述历史请求数据包括:所述当前获取周期之前目标获取周期内的请求数据;Optionally, the current request data is request data in the current acquisition cycle, and the historical request data includes: request data in the target acquisition cycle before the current acquisition cycle;
相应的,所述确定模块502,具体用于:Correspondingly, the determination module 502 is specifically used to:
根据所述当前获取周期内的请求数据和所述目标获取周期内的请求数据,确定所述目标获取周期对应的计数值;Determine the count value corresponding to the target acquisition cycle according to the request data in the current acquisition cycle and the request data in the target acquisition cycle;
根据所述计数值,确定对应API是否异常。According to the count value, it is determined whether the corresponding API is abnormal.
可选的,所述目标获取周期包括:当前获取周期的前一个获取周期、前一天与所述当前获取周期对应的获取周期以及前一周与所述当前获取周期对应的获取周期;Optionally, the target acquisition cycle includes: the acquisition cycle before the current acquisition cycle, the acquisition cycle corresponding to the current acquisition cycle the previous day, and the acquisition cycle corresponding to the current acquisition cycle one week ago;
相应的,所述目标获取周期内的请求数据包括:所述前一个获取周期内的第一请求数据、所述前一天与所述当前获取周期对应的获取周期内的第二请求数据以及所述前一周与所述当前获取周期对应的获取周期内的第三请求数据;Correspondingly, the request data within the target acquisition cycle includes: the first request data within the previous acquisition cycle, the second request data within the acquisition cycle corresponding to the current acquisition cycle the day before, and the The third request data in the acquisition cycle corresponding to the current acquisition cycle in the previous week;
相应的,所述确定模块502,具体用于:Correspondingly, the determination module 502 is specifically used to:
根据所述当前获取周期内的请求数据和所述第一请求数据,确定所述前一个获取周期所对应的第一计数值;Determine the first count value corresponding to the previous acquisition cycle according to the request data in the current acquisition cycle and the first request data;
根据所述当前获取周期内的请求数据和所述第二请求数据,确定前一天与所述当前获取周期对应的获取周期所对应的第二计数值;According to the request data in the current acquisition cycle and the second request data, determine the second count value corresponding to the acquisition cycle corresponding to the current acquisition cycle on the previous day;
根据所述当前获取周期内的请求数据和所述第三请求数据,确定前一周与所述当前获取周期对应的获取周期所对应的第三计数值;According to the request data in the current acquisition cycle and the third request data, determine the third count value corresponding to the acquisition cycle corresponding to the current acquisition cycle in the previous week;
计算所述第一计数值、所述第二计数值和所述第三计数值的和值;Calculate the sum of the first count value, the second count value and the third count value;
根据所述和值,确定对应API是否异常。Based on the sum value, determine whether the corresponding API is abnormal.
可选的,所述当前请求数据为预设时间段内的请求数据,所述历史请求数据包括:目标日期中所述预设时间段内的目标请求数据;Optionally, the current request data is request data within a preset time period, and the historical request data includes: target request data within the preset time period on the target date;
相应的,所述确定模块502,具体用于:Correspondingly, the determination module 502 is specifically used to:
根据所述预设时间段内的请求数据,确定各API的当前排名;Determine the current ranking of each API based on the request data within the preset time period;
根据所述目标请求数据,确定各API的历史排名;Determine the historical ranking of each API based on the target request data;
根据所述当前排名和所述历史排名,确定各API的排名变化;Determine the ranking changes of each API based on the current ranking and the historical ranking;
根据各API的排名变化,确定对应API是否异常。Based on the ranking changes of each API, determine whether the corresponding API is abnormal.
可选的,上述装置,还包括:Optional, the above devices also include:
显示模块503,用于通过配置中心显示各API的当前排名以及所述各API的排名变化。The display module 503 is used to display the current ranking of each API and the ranking changes of each API through the configuration center.
可选的,所述获取模块501具体用于:Optionally, the acquisition module 501 is specifically used to:
从所述日志系统中获取云平台的各个API的原始请求数据;Obtain the original request data of each API of the cloud platform from the log system;
对所述原始请求数据进行聚合和清洗,得到各个API的当前请求数据。The original request data is aggregated and cleaned to obtain the current request data of each API.
可选的,上述装置,还包括:Optional, the above devices also include:
持久化模块504,用于将各个API的当前请求数据持久化到对应的数据库中。The persistence module 504 is used to persist the current request data of each API into the corresponding database.
本实施例提供的API的异常确定装置,可用于执行上述任一方法实施例中的步骤,其实现原理和技术效果类似,在此不再赘述。The API exception determination device provided in this embodiment can be used to perform the steps in any of the above method embodiments. The implementation principles and technical effects are similar and will not be described again here.
图6为本发明提供的服务器的硬件结构示意图。如图6所示,本实施例的服务器可以包括:Figure 6 is a schematic diagram of the hardware structure of the server provided by the present invention. As shown in Figure 6, the server in this embodiment may include:
存储器601,用于存储程序指令。Memory 601 is used to store program instructions.
处理器602,用于在所述程序指令被执行时实现上述任一实施例描述的API的异常确定方法,具体实现原理可参见上述实施例,本实施例此处不再赘述。The processor 602 is configured to implement the API exception determination method described in any of the above embodiments when the program instructions are executed. For specific implementation principles, please refer to the above embodiments, and this embodiment will not be described again here.
本发明提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述任一实施例描述的API的异常确定方法。The present invention provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the API exception determination method described in any of the above embodiments is implemented.
本发明还提供一种程序产品,所述程序产品包括计算机程序,所述计算机程序存储在可读存储介质中,至少一个处理器可以从所述可读存储介质读取所述计算机程序,所述至少一个处理器执行所述计算机程序使得服务器实施上述任一实施例描述的API的异常确定方法。The present invention also provides a program product. The program product includes a computer program. The computer program is stored in a readable storage medium. At least one processor can read the computer program from the readable storage medium. At least one processor executes the computer program to cause the server to implement the API exception determination method described in any of the above embodiments.
在本发明所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or can be integrated into another system, or some features can be ignored, or not implemented. On the other hand, the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or they may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。In addition, each functional unit in various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional units.
上述以软件功能单元的形式实现的集成的单元,可以存储在一个计算机可读取存储介质中。上述软件功能单元存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(英文:processor)执行本发明各个实施例所述方法的部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(英文:Read-Only Memory,简称:ROM)、随机存取存储器(英文:Random Access Memory,简称:RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium and includes a number of instructions to cause a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to execute the various embodiments of the present invention. Some steps of the method. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (English: Read-Only Memory, abbreviation: ROM), random access memory (English: Random Access Memory, abbreviation: RAM), magnetic disk or optical disk, etc. Various media that can store program code.
应理解,本发明所描述的处理器可以是中央处理单元(英文:Central ProcessingUnit,简称:CPU),还可以是其他通用处理器、数字信号处理器(英文:Digital SignalProcessor,简称:DSP)、专用集成电路(英文:Application Specific IntegratedCircuit,简称:ASIC)等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。It should be understood that the processor described in the present invention can be a central processing unit (English: Central Processing Unit, referred to as: CPU), or other general-purpose processor, digital signal processor (English: Digital SignalProcessor, referred to as: DSP), special-purpose processor Integrated circuit (English: Application Specific IntegratedCircuit, abbreviation: ASIC), etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc. The steps of the method disclosed in this application can be directly implemented by a hardware processor, or executed by a combination of hardware and software modules in the processor.
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention, but not to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: The technical solutions described in the foregoing embodiments can still be modified, or some or all of the technical features can be equivalently replaced; and these modifications or substitutions do not deviate from the essence of the corresponding technical solutions from the technical solutions of the embodiments of the present invention. scope.
Claims (7)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910927838.8A CN110673973B (en) | 2019-09-27 | 2019-09-27 | Exception determination method and device for application programming interface API |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910927838.8A CN110673973B (en) | 2019-09-27 | 2019-09-27 | Exception determination method and device for application programming interface API |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110673973A CN110673973A (en) | 2020-01-10 |
CN110673973B true CN110673973B (en) | 2024-02-13 |
Family
ID=69079886
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910927838.8A Active CN110673973B (en) | 2019-09-27 | 2019-09-27 | Exception determination method and device for application programming interface API |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110673973B (en) |
Families Citing this family (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112527601A (en) * | 2020-12-17 | 2021-03-19 | 航天信息股份有限公司 | Monitoring early warning method and device |
CN112799963A (en) * | 2021-03-09 | 2021-05-14 | 蔚来汽车科技(安徽)有限公司 | Method and test system for testing at least one application program interface of an application |
CN113888311A (en) * | 2021-10-14 | 2022-01-04 | 中国工商银行股份有限公司 | Risk early warning method and device, computer equipment and computer readable storage medium |
CN113961423A (en) * | 2021-10-28 | 2022-01-21 | 中国联合网络通信集团有限公司 | API interface safety management method, device, equipment and medium |
CN114840875A (en) * | 2022-04-15 | 2022-08-02 | 支付宝(杭州)信息技术有限公司 | Method and device for reporting call quantity and electronic equipment |
CN116320030A (en) * | 2023-01-17 | 2023-06-23 | 支付宝(杭州)信息技术有限公司 | Section log uploading method and device, readable storage medium and electronic equipment |
CN117519670B (en) * | 2023-12-25 | 2024-04-09 | 杭银消费金融股份有限公司 | Method and system for automatically generating RPC (remote procedure control) codes |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109933508A (en) * | 2019-03-25 | 2019-06-25 | 北京百度网讯科技有限公司 | Method and apparatus for sending information |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP6617617B2 (en) * | 2016-03-10 | 2019-12-11 | 富士通株式会社 | Management device, management program, and management method |
-
2019
- 2019-09-27 CN CN201910927838.8A patent/CN110673973B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109933508A (en) * | 2019-03-25 | 2019-06-25 | 北京百度网讯科技有限公司 | Method and apparatus for sending information |
Also Published As
Publication number | Publication date |
---|---|
CN110673973A (en) | 2020-01-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110673973B (en) | Exception determination method and device for application programming interface API | |
US10462027B2 (en) | Cloud network stability | |
CN106548402B (en) | Resource transfer monitoring method and device | |
US9384114B2 (en) | Group server performance correction via actions to server subset | |
JP6526907B2 (en) | Performance monitoring of distributed storage systems | |
CN110362455B (en) | Data processing method and data processing device | |
US8631280B2 (en) | Method of measuring and diagnosing misbehaviors of software components and resources | |
WO2015136624A1 (en) | Application performance monitoring method and device | |
US20160224400A1 (en) | Automatic root cause analysis for distributed business transaction | |
CN110471821A (en) | Abnormal alteration detection method, server and computer readable storage medium | |
CN110300008A (en) | A kind of method and device of the state of the determining network equipment | |
CN109992473A (en) | Monitoring method, device, equipment and the storage medium of application system | |
US11126501B2 (en) | Method, device and program product for avoiding a fault event of a disk array | |
US20230048513A1 (en) | Intelligent cloud service health communication to customers | |
CN109617750A (en) | A service early warning method and gateway | |
US10223189B1 (en) | Root cause detection and monitoring for storage systems | |
JP6252309B2 (en) | Monitoring omission identification processing program, monitoring omission identification processing method, and monitoring omission identification processing device | |
CN116932361A (en) | Micro-service change evaluation method, electronic device, and storage medium | |
CN113132431B (en) | Service monitoring method, service monitoring device, electronic device, and medium | |
US11113364B2 (en) | Time series data analysis control method and analysis control device | |
CN111506446B (en) | Interface fault detection method and server | |
US20180123866A1 (en) | Method and apparatus for determining event level of monitoring result | |
CN113517989B (en) | A resource charging method and device for IaaS cloud platform | |
CN109508356B (en) | Data abnormality early warning method, device, computer equipment and storage medium | |
US9898357B1 (en) | Root cause detection and monitoring for storage systems |
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 | ||
TR01 | Transfer of patent right |
Effective date of registration: 20250508 Address after: 266061 No. 399 Songling Road, Laoshan District, Qingdao, Shandong (A6 3rd floor) Patentee after: QINGDAO JUKANYUN TECHNOLOGY CO.,LTD. Country or region after: China Address before: 266061 Songling Road, Laoshan District, Qingdao, Shandong Province, No. 399 Patentee before: JUHAOKAN TECHNOLOGY Co.,Ltd. Country or region before: China |
|
TR01 | Transfer of patent right |