CN109960508A - A kind of method and device that interface calls - Google Patents

A kind of method and device that interface calls Download PDF

Info

Publication number
CN109960508A
CN109960508A CN201910135673.0A CN201910135673A CN109960508A CN 109960508 A CN109960508 A CN 109960508A CN 201910135673 A CN201910135673 A CN 201910135673A CN 109960508 A CN109960508 A CN 109960508A
Authority
CN
China
Prior art keywords
server
journal file
api interface
interface
statistics
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.)
Withdrawn
Application number
CN201910135673.0A
Other languages
Chinese (zh)
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.)
Maimaiti Mdt Infotech Ltd Shenzhen
Original Assignee
Maimaiti Mdt Infotech Ltd Shenzhen
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 Maimaiti Mdt Infotech Ltd Shenzhen filed Critical Maimaiti Mdt Infotech Ltd Shenzhen
Priority to CN201910135673.0A priority Critical patent/CN109960508A/en
Publication of CN109960508A publication Critical patent/CN109960508A/en
Withdrawn legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the present application discloses a kind of method and device of interface calling statistics, wherein this method comprises: when first server detects that the first application programming api interface is called by system, generate the journal file for calling first api interface, first api interface is one in multiple api interfaces of the first server, and the journal file includes interface identifier;First server obtains the first statistics request, and the first statistics request includes that first api interface identifies, and the first statistics request is used to indicate the number being called to first api interface and counts;First server is searched and the matched M journal file of mark of the first api interface, M >=1 and be integer;First server determines the called number of first api interface according to the M journal file.It, can the quick called number of special interface in accurate statistical server using the embodiment of the present application.

Description

A kind of method and device that interface calls
Technical field
This application involves the method and devices that field of computer technology more particularly to a kind of interface are called.
Background technique
Laravel is a server-side programming language (personal home page, PHP) very burning hot on the market at present Frame, since it has the characteristics that succinct graceful, powerful, existing market has many corporate server clusters to use Laravel frame.
The application system of many companies is built based on laravel frame, and there are many apply journey under laravel frame Sequence interface (Application Program Interface, API).Due to the demand of business, it is sometimes desirable to count and compare certain The calling situation of some specific api interfaces.The mode of the called number of conventional statistics interface are as follows: creation individually detects program The number for going statistics special interface called.But the workload of developer can be aggravated in this way, and will test program access After server, the normal operation of server may be will affect.
Summary of the invention
The embodiment of the present application provides the method and device that a kind of interface calls statistics, can be quickly in accurate statistical server The called number of special interface.
In a first aspect, the embodiment of the present application provides a kind of method that interface calls statistics.This method comprises:
When first server detects that the first application programming api interface is called by system, generates and call described the The journal file of one api interface, first api interface is one in multiple api interfaces of the first server, described Journal file includes interface identifier;
First server obtains the first statistics request, and the first statistics request includes that first api interface identifies, the first system Meter request is used to indicate the number being called to first api interface and counts;
First server is searched and the matched M journal file of mark of the first api interface, M >=1 and be integer;
First server determines the called number of first api interface according to the M journal file.
Implement the embodiment of the present invention, first server detects that api interface is called to generate journal file, to journal file into Row statistics unites to the API of application program without creating individually detection program so that it is determined that the number that api interface is called Meter, so as to quickly accurately count the called number of specific api interface.
Optionally, journal file further includes that log generates the time, and the first statistics request further includes statistical time section, institute State the matched M journal file of mark of first server lookup and first api interface, comprising:
First server determines the mark of first api interface from the corresponding journal file of the multiple api interface Corresponding N number of journal file, N >=M, and the N are integer;
First server is located in the first statistical time section from N number of journal file lookup log generation time M journal file.
Specifically, first server is searched from multiple interfaces identifies matched N number of journal file with the first api interface, This N number of journal file is all journal files generated after the first api interface is called.Then it is looked into from N number of journal file It looks for and generates the time in M journal file of statistical time section.
Implement the embodiment of the present invention, first server can be across Soviet Union's essence according to statistical time section and api interface mark statistics The really number that statistics api interface is called in special time period.
Optionally, the statistical time section includes multiple periods;First server is determined according to the M journal file After the called number of first api interface, further includes:
First server counts first api interface in corresponding called number of the multiple period;
First server is generated according to multiple periods and the first api interface in corresponding called number of multiple periods Frequency statistics table, the frequency statistics table are used to compare what first api interface was called in correspondence of the multiple period Number size.
Specifically, first server counts the number that same api interface is called in multiple periods, difference can be compared Time segment interface is called number size.
Optionally, first server is called according to multiple periods and the first api interface in correspondence of multiple periods Number generates after frequency statistics table, further includes:
First server counts the number that the second api interface is called in the multiple period;
The number and described second that first server is called according to first api interface in the multiple period Api interface generates interface contrast table in the number that the multiple period is called, and the interface contrast table is for comparing first The number size that api interface and the second api interface are called in the same period.
Optionally, first server obtains the journal file that second server is sent, and the journal file is described second The journal file generated after multiple api interfaces of server are called, the first server and the second server are same Server in one server cluster;
First server obtains the second statistics request, and the second statistics request is used to indicate the second api interface of statistics and exists The total degree being called in the server cluster;
First server is searched and second api interface from the journal file of storage according to the second request statistics The Q journal file of mark matching and generation time in the second statistical time section, the journal file of the storage include The journal file that the journal file and the first server that the second server is sent generate, the Q >=M and be integer;
First server determines second api interface quilt in the server cluster according to the Q journal file The total degree of calling.
Specifically, including multiple servers in server cluster, first server receives each service in server cluster The journal file that device is sent.When need a certain server statistics some api interface from server cluster in the cluster by The total degree of calling needs institute's Servers-all in statistical server cluster to generate the journal file for calling the api interface, then The called total degree of the api interface is counted according to all journal files.
Implement the embodiment of the present invention, the journal file that server is sent according to other servers in husband's server cluster can Quickly accurately to count the total degree that specific api interface is called in server cluster.
Optionally, after the journal file that first server acquisition second server is sent, further includes:
First server carries out signature to the journal file that the second server is sent, after obtaining signature Journal file, it is that the second server is sent that the signature, which is used to indicate the journal file,;
First server stores the journal file after the signature to data space.
Specifically, first server obtains the log text that multiple server calls api interfaces in server cluster generate Part, it is therefore desirable to signature be carried out to the journal file of acquisition, the corresponding server of journal file is sent for characterizing, be convenient for Later period counts the total degree that API is called in each server.
Second aspect, the embodiment of the present application provide the device that a kind of interface calls statistics, comprising:
First generation unit, for generating and calling when detecting that the first application programming api interface is called by system The journal file of first api interface, first api interface are one in multiple api interfaces of first server, institute Stating journal file includes interface identifier;
First acquisition unit, for obtaining the first statistics request, the first statistics request includes first api interface Mark, the first statistics request are used to indicate the number being called to first api interface and count;
First searching unit, for search with the matched M journal file of the mark of first api interface, the M >= 1 and be integer;
First determination unit, for determining the called number of first api interface according to the M journal file.
Optionally, the journal file further includes that log generates the time, and the first statistics request further includes the first statistics Period, first searching unit include:
Second determination unit, for determining first api interface from the corresponding journal file of the multiple api interface The corresponding N number of journal file of mark, N >=M, and the N be integer;
Second searching unit generates the time positioned at first system for searching the log from N number of journal file Count M journal file in the period.
The first statistical time section includes multiple periods, described device further include:
Statistic unit, for counting first api interface in corresponding called number of the multiple period;
Second generation unit was used for according to the multiple period and first api interface in the multiple period pair The number that should be called generates frequency statistics table, and the frequency statistics table is for comparing first api interface the multiple Period corresponding called number size.
Optionally, the device further include:
Second acquisition unit, for obtaining the journal file of second server transmission, the journal file is described second The journal file generated after multiple api interfaces of server are called, the first server and the second server are same Server in one server cluster;
Third acquiring unit, for obtaining the second statistics request, the second statistics request is used to indicate the 2nd API of statistics The total degree that interface is called in the server cluster, the second statistics request are used to indicate the second api interface of statistics The total degree being called in the server cluster;
Third determination unit, for being searched and described second from the journal file of storage according to the second request statistics The Q journal file of the matching of api interface mark and generation time in the second statistical time section, the log text of the storage Part includes the journal file that the second server is sent and the journal file that the first server generates, and the Q >=M and is Integer;
4th determination unit, for determining second api interface in the server set according to the Q journal file The total degree being called in group.
Optionally, the device further include:
Marking unit, for after the journal file that the second acquisition unit obtains that the second server is sent, Signature is carried out to the journal file, the journal file after obtaining signature, the signature is used to indicate described Journal file is that the second server is sent;
Storage unit, for storing the journal file after the signature to data space.
The third aspect, the embodiment of the present application provide a kind of server, call for executing the provided interface of first aspect The method of statistics.The server can include: processor, communication interface and memory, processor, communication interface and memory are mutual Connection.Wherein, communication interface with other network equipments (such as terminal) for being communicated, and memory is for storing first aspect The realization code for the method that provided maintenance program provides, processor is for executing the program code stored in memory, i.e., Execute the method that interface provided by first aspect calls statistics.
Fourth aspect, the embodiment of the present application provide a kind of computer readable storage medium, are stored on readable storage medium storing program for executing Instruction, when it runs on a processor, so that processor executes the method that the interface of above-mentioned first aspect description calls statistics.
5th aspect, the embodiment of the present application provides a kind of computer program product comprising instruction, when it is in processor When upper operation, so that processor executes the method that the interface of above-mentioned second aspect description calls statistics.
Detailed description of the invention
In order to illustrate the technical solutions in the embodiments of the present application or in the prior art more clearly, to embodiment or will show below There is attached drawing needed in technical description to be briefly described.Wherein:
Fig. 1 is one of one embodiment communication system architecture schematic diagram;
Fig. 2 is the structural schematic diagram of one of one embodiment server;
Fig. 3 is that one of one embodiment interface calls statistical method flow diagram;
Fig. 4 is that one of one embodiment interface calls statistical method flow diagram;
Fig. 5 is that one of one embodiment interface calls statistic device structural schematic diagram.
Specific embodiment
The embodiment of the present application provides the method and device that a kind of interface calls, can be quickly specific in accurate statistical server The called number of interface.
In the description of this specification, reference term " one embodiment ", " some embodiments ", " example ", " specifically show The description of example " or " some examples " etc. means specific features, structure, material or spy described in conjunction with this embodiment or example Point is included at least one embodiment or example of the invention.In the present specification, schematic expression of the above terms are not It must be directed to identical embodiment or example.Moreover, particular features, structures, materials, or characteristics described can be in office It can be combined in any suitable manner in one or more embodiment or examples.In addition, without conflicting with each other, the skill of this field Art personnel can tie the feature of different embodiments or examples described in this specification and different embodiments or examples It closes and combines.
The term " includes " and " having " and their any changes occurred in present specification, claims and attached drawing Shape, it is intended that cover and non-exclusive include.Such as contain the process, method of a series of steps or units, system, product or Equipment is not limited to listed step or unit, but optionally further comprising the step of not listing or unit or optional Ground further includes the other step or units intrinsic for these process, methods, product or equipment.In addition, term " first ", " the Two " and " third " etc. are and to be not intended to describe specific sequence for distinguishing different objects.Below in conjunction with of the invention real The attached drawing in example is applied, technical solution in the embodiment of the present invention is described.
Referring to Figure 1, Fig. 1 be the invention relates to a kind of communication system configuration diagram, the communication system Including server cluster and terminal.It include multiple servers in server cluster, the embodiment of the present invention is for ease of description to take It is illustrated for first server and second server in business device cluster.The terminal referred in the embodiment of the present application is for example It can be mobile phone, tablet computer, laptop, palm PC, mobile internet device or other mobile terminals.
Api interface in first server detection service device is called, generates the journal file of calling interface.First service Device obtains the statistics request for target api interface call number, and the mode of acquisition can be to be obtained from terminal, is also possible to straight It obtains and takes.First server searches the journal file of invocation target api interface generation from data space, according to what is found Journal file determines the called number of target api interface.
Multiple servers (such as first server) in server cluster send journal file to first server, are used for First server counts the total degree that target api interface is called in server cluster.
Fig. 2 is referred to, Fig. 2 shows a kind of server provided by the embodiments of the present application, the servers 200 can include: deposit Reservoir 201, communication interface 202 and one or more processors 203.These components can be connected by bus 204 or other modes It connects, Fig. 2 by bus for being connected.Wherein:
Memory 201 can be coupled with processor 203 by bus 204 or input/output port, and memory 201 can also To be integrated with processor 203.Memory 201 is for storing various software programs and/or multiple groups instruction.Specifically, depositing Reservoir 201 may include the memory of high random access, and may also comprise nonvolatile memory, such as one or more magnetic Disk storage device, flash memory device or other non-volatile solid-state memory devices.Memory 201 can also store network communication journey Sequence, the network communication program can be used for and one or more optional equipments, one or more terminals, one or more network equipments It is communicated.
Processor 203 can be general processor, such as central processing unit (central processing unit, CPU), it can also be digital signal processor (digital signal processing, DSP), specific integrated circuit (application specific integrated circuit, ASIC), or be arranged to implement the embodiment of the present application One or more integrated circuits.Processor 203 can handle the data received by communication interface 202.
Communication interface 202 is communicated for server 200 with other network equipments, such as terminal is communicated.Communication Interface 202 can be transceiver, transmission circuit etc., wherein communication interface is to be referred to as, and may include one or more interfaces, example Such as the interface between terminal and server.Communication interface 202 may include wireline interface and wireless interface, such as standard interface, Ethernet, Multi-Machine Synchronous interface.
Processor 203 can be used for reading and executing computer-readable instruction.It is deposited specifically, processor 203 can be used for calling The data being stored in memory 201.Optionally, when processor 203 sends any message or data, especially by driving or Control communication interface 202 does the transmission.Optionally, when processor 203 receives any message or data, especially by drive Dynamic or control communication interface 202 does the reception.Therefore, processor 203 can be considered to be the control for executing and sending or receiving Center, communication interface 202 are to send and receive the specific actor of operation.
In the embodiment of the present application, communication interface 202 is specifically used for executing the receipts of data involved in following methods embodiment The step of hair, processor 203 are specifically used for the step of implementing the data processing in addition to data transmit-receive.It should be noted that clothes The structure of business device 200 can be the structure of any server in first server or server cluster.
Server as shown in connection with fig. 2, the embodiment of the present application provide a kind of method that interface calls statistics, referring to Fig. 3, Fig. 3 is the flow diagram for the method that a kind of interface that one embodiment of the application provides calls statistics.Wherein, such as Fig. 3 institute Show, a kind of interface calling statistical method that one embodiment of the application provides may include:
S301: it when first server detects that the first application programming api interface is called by system, generates and calls first The journal file of api interface, the first api interface are one in multiple api interfaces of the first server, journal file packet Include interface identifier.
Optionally, journal file further includes that log generates the time, and the log generation time is used to indicate what api interface was called Time.
Specifically, first server includes multiple api interfaces, each api interface has corresponding interface identifier.When the first clothes Business device detects that a certain api interface is called, generates the corresponding journal file of the api interface, journal file includes log Time and interface identifier are generated, the api interface called time can be characterized.
S302: first server obtains the first statistics request, and the first statistics request includes that the first api interface identifies, and first Statistics request is used to indicate the number being called to the first api interface and counts.
Optionally, the mode of the first statistics of acquisition request can be a variety of, can be first server and is obtained by terminal Take be also possible to first server directly acquire the first statistics request.
S303: first server is searched and the matched M journal file of mark of the first api interface, M >=1 and be integer.
Optionally, first statistics request include the first statistical time section, first server according to the first api interface identify from Multiple api interfaces of the first server determine that N number of journal file, N >=M, and the N are integer;
First server searches the log from N number of journal file and generates M of the time in the first statistical time section A journal file.
Specifically, first server calls the first API to connect according to the first api interface identifier lookup in the first statistics request N (such as 256) a journal file of mouth, N number of journal file include the journal file that any time calls the first api interface.So Afterwards according to the statistical time section in the first statistics request, such as on December 12nd, 2018, it is raw that first server searches journal file At M (such as 50) a journal file of time on December 12nd, 2018.
S304: first server determines the called number of the first api interface according to M journal file.
Specifically, if the M journal file that first server obtains is 50 journal files, first server judgement the The called number of one api interface is 50.
Optionally, the first statistical time section includes multiple periods, and first server is determined according to the M journal file After the called number of first api interface, further includes:
First server counts the first api interface in corresponding called number of the multiple period;
First server is generated according to multiple periods and the first api interface in corresponding called number of multiple periods Frequency statistics table.
Optionally, frequency statistics table is used to compare the first api interface in corresponding called number of the multiple period Size.First server counts the number that same api interface is called in multiple periods, can compare different time segment interface Called number size.The content of the frequency statistics table of first api interface can be such as, but not limited to as shown in table 1:
Table 1
Optionally, first server is called according to multiple periods and the first api interface in correspondence of multiple periods Number generates after frequency statistics table, further includes:
First server counts the number that the second api interface is called in the multiple period;
The number and described second that first server is called according to first api interface in the multiple period Api interface generates interface contrast table in the number that the multiple period is called.
Specifically, interface contrast table is used to compare what the first api interface and the second api interface were called in the same period Number size.The content of interface contrast table can be such as, but not limited to as shown in table 2:
Table 2
Statistical time section First api interface is called number Second api interface is called number
2018-1-1 9:00-11:00 256 313
2018-1-1 11:00-13:00 355 369
2018-1-1 13:00-15:00 479 452
…… …… ……
Optionally, first server is a server in server cluster, and server cluster includes multiple servers, Such as second server.Referring to fig. 4, Fig. 4 is to apply for that another interface that embodiment provides calls the process of statistical method to illustrate Figure, as shown in figure 4, a kind of interface calling statistical method that one embodiment of the application provides may include:
S401: first server obtains the journal file that second server is sent, and first server and second server are Server in same cluster.
Optionally, the file journalization that first server is sent is to generate after multiple api interfaces of second server are called Journal file, first server receives the journal file that multiple servers are sent in server cluster.
Optionally, first server obtains in server cluster after the journal file of multiple servers transmissions, further includes:
First server carries out signature to the journal file that second server is sent, the log after obtaining signature File, it is that the second server is sent that signature, which is used to indicate the journal file,;
First server stores the journal file after the signature to data space.
Optionally, signature can be physical address, IP address or other characteristic characters of second server, the application It does not limit this.
Specifically, first server obtains the log text that multiple server calls api interfaces in server cluster generate Part, it is therefore desirable to signature be carried out to the journal file of acquisition, the corresponding server of journal file is sent for characterizing, be convenient for Later period counts the total degree that API is called in each server.
S402: first server obtains the second statistics request, and the second statistics request is used to indicate the second api interface of statistics and exists The total degree being called in the server cluster.
Specifically, time that first statistics request special interface on individual server in statistical server cluster is called Number, second statistics request called number of special interface on Servers-all in statistical server cluster.
S403: first server is searched and the second api interface mark from the journal file of storage according to the second statistics request Know matching and generates Q journal file of the time in the second statistical time section.
Specifically, first service refers to above-mentioned steps according to the method that corresponding journal file is searched in the second statistics request S303, details are not described herein again.
S404: first server determines that the second api interface is called total in server cluster according to Q journal file Number.
Optionally, first server is according to the signature of Q journal file, to the server for sending Q journal file It is recognized, generates the second api interface call number statistical form.For example, having three servers in server cluster is respectively One server, second server and third server, the second api interface are called in this day of 2018-1-1 in server cluster Number is 14015, wherein the second api interface is 4134 in the number that first server is called, it is called in second server Number be 4345, third server be called number be 5536.For example, the second api interface call number statistical form can With such as, but not limited to as shown in table 3:
Table 3
Show referring to Fig. 5, Fig. 5 and give a kind of structural schematic diagram of device that maintenance program is recommended, as shown in figure 5, the dimension The device 500 for repairing scheme offer includes: the first generation unit 501, first acquisition unit 502, the first searching unit 503 and first Determination unit 504.
Wherein, the first generation unit 501, for when detecting that the first application programming api interface is called by system, The journal file for calling first api interface is generated, first api interface is in multiple api interfaces of first server One, the journal file includes interface identifier;First acquisition unit 502 is requested, described first for obtaining the first statistics Statistics request includes that first api interface identifies, and the first statistics request, which is used to indicate, adjusts first api interface Number is counted;First searching unit 503, for searching and the matched M log of the mark of first api interface File, M >=1 and be integer;First determination unit 504, for determining the first API according to the M journal file The called number of interface.
Optionally, the journal file further includes that log generates the time, and the first statistics request further includes the first statistics Period, first searching unit include:
Second determination unit, for multiple api interfaces according to first api interface mark from the first server Determine that N number of journal file, N >=M, and the N are integer;
Second searching unit generates the time in first statistics for searching the log from N number of journal file M journal file in period.
The first statistical time section includes multiple periods, described device further include:
Statistic unit, for counting first api interface in corresponding called number of the multiple period;
Second generation unit was used for according to the multiple period and first api interface in the multiple period pair The number that should be called generates frequency statistics table, and the frequency statistics table is for comparing first api interface the multiple Period corresponding called number size.
Optionally, the device further include:
Second acquisition unit, for obtaining the journal file of second server transmission, the journal file is described second The journal file generated after multiple api interfaces of server are called, the first server and the second server are same Server in one server cluster;
Third acquiring unit, for obtaining the second statistics request, the second statistics request is used to indicate the 2nd API of statistics The total degree that interface is called in the server cluster, the second statistics request are used to indicate the second api interface of statistics The total degree being called in the server cluster;
Third determination unit, for being searched and described second from the journal file of storage according to the second request statistics The Q journal file of the matching of api interface mark and generation time in the second statistical time section, the log text of the storage Part includes the journal file that the second server is sent and the journal file that the first server generates, and the Q >=M and is Integer;
4th determination unit, for determining second api interface in the server set according to the Q journal file The total degree being called in group.
Optionally, the device further include:
Marking unit, for after the journal file that the second acquisition unit obtains that the second server is sent, Signature is carried out to the journal file, the journal file after obtaining signature, the signature is used to indicate described Journal file is that the second server is sent;
Storage unit, for storing the journal file after the signature to data space.
A kind of computer readable storage medium, the computer-readable storage medium are provided in another embodiment of the application Matter is stored with computer program, and the computer program includes program instruction, realization when described program instruction is executed by processor.
If the integrated unit is realized in the form of SFU software functional unit and sells or use as independent product When, it can store in a computer readable storage medium.Based on this understanding, technical solution of the present invention is substantially The all or part of the part that contributes to existing technology or the technical solution can be in the form of software products in other words It embodies, which is stored in a storage medium, including some instructions are used so that a computer Equipment (can be personal computer, server or the network equipment etc.) executes the complete of each embodiment the method for the application Portion or part steps.And storage medium above-mentioned include: USB flash disk, mobile hard disk, read-only memory (read-only memory, ROM), random access memory (random access memory, RAM), magnetic or disk etc. are various can store program The medium of code.
In the above-described embodiments, can come wholly or partly by software, hardware, firmware or any combination thereof real It is existing.When implemented in software, it can entirely or partly realize in the form of a computer program product.The computer program Product includes one or more computer instructions.When loading on computers and executing the computer program instructions, all or It partly generates according to process or function described in the embodiment of the present application.The computer can be general purpose computer, dedicated meter Calculation machine, computer network or other programmable devices.The computer instruction can store in computer readable storage medium In, or from a computer readable storage medium to the transmission of another computer readable storage medium, for example, the computer Instruction can pass through wired (such as coaxial cable, optical fiber, number from a web-site, computer, server or data center User's line (digital subscriber line, DSL) or wireless (such as infrared, wireless, microwave etc.) mode are to another net Website, computer, server or data center are transmitted.The computer readable storage medium can be computer can Any usable medium of access either includes the data storage such as one or more usable mediums integrated server, data center Equipment.The usable medium can be magnetic medium, (for example, floppy disk, hard disk, tape), optical medium (such as digital multi light Disk (digital versatile disc, DVD), semiconductor medium (such as solid state hard disk solid state disk, SSD) Deng.
Above-described specific embodiment carries out the purpose of the embodiment of the present invention, technical scheme and beneficial effects It is further described, it should be understood that the foregoing is merely the specific embodiments of the embodiment of the present invention, and does not have to In limit the embodiment of the present invention protection scope, it is all on the basis of the technical solution of the embodiment of the present invention, done it is any Modification, equivalent replacement, improvement etc. should all include within the protection scope of the embodiment of the present invention.

Claims (10)

1. a kind of method that interface calls statistics characterized by comprising
When first server detects that the first application programming api interface is called by system, generates and call the first API The journal file of interface, first api interface are one in multiple api interfaces of the first server, the log File includes interface identifier;
The first server obtains the first statistics request, and the first statistics request includes that first api interface identifies, institute State the first statistics request be used to indicate to first api interface be called number count;
The first server searches the matched M journal file of mark with first api interface, M >=1 and be whole Number;
The first server determines the called number of first api interface according to the M journal file.
2. the method according to claim 1, wherein the journal file further include log generate the time, it is described First statistics request further includes the first statistical time section, and the first server searches the mark with first api interface The M journal file matched, comprising:
The first server determines the mark of first api interface from the corresponding journal file of the multiple api interface Corresponding N number of journal file, N >=M, and the N are integer;
The first server is located in the first statistical time section from N number of journal file lookup log generation time M journal file.
3. according to the method described in claim 2, it is characterized in that, the first statistical time section includes multiple periods;Institute It states after first server determines the called number of first api interface according to the M journal file, further includes:
The first server counts first api interface in corresponding called number of the multiple period;
The first server is adjusted according to the multiple period and first api interface in correspondence of the multiple period Number generates frequency statistics table, and the frequency statistics table is for comparing first api interface in the multiple period Corresponding called number size.
4. the method according to claim 1, wherein the method also includes:
The first server obtains the journal file that second server is sent, and the journal file is the second server The journal file generated after multiple api interfaces are called, the first server and the second server are same server Server in cluster;
The first server obtains the second statistics request, and the second statistics request includes the second api interface mark and second Statistical time section, the second statistics request are used to indicate what the second api interface of statistics was called in the server cluster Total degree;
The first server is searched and second api interface from the journal file of storage according to the second request statistics The Q journal file of mark matching and generation time in the second statistical time section, the journal file of the storage include The journal file that the journal file and the first server that the second server is sent generate, the Q >=M and be integer;
The first server determines second api interface quilt in the server cluster according to the Q journal file The total degree of calling.
5. according to the method described in claim 4, it is characterized in that, the first server obtains the day that second server is sent After will file, further includes:
The first server carries out signature to the journal file that the second server is sent, after obtaining signature Journal file, it is that the second server is sent that the signature, which is used to indicate the journal file,;
The first server stores the journal file after the signature to data space.
6. the device that a kind of interface calls statistics characterized by comprising
First generation unit, for generating described in calling when detecting that the first application programming api interface is called by system The journal file of first api interface, first api interface are one in multiple api interfaces of first server, the day Will file includes interface identifier;
First acquisition unit, for obtaining the first statistics request, the first statistics request includes the first api interface mark Know, the first statistics request is used to indicate the number being called to first api interface and counts;
First searching unit, for search with the matched M journal file of the mark of first api interface, M >=1 and For integer;
First determination unit, for determining the called number of first api interface according to the M journal file.
7. device according to claim 6, which is characterized in that the journal file further includes that log generates the time, described First statistics request further includes the first statistical time section, and first searching unit includes:
Second determination unit, for determining the mark of first api interface from the corresponding journal file of the multiple api interface Knowing corresponding N number of journal file, N >=M, and the N is integer;
Second searching unit, when generating the time positioned at the described first statistics for searching the log from N number of journal file Between M journal file in section.
8. device according to claim 7, which is characterized in that the first statistical time section includes multiple periods, institute State device further include:
Statistic unit, for counting first api interface in corresponding called number of the multiple period;
Second generation unit, for corresponding to quilt in the multiple period according to the multiple period and first api interface The number of calling generates frequency statistics table, and the frequency statistics table is for comparing first api interface in the multiple time The corresponding called number size of section.
9. device according to claim 6, which is characterized in that described device further include:
Second acquisition unit, for obtaining the journal file of second server transmission, the journal file is the second service The journal file generated after multiple api interfaces of device are called, the first server and the second server are same clothes The server being engaged in device cluster;
Third acquiring unit, for obtaining the second statistics request, the second statistics request is used to indicate the second api interface of statistics The total degree being called in the server cluster, the second statistics request are used to indicate the second api interface of statistics in institute State the total degree being called in server cluster;
Third determination unit, for being searched and the 2nd API from the journal file of storage according to the second request statistics The Q journal file of interface identifier matching and generation time in the second statistical time section, the journal file of the storage The journal file that the journal file sent including the second server and the first server generate, the Q >=M and to be whole Number;
4th determination unit, for determining second api interface in the server cluster according to the Q journal file Called total degree.
10. device according to claim 9, which is characterized in that described device further include:
Marking unit, for after the journal file that the second acquisition unit obtains that the second server is sent, to institute It states journal file and carries out signature, the journal file after obtaining signature, the signature is used to indicate the log File is that the second server is sent;
Storage unit, for storing the journal file after the signature to data space.
CN201910135673.0A 2019-02-22 2019-02-22 A kind of method and device that interface calls Withdrawn CN109960508A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910135673.0A CN109960508A (en) 2019-02-22 2019-02-22 A kind of method and device that interface calls

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910135673.0A CN109960508A (en) 2019-02-22 2019-02-22 A kind of method and device that interface calls

Publications (1)

Publication Number Publication Date
CN109960508A true CN109960508A (en) 2019-07-02

Family

ID=67023675

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910135673.0A Withdrawn CN109960508A (en) 2019-02-22 2019-02-22 A kind of method and device that interface calls

Country Status (1)

Country Link
CN (1) CN109960508A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113760930A (en) * 2021-07-30 2021-12-07 北京沃东天骏信息技术有限公司 Method, device, equipment and storage medium for determining running data in business system
US20230102292A1 (en) * 2021-09-29 2023-03-30 Moesif, Inc. Secure management of application programming interface (api) request information

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113760930A (en) * 2021-07-30 2021-12-07 北京沃东天骏信息技术有限公司 Method, device, equipment and storage medium for determining running data in business system
US20230102292A1 (en) * 2021-09-29 2023-03-30 Moesif, Inc. Secure management of application programming interface (api) request information

Similar Documents

Publication Publication Date Title
Pei et al. Resource aware routing for service function chains in SDN and NFV-enabled network
CN111741026B (en) Cross-chain transaction request processing method, device, equipment and storage medium
US10142285B2 (en) IP allocation pools
CN105224606B (en) A kind of processing method and processing device of user identifier
US10951722B2 (en) Deriving mobile application usage from network traffic
AU2016336006A1 (en) Systems and methods for security and risk assessment and testing of applications
CN103945000B (en) A kind of load-balancing method and load equalizer
CN111327647B (en) Method and device for providing service to outside by container and electronic equipment
CN105786451A (en) Method, device and system for processing complicated event
CA3054607C (en) Systems and methods for compute node management protocols
CN108427956A (en) A kind of clustering objects method and apparatus
CN104219230B (en) Identify method and the device of malicious websites
CN109981745A (en) A kind of journal file processing method and server
CN110442502A (en) A kind of method, apparatus buried a little, equipment and storage medium
CN106921578A (en) The generation method and device of a kind of forwarding-table item
CN108563697A (en) A kind of data processing method, device and storage medium
CN106067879B (en) The detection method and device of information
CN108459908A (en) Identification to the incompatible cotenant pair in cloud computing
CN109960508A (en) A kind of method and device that interface calls
CN107888700B (en) Shared cloud rendering system and processing method thereof
CN104468207A (en) Terminal management method, device and system
CN106549827A (en) The detection method and device of network state
CN108270753A (en) The method and device of logging off users account
CN105939228B (en) A kind of health detecting method and device
CN106686141A (en) Resource download method and resource download device

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 518000 Guangdong city of Shenzhen province Qianhai Shenzhen Hong Kong cooperation zone before Bay Road No. 1 building 201 room A (located in Shenzhen Qianhai business secretary Co. Ltd.)

Applicant after: Shenzhen Rongyimai Information Technology Co., Ltd.

Address before: 518000 Guangdong city of Shenzhen province Qianhai Shenzhen Hong Kong cooperation zone before Bay Road No. 1 building 201 room A (located in Shenzhen Qianhai business secretary Co. Ltd.)

Applicant before: Maimaiti Mdt InfoTech Ltd, Shenzhen

WW01 Invention patent application withdrawn after publication
WW01 Invention patent application withdrawn after publication

Application publication date: 20190702