CN110347573A - Application program analysis method, device, electronic equipment and computer-readable medium - Google Patents

Application program analysis method, device, electronic equipment and computer-readable medium Download PDF

Info

Publication number
CN110347573A
CN110347573A CN201810289532.XA CN201810289532A CN110347573A CN 110347573 A CN110347573 A CN 110347573A CN 201810289532 A CN201810289532 A CN 201810289532A CN 110347573 A CN110347573 A CN 110347573A
Authority
CN
China
Prior art keywords
application
call relation
database
relationship
forest
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201810289532.XA
Other languages
Chinese (zh)
Other versions
CN110347573B (en
Inventor
樊宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201810289532.XA priority Critical patent/CN110347573B/en
Publication of CN110347573A publication Critical patent/CN110347573A/en
Application granted granted Critical
Publication of CN110347573B publication Critical patent/CN110347573B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3664Environments for testing or debugging software
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3696Methods or tools to render software testable
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/80Database-specific techniques

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

This disclosure relates to a kind of application program analysis method, device, electronic equipment and computer-readable medium.It is related to computer information processing field, this method comprises: multiple applications are disposed by predetermined condition;It runs the multiple application and records the operating condition of the multiple application by database journal;Relationship forest is applied by establishing to the syntactic analysis of the multiple application, the application relationship forest includes multiple call relation trees, and the call relation tree passes through the relationship between method and generates;And by the database journal and the application relationship forest, call relation adjacency list is generated to analyze the multiple application.This disclosure relates to application program analysis method, device, electronic equipment and computer-readable medium, it is shared under the deployment scenario of same database in mostly application, the problem of capable of positioning using operational process, additionally it is possible to comb the flow of task and data flow between multiple applications.

Description

Application program analysis method, device, electronic equipment and computer-readable medium
Technical field
This disclosure relates to computer information processing field, in particular to a kind of application program analysis method, device, Electronic equipment and computer-readable medium.
Background technique
With the development of technology, more and more application programs are used to that user is assisted to work.Present system is more For micro services, different functions, which can be split, to be assigned in different application programs.Due to these applications between call relation it is wrong Comprehensive complexity, the relationship how combed between these applications become a problem.Especially in the test process of application, very much Due to the call relation and intrinsic call relationship that are difficult between positioning application when test, cause many times to unclog and readjust test wrapper The problems such as border, test defect, becomes more and more difficult, brings more communication and coordination problems, causes the testing time elongated.Especially It is when tester does not know about tested test system, the above problem is more significant.Moreover, to there are the processing of multiple applicating cooperations When working on line, for positioning and call relation combing can also have the above problem the problem of environment on line.
Therefore, it is necessary to a kind of new application program analysis method, device, electronic equipment and computer-readable mediums.
Above- mentioned information are only used for reinforcing the understanding to the background of the disclosure, therefore it disclosed in the background technology part It may include the information not constituted to the prior art known to persons of ordinary skill in the art.
Summary of the invention
In view of this, the disclosure provides a kind of application program analysis method, device, electronic equipment and computer-readable Jie Matter, in the case where mostly application shares the deployment scenario of same database, the problem of capable of positioning using operational process, additionally it is possible to Comb the flow of task and data flow between multiple applications.
Other characteristics and advantages of the disclosure will be apparent from by the following detailed description, or partially by the disclosure Practice and acquistion.
According to the one side of the disclosure, a kind of application program analysis method is proposed, this method comprises: by multiple applications by pre- Fixed condition is disposed;It runs the multiple application and records the operating condition of the multiple application by database journal;It is logical It crosses the syntactic analysis to the multiple application to establish using relationship forest, the application relationship forest includes multiple call relations Tree, the call relation tree pass through the relationship between method and generate;And it is gloomy by the database journal and the application relationship Woods generates call relation adjacency list to analyze the multiple application.
In a kind of exemplary embodiment of the disclosure, further includes: by the call relation adjacency list to the multiple Using progress test monitoring.
In a kind of exemplary embodiment of the disclosure, the multiple application is carried out by the call relation adjacency list Test monitoring includes: to be shown the call relation adjacency list sequentially in time;The time is executed according to database statement Database journal is filtered;The corresponding code of exception information is associated to the code snippet for obtaining call method; And test problem positioning is carried out to the multiple application by code snippet, database statement, the call relation adjacency list.
In a kind of exemplary embodiment of the disclosure, further includes: assisted by the call relation adjacency list described more A application carries out database deployment.
In a kind of exemplary embodiment of the disclosure, by multiple applications by predetermined condition carry out deployment include: will be described Multiple applications are deployed in same server;The same database instance is deployed in the database used by the multiple In;And extract it is the multiple using database configuration file in keyword, generate predetermined data-structure.
In a kind of exemplary embodiment of the disclosure, extract it is the multiple using database configuration file in Keyword, generate predetermined data-structure include: to segment the SQL statement in data base configuration file, by participle after Sentence node generate the keyword;And predetermined data-structure is generated by the keyword, in the tentation data knot In structure, key is key value, and value is the mark of SQL statement.
In a kind of exemplary embodiment of the disclosure, by establishing the relationship of applying to the syntactic analysis of the multiple application Forest, the application relationship forest include multiple call relation trees, and the call relation tree passes through the relationship between method and generates packet It includes: syntactic analysis is carried out to the unit file of backstage language in the source code of application;Source code is established by the syntactic analysis The call relation tree of middle unit file;And it is gloomy by multiple call relation trees generation application relationship of multiple applications Woods.
In a kind of exemplary embodiment of the disclosure, established in source code described in unit file by the syntactic analysis Call relation tree includes: to carry out recursive traversal to method used in the unit file;And using method as node, method Between call relation as side, generate the call relation tree.
In a kind of exemplary embodiment of the disclosure, by database journal and the application relationship forest, generates and adjust With relation adjacent table with to the multiple application carry out analysis include: that the data in the database journal are filtered place Reason generates predetermined data-structure;The mark of SQL statement is determined by the predetermined data-structure;Existed by the mark of SQL statement The corresponding method call relationship of SQL statement is positioned in the application relationship forest;And pass through all corresponding sides of SQL statement Method call relation generates the call relation adjacency list to analyze the multiple application.
In a kind of exemplary embodiment of the disclosure, the data in the database journal are filtered processing, it is raw Include: that the data by database journal are subjected to natural language filtration treatment at predetermined data-structure, generates predetermined number According to structure.
According to the one side of the disclosure, it proposes that a kind of application program analytical equipment, the device include: deployment module, is used for Multiple applications are disposed by predetermined condition;Logging modle, for running the multiple application and being remembered by database journal Record the operating condition of the multiple application;Relationship module, for being closed by establishing application to the syntactic analysis of the multiple application It is forest, the application relationship forest includes multiple call relation trees, and the call relation tree passes through the relationship between method and generates; And analysis module, for generating call relation adjacency list to described by database journal and the application relationship forest Multiple applications are analyzed.
According to the one side of the disclosure, a kind of electronic equipment is proposed, which includes: one or more processors; Storage device, for storing one or more programs;When one or more programs are executed by one or more processors, so that one A or multiple processors realize such as methodology above.
According to the one side of the disclosure, it proposes a kind of computer-readable medium, is stored thereon with computer program, the program Method as mentioned in the above is realized when being executed by processor.
It is total in mostly application according to application program analysis method, device, electronic equipment and the computer-readable medium of the disclosure Under deployment scenario with same database, the problem of capable of positioning using operational process, additionally it is possible to comb multiple applications Between flow of task and data flow.
It should be understood that the above general description and the following detailed description are merely exemplary, this can not be limited It is open.
Detailed description of the invention
Its example embodiment is described in detail by referring to accompanying drawing, above and other target, feature and the advantage of the disclosure will It becomes more fully apparent.Drawings discussed below is only some embodiments of the present disclosure, for the ordinary skill of this field For personnel, without creative efforts, it is also possible to obtain other drawings based on these drawings.
Fig. 1 is the system block diagram of a kind of application program analysis method shown according to an exemplary embodiment and device.
Fig. 2 is a kind of flow chart of application program analysis method shown according to an exemplary embodiment.
Fig. 3 is a kind of schematic diagram of the application program analysis method shown according to another exemplary embodiment.
Fig. 4 is a kind of block diagram of application program analytical equipment shown according to an exemplary embodiment.
Fig. 5 is the block diagram of a kind of electronic equipment shown according to an exemplary embodiment.
Fig. 6 is that a kind of computer readable storage medium schematic diagram is shown according to an exemplary embodiment.
Specific embodiment
Example embodiment is described more fully with reference to the drawings.However, example embodiment can be real in a variety of forms It applies, and is not understood as limited to embodiment set forth herein;On the contrary, thesing embodiments are provided so that the disclosure will be comprehensively and complete It is whole, and the design of example embodiment is comprehensively communicated to those skilled in the art.Identical appended drawing reference indicates in figure Same or similar part, thus repetition thereof will be omitted.
In addition, described feature, structure or characteristic can be incorporated in one or more implementations in any suitable manner In example.In the following description, many details are provided to provide and fully understand to embodiment of the disclosure.However, It will be appreciated by persons skilled in the art that can with technical solution of the disclosure without one or more in specific detail, Or it can be using other methods, constituent element, device, step etc..In other cases, it is not shown in detail or describes known side Method, device, realization or operation are to avoid fuzzy all aspects of this disclosure.
Block diagram shown in the drawings is only functional entity, not necessarily must be corresponding with physically separate entity. I.e., it is possible to realize these functional entitys using software form, or realized in one or more hardware modules or integrated circuit These functional entitys, or these functional entitys are realized in heterogeneous networks and/or processor device and/or microcontroller device.
Flow chart shown in the drawings is merely illustrative, it is not necessary to including all content and operation/step, It is not required to execute by described sequence.For example, some operation/steps can also decompose, and some operation/steps can close And or part merge, therefore the sequence actually executed is possible to change according to the actual situation.
It should be understood that although herein various assemblies may be described using term first, second, third, etc., these groups Part should not be limited by these terms.These terms are to distinguish a component and another component.Therefore, first group be discussed herein below Part can be described as the second component without departing from the teaching of disclosure concept.As used herein, term " and/or " include associated All combinations for listing any of project and one or more.
It will be understood by those skilled in the art that attached drawing is the schematic diagram of example embodiment, module or process in attached drawing Necessary to not necessarily implementing the disclosure, therefore it cannot be used for the protection scope of the limitation disclosure.
The inventors of the present application found that testing for the system there are call relation between multiple applications it The positioning of the problem of environment is mainly the following mode with call relation combing: 1, understanding system using application log tracks method Operation conditions;2, system operation situation is understood using the field value of data base table recording;3, understood using program interface operation System operation situation and the 4, above method combine.
There are the following problems for above-mentioned settling mode: database situations same for more application access: such as program A method 1- > program A method 2- > inquiry database -> program A method 3- > program B method 1- > program B method 2- > update database manipulation. Check that related related procedure information, orientation problem are relatively difficult.And data base table recording can only show final updated database The case where operation note, lacks process tracking for inquiry database and upper layer method call before.When there are many interface operation It waits the miscue reflected and is unable to orientation problem, it is possible to display only inquiry failure or the mistake of more new database change, and cannot provide Specific reason, such as null pointer exception, querying condition, which is not found, meets condition record etc., it is also necessary to by other means.Using Program log sometimes can not orientation problem, usual log content influenced by original application code.Such as it is used in code Be debug grades of log, be in diary configuration in info output or code without relevant log output code etc., can significantly Increase the difficulty of process combing and positioning problems.Since application program stores time delay and asynchronism, the day of application program can be made Will Information locating brings difficulty.
Present inventor has found that application program would generally be using database as most by the analysis to the above problem Whole lasting layer data storage, can be considered as the final step of application program, and when the record of database journal has stringent Between sequence, by database journal scanning bottom-up applied behavior analysis may be implemented.And some inquiry items in applying Part also final entry can be considered as first flow nodes of application program, facilitated in the form of SQL in database journal Behavior is applied in analysis from front to back.
The intervention of database journal preferably can generate and show between different application or not Tongfang between same program The process of method, such as method 1- > method 2- > inquiry database -> method 3- > method 4- > update database manipulation, can be more preferable Process is split as several key points, inquiring and update in above-mentioned example is exactly two key points, if inquiry reports an error, it may be possible to Due to method 1, the problem of method 2 causes;If updating operating mistake, inquiry is normal, illustration method 3, method 4 there are problem, It can be convenient and quickly split process, orientation problem.Faster than conventional mapping methods efficiency, in more quasi- position line and test wrapper The problems in border.
Said from another angle, usual data base read-write fail the problem of be more serious defect problem, pass through number It can also preferably find the problem according to library log as test monitoring entrance, such as database lacks field, result set is sky etc. Problem greatly shortens the testing time, improves working efficiency.
Based on above analysis, the application proposes a kind of application program analysis method, exists in the prior art to solve The problem of, it will be made below being described in detail.
Fig. 1 is the system block diagram of a kind of application program analysis method shown according to an exemplary embodiment and device.
As shown in Figure 1, system architecture 100 may include terminal device 101,102,103, network 104 and server 105. Network 104 between terminal device 101,102,103 and server 105 to provide the medium of communication link.Network 104 can be with Including various connection types, such as wired, wireless communication link or fiber optic cables etc..
User can be used terminal device 101,102,103 and be interacted by network 104 with server 105, to receive or send out Send message etc..Various telecommunication customer end applications, such as the application of shopping class, net can be installed on terminal device 101,102,103 The application of page browsing device, searching class application, instant messaging tools, mailbox client, social platform software etc..
Terminal device 101,102,103 can be the various electronic equipments with display screen and supported web page browsing, packet Include but be not limited to smart phone, tablet computer, pocket computer on knee and desktop computer etc..
Server 105 can be to provide the server of various services, such as utilize terminal device 101,102,103 to user The website browsed provides the back-stage management server supported.Back-stage management server can be customer-furnished to what is received Application program carries out the processing such as analyzing, and processing result is fed back to terminal device.
Multiple applications that server 105 can be for example analysed to are disposed by predetermined condition;Institute is run on server 105 It states multiple applications and records the operating condition of the multiple application by database journal;Server 105 can also for example by pair The syntactic analysis of the multiple application, which is established, applies relationship forest, and the application relationship forest includes multiple call relation trees, institute Call relation tree is stated to generate by the relationship between method;And server 105 can for example by the database journal with it is described Using relationship forest, call relation adjacency list is generated to analyze the multiple application.
Server 105 can be the server of an entity, also may be, for example, that multiple servers form, in server 105 It can be to be analyzed the multiple to be deployed in server 105 with the database used for example including multiple database instances In the same database instance.
It should be noted that application program analysis method provided by the embodiment of the present disclosure is generally executed by server 105, Correspondingly, application program analytical equipment is generally positioned in server 105.And it is supplied to user and carries out the net that analysis data are shown Page end is normally in terminal device 101,102,103.
Fig. 2 is a kind of flow chart of application program analysis method shown according to an exemplary embodiment.
As shown in Fig. 2, multiple applications are disposed by predetermined condition in S202.Subscribing deployment can for example, will The multiple application is deployed in same server;The same database is deployed in the database used by the multiple In example;And extract it is the multiple using database configuration file in keyword, generate predetermined data-structure. It may be, for example, first established application program to be disposed, each application deployment opens the log of application on a server Writing function.Database involved in above-mentioned application is deployed in a database instance.
In one embodiment, generating predetermined data-structure includes: to be divided the SQL statement in data base configuration file Word generates the keyword by the sentence node after participle;And predetermined data-structure is generated by the keyword, in institute It states in predetermined data-structure, key is key value, and value is the mark of SQL statement.About the side for generating predetermined data-structure Formula will be described in detail later in this article.
In S204, runs the multiple application and record the operating condition of the multiple application by database journal. After completing above-mentioned deployment, multiple applications are run, wherein the full database log of database server unlatching textual form Record;Establish the corresponding relationship of Apply Names Yu IP server;Establish the corresponding relationship of Apply Names and database-name.
In S206, relationship forest is applied by establishing to the syntactic analysis of the multiple application, the application relationship is gloomy Woods includes multiple call relation trees, and the call relation tree passes through the relationship between method and generates.It can for example, to the source of application The unit file of backstage language carries out syntactic analysis in code;The institute of unit file in source code is established by the syntactic analysis State call relation tree;And the application relationship forest is generated by multiple call relation trees of multiple applications.
In one embodiment, call relation tree described in unit file in source code is established by the syntactic analysis to wrap It includes: recursive traversal is carried out to method used in the unit file;And the call relation using method as node, between method As side, the call relation tree is generated.
In one embodiment, syntactic analysis is carried out to the unit file of all backstage language in application source code, finds out source Dependence between code unit.Such as start import unit B file in A unit file, then it is mono- to illustrate that A unit file relies on B Meta file carries out recursive traversal to method used in the unit file, until all unit files have all carried out relying on closing Until system's analysis.
It in one embodiment, can also be for example according to the source code text in unit dependence and its corresponding unit file Part does further morphology and syntactic analysis, finds out the method related in unit file, one by one these methods of recursive traversal, When call method in method, such as int a1 (int x) ... b1 (y);B2 () ... }, combining unit dependence, positioning Unit file where called method and its method actually called out, until the method in all unit files is all divided Analysis is completed.Available call relation tree as shown in Figure 3: A::a1 (int) -> B::b1 (int), A::a1 (int) -> B::b2 (), each method is as a node.The different method of method name phase equivalent parameters, is considered as different methods.Father node represents Call method, child node represent called method, and the sequence of multiple child nodes is determined by the order of calling code.
In one embodiment, the application relationship forest is generated by multiple call relation trees of multiple applications.It calls In relational tree, the vertex of tree is the code entrance of top layer, and the leaf node of tree is usually external system calling or database SQL Operating method.There are one-to-one relationships for the configuration file of database SQL operating method and database SQL sentence.Pass through logarithm According to the analysis of library SQL configuration file, the relationship of database operation method Yu SQL configuration file can establish, further original Database SQL operating method leaf node under add SQL statement configuration node in SQL configuration file as child node, The child node is new leaf node, which stores the SQL statement unique identification in SQL configuration file.
In S208, by the database journal and the application relationship forest, call relation adjacency list is generated with right The multiple application is analyzed.It can for example, the data in the database journal are filtered processing, are generated predetermined Data structure;The mark of SQL statement is determined by the predetermined data-structure;It is closed by the mark of SQL statement in the application It is that the corresponding method call relationship of SQL statement is positioned in forest;And pass through all corresponding method call relationships of SQL statement The call relation adjacency list is generated to analyze the multiple application.
In one embodiment, SQL statement is positioned in data base key map, if the key in current SQL sentence There is the SQL configuration sentence an of unique identification in word, and sequence is equal, then it is assumed that the two is consistent, establishes SQL statement pass Connection, obtains the unique identification of SQL statement.
Being found according to the leaf node of all SQLs configuration of the unique identification of SQL statement between method in call relation should Mark, can be obtained method call relationship belonging to the SQL statement after positioning successfully.It is until multimap positions completion Only, the adjacency list of a call relation is ultimately generated.
The call relation adjacency list is generated to the multiple by all corresponding method call relationships of SQL statement It will be described in detail later in this article using the process analyzed.
According to the application program analysis method of the disclosure, by database log file successively on to location code, and most Dependence is obtained eventually, conveniently finds out potential problems.Can be in the case where mostly application share the deployment scenario of same database, positioning is answered The problem of with operational process, additionally it is possible to comb the flow of task and data flow between multiple applications.
It will be clearly understood that the present disclosure describes how to form and use particular example, but the principle of the disclosure is not limited to These exemplary any details.On the contrary, the introduction based on disclosure disclosure, these principles can be applied to many other Embodiment.
In one embodiment, generating predetermined data-structure includes: to be divided the SQL statement in data base configuration file Word generates the keyword by the sentence node after participle;And predetermined data-structure is generated by the keyword, in institute It states in predetermined data-structure, key is key value, and value is the mark of SQL statement.Detailed process can be for example as follows:
1) deployment package of the downloading to application deployment.
2) it decompresses, extracts data base configuration file.
3) the database configuration SQL statement nodal information related content in all data base configuration files is put into one by one Map (map is a kind of data structure, key, value key-value pair, and key is not reproducible), using the unique identification in SQL statement as Key, SQL statement is as value, if there is nested definition information in SQL statement, nested definition information is reduced to original A part in SQL, and SQL statement is reformulated, keep the sequence of original SQL statement.
Such as the content in data base configuration file is as follows:
<database SQL sentence unique identification>
Select nesting identifies Fields from A where id=$ { id }
</databaseSQLstatement unique identifier>
<nesting mark Fields>
Name, age
</nested identifierFields>
Formatted SQL statement is " select name, age from user where id=$ { id } ".
4) SQL in map is configured according to database simply to be segmented, each sentence node, i.e. keyword, be put into List data structure)
It 5) is the key value in set according to set data structure building data base key map, key, value is one List, database configures unique identification in map before the value in list is.
Database SQL sentence unique identification -> " select name, age from user where id "=(=operation Subsequent condition is accorded with because of its dynamically changeable, so abandoning)
Database SQL sentence unique identification is the key in map, the separated character pair of -> rear every a line or each space Answer an element in list.
In a kind of exemplary embodiment of the disclosure, by establishing the relationship of applying to the syntactic analysis of the multiple application Forest, the application relationship forest include multiple call relation trees, and the call relation tree passes through the relationship between method and generates packet It includes: syntactic analysis is carried out to the unit file of backstage language in the source code of application;Source code is established by the syntactic analysis The call relation tree of middle unit file;And it is gloomy by multiple call relation trees generation application relationship of multiple applications Woods.Wherein, establishing call relation tree described in unit file in source code by the syntactic analysis includes: to the unit file Used in method carry out recursive traversal;And using method as node, the call relation between method generates the tune as side Use relational tree.
In one embodiment, by database journal and the application relationship forest, generate call relation adjacency list with Carrying out analysis to the multiple application includes: that the data in the database journal are filtered processing, generates tentation data Structure;The mark of SQL statement is determined by the predetermined data-structure;It is gloomy in the application relationship by the mark of SQL statement The corresponding method call relationship of SQL statement is positioned in woods;And it is generated by all corresponding method call relationships of SQL statement The call relation adjacency list is to analyze the multiple application.Detailed process can be for example as follows:
1) it obtains and replicates a database journal record file, the abnormal logs such as database journal including mistake.
2) database request that different IP addresses send over is obtained, by the IP information in database request, database letter Breath, request time and SQL statement are recorded in a multimap data structure that (multimap is a kind of special map, that is, is permitted Perhaps the duplicate map of key value), key is request time, and primary individually solicited message is recorded as an entirety, is stored in In value, according to time ascending sort.
3) multimap is traversed, obtains SQL statement one by one, simple natural language processing is carried out to SQL statement, is removed Field value in where, the values value of insert, the field value in set in update.Keep original SQL sequence.Such as Original SQL be " select name, age the from formatted SQL of A where id=1000 " be " select name, Age from user where id=".
4) according to the IP of the request SQL of record, request application is navigated to, then positions SQL from affiliated application and configures sentence, Query context is reduced, is improved efficiency.
5) database in all data base configuration files is configured into SQL statement nodal information related content formats one by one It is put into data base key map (map is a kind of data structure, key, value key-value pair, and key is not reproducible), by SQL statement In unique identification as key, SQL statement is as value, if there is nested definition information in SQL statement, nested is determined Adopted information is reduced to a part in original SQL, and reformulates SQL statement, keeps the sequence of original SQL statement, goes simultaneously Fall its SQL statement for parameterizing part.Such as following data library configuration information:
<nesting mark Fields>
Name, age
</nested identifierFields>
<database SQL sentence unique identification>
Select nesting identifies Fields from A where id=$ { id }
</databaseSQLstatement unique identifier>
Formatted SQL statement is " select name, age from user where id="
6) SQL statement is positioned in data base key map, if the keyword in current SQL sentence has one The SQL of unique identification configures sentence, and sequence is equal, then it is assumed that the two is consistent, establishes SQL statement association, obtains SQL statement Unique identification.
7) leaf node of all SQL configuration according to the unique identification of SQL statement between method in call relation is found Method call relationship belonging to the SQL statement can be obtained in the mark after positioning successfully.It is until multimap positions completion Only.
8) adjacency list of call relation is generated.
In one embodiment, further includes: test prison is carried out to the multiple application by the call relation adjacency list Control.Wherein, for example the call relation adjacency list can be shown sequentially in time;The time is executed according to database statement Database journal is filtered;The corresponding code of exception information is associated to the code snippet for obtaining call method; And test problem positioning is carried out to the multiple application by code snippet, database statement, the call relation adjacency list. Detailed process can be for example as follows:
1) adjacency list structure schematic diagram shows analysis as a result, the behavior of adjacency list is actual from front to back in chronological order SQL executes sequence.
Using 1- > unit A:: method 1- > unit B:: method 2- > unit C:: SQL statement-in method 3- > database journal > execute the time
Using 2- > unit A:: method 1- > unit B:: method 2- > unit C:: SQL statement-in method 3- > database journal > execute the time
Using 3- > unit H:: SQL statement -> execution time in method 1- > database journal
Using 1- > unit I:: method A- > unit J:: SQL statement -> execution time in method B- > database journal
….
2) from existing log system, corresponding log lines number interval collection is oriented according to unit file title and method name It closes.
3) temporal filtering log lines number interval set is executed according to SQL, by premature log and after the SQL execution time Log filters out, and obtains a relatively reasonable daily record data.
If 4) log is wrong or exception information, mistake or exception information are individually extracted, and by its content with Its corresponding source code associates.
5) source code file of the corresponding application of traversal, obtains the corresponding code snippet of call method.
6) finally by code call relation, SQL statement, code and log are shown jointly with time sequencing, are conveniently asked Topic positioning and analysis.
According to the application program analysis method of the disclosure, it may be convenient to be found in operation in assignment test process or line Problem can unclog and readjust out using the dependence call relation between internalist methodology and application.
In one embodiment, further includes: assist the multiple application to carry out data by the call relation adjacency list Library deployment.
In one embodiment, when single user with exclusive mode by application to access database when, pass through traversal Multimap, when can directly obtain the operation application of single user itself using backstage SQL statement and its execute sequence, can be with The convenient data mock test method for carrying out related application is realized.
Database can be passed through when exclusive usage mode accesses database according to the application program analysis method of the disclosure SQL statement and execution time in log, obtain the SQL statement of access application in a manner of black box, for the data standard for testing environment It is standby that help is provided.
Traditional test monitoring analysis is from upward and downward, and analysis efficiency is low, it is also difficult to orientation problem.According to the disclosure Application program analysis method, the mode of bed-by-bed analysis application from bottom to top, can establish the call relation adjacency list between application, with Positioning analysis is carried out between the relationship multiple applications.
It will be appreciated by those skilled in the art that realizing that all or part of the steps of above-described embodiment is implemented as being executed by CPU Computer program.When the computer program is executed by CPU, above-mentioned function defined by the above method that the disclosure provides is executed Energy.The program can store in a kind of computer readable storage medium, which can be read-only memory, magnetic Disk or CD etc..
Further, it should be noted that above-mentioned attached drawing is only the place according to included by the method for disclosure exemplary embodiment Reason schematically illustrates, rather than limits purpose.It can be readily appreciated that above-mentioned processing shown in the drawings is not indicated or is limited at these The time sequencing of reason.In addition, be also easy to understand, these processing, which can be, for example either synchronously or asynchronously to be executed in multiple modules.
Following is embodiment of the present disclosure, can be used for executing embodiments of the present disclosure.It is real for disclosure device Undisclosed details in example is applied, embodiments of the present disclosure is please referred to.
Fig. 4 is a kind of block diagram of application program analytical equipment shown according to an exemplary embodiment.As shown in figure 4, answering It include: deployment module 402, logging modle 404, relationship module 406, analysis module 408 with Programmed Analysis Unit 40.
Deployment module 402 is for being disposed multiple applications by predetermined condition.
Logging modle 404 is used to run the multiple application and records the operation of the multiple application by database journal Situation.
Relationship module 406 is used to apply relationship forest, the application by establishing the syntactic analysis of the multiple application Relationship forest includes multiple call relation trees, and the call relation tree passes through the relationship between method and generates.
Analysis module 408 is used for through database journal and the application relationship forest, generate call relation adjacency list with The multiple application is analyzed.
According to the application program analytical equipment of the disclosure, by database log file successively on to location code, and most Dependence is obtained eventually, conveniently finds out potential problems.Can be in the case where mostly application share the deployment scenario of same database, positioning is answered The problem of with operational process, additionally it is possible to comb the flow of task and data flow between multiple applications.
Fig. 5 is the block diagram of a kind of electronic equipment shown according to an exemplary embodiment.
The electronic equipment 200 of this embodiment according to the disclosure is described referring to Fig. 5.The electronics that Fig. 5 is shown Equipment 200 is only an example, should not function to the embodiment of the present disclosure and use scope bring any restrictions.
As shown in figure 5, electronic equipment 200 is showed in the form of universal computing device.The component of electronic equipment 200 can wrap It includes but is not limited to: at least one processing unit 210, at least one storage unit 220, (including the storage of the different system components of connection Unit 220 and processing unit 210) bus 230, display unit 240 etc..
Wherein, the storage unit is stored with program code, and said program code can be held by the processing unit 210 Row, so that the processing unit 210 executes described in this specification above-mentioned electronic prescription circulation processing method part according to this The step of disclosing various illustrative embodiments.For example, the processing unit 210 can execute step as shown in Figure 2.
The storage unit 220 may include the readable medium of volatile memory cell form, such as random access memory Unit (RAM) 2201 and/or cache memory unit 2202 can further include read-only memory unit (ROM) 2203.
The storage unit 220 can also include program/practical work with one group of (at least one) program module 2205 Tool 2204, such program module 2205 includes but is not limited to: operating system, one or more application program, other programs It may include the realization of network environment in module and program data, each of these examples or certain combination.
Bus 230 can be to indicate one of a few class bus structures or a variety of, including storage unit bus or storage Cell controller, peripheral bus, graphics acceleration port, processing unit use any bus structures in a variety of bus structures Local bus.
Electronic equipment 200 can also be with one or more external equipments 300 (such as keyboard, sensing equipment, bluetooth equipment Deng) communication, can also be enabled a user to one or more equipment interact with the electronic equipment 200 communicate, and/or with make Any equipment (such as the router, modulation /demodulation that the electronic equipment 200 can be communicated with one or more of the other calculating equipment Device etc.) communication.This communication can be carried out by input/output (I/O) interface 250.Also, electronic equipment 200 can be with By network adapter 260 and one or more network (such as local area network (LAN), wide area network (WAN) and/or public network, Such as internet) communication.Network adapter 260 can be communicated by bus 230 with other modules of electronic equipment 200.It should Understand, although not shown in the drawings, other hardware and/or software module can be used in conjunction with electronic equipment 200, including but unlimited In: microcode, device driver, redundant processing unit, external disk drive array, RAID system, tape drive and number According to backup storage system etc..
Through the above description of the embodiments, those skilled in the art is it can be readily appreciated that example described herein is implemented Mode can also be realized by software realization in such a way that software is in conjunction with necessary hardware.Therefore, according to the disclosure The technical solution of embodiment can be embodied in the form of software products, which can store non-volatile at one Property storage medium (can be CD-ROM, USB flash disk, mobile hard disk etc.) in or network on, including some instructions are so that a calculating Equipment (can be personal computer, server or network equipment etc.) executes the above method according to disclosure embodiment.
Fig. 6 schematically shows a kind of computer readable storage medium schematic diagram in disclosure exemplary embodiment.
Refering to what is shown in Fig. 6, describing the program product for realizing the above method according to embodiment of the present disclosure 400, can using portable compact disc read only memory (CD-ROM) and including program code, and can in terminal device, Such as it is run on PC.However, the program product of the disclosure is without being limited thereto, in this document, readable storage medium storing program for executing can be with To be any include or the tangible medium of storage program, the program can be commanded execution system, device or device use or It is in connection.
Described program product can be using any combination of one or more readable mediums.Readable medium can be readable letter Number medium or readable storage medium storing program for executing.Readable storage medium storing program for executing for example can be but be not limited to electricity, magnetic, optical, electromagnetic, infrared ray or System, device or the device of semiconductor, or any above combination.The more specific example of readable storage medium storing program for executing is (non exhaustive List) include: electrical connection with one or more conducting wires, portable disc, hard disk, random access memory (RAM), read-only Memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disc read only memory (CD-ROM), light storage device, magnetic memory device or above-mentioned any appropriate combination.
The computer readable storage medium may include in a base band or the data as the propagation of carrier wave a part are believed Number, wherein carrying readable program code.The data-signal of this propagation can take various forms, including but not limited to electromagnetism Signal, optical signal or above-mentioned any appropriate combination.Readable storage medium storing program for executing can also be any other than readable storage medium storing program for executing Readable medium, the readable medium can send, propagate or transmit for by instruction execution system, device or device use or Person's program in connection.The program code for including on readable storage medium storing program for executing can transmit with any suitable medium, packet Include but be not limited to wireless, wired, optical cable, RF etc. or above-mentioned any appropriate combination.
Can with any combination of one or more programming languages come write for execute the disclosure operation program Code, described program design language include object oriented program language-Java, C++ etc., further include conventional Procedural programming language-such as " C " language or similar programming language.Program code can be fully in user It calculates and executes in equipment, partly executes on a user device, being executed as an independent software package, partially in user's calculating Upper side point is executed on a remote computing or is executed in remote computing device or server completely.It is being related to far Journey calculates in the situation of equipment, and remote computing device can pass through the network of any kind, including local area network (LAN) or wide area network (WAN), it is connected to user calculating equipment, or, it may be connected to external computing device (such as utilize ISP To be connected by internet).
Above-mentioned computer-readable medium carries one or more program, when said one or multiple programs are by one When the equipment executes, so that the computer-readable medium implements function such as: multiple applications are disposed by predetermined condition;Fortune The multiple application of row and the operating condition that the multiple application is recorded by database journal;By to the multiple application Syntactic analysis, which is established, applies relationship forest, and the application relationship forest includes multiple call relation trees, and the call relation tree is logical The relationship crossed between method generates;And by the database journal and the application relationship forest, it is adjacent to generate call relation Table is to analyze the multiple application.
It will be appreciated by those skilled in the art that above-mentioned each module can be distributed in device according to the description of embodiment, it can also Uniquely it is different from one or more devices of the present embodiment with carrying out corresponding change.The module of above-described embodiment can be merged into One module, can also be further split into multiple submodule.
By the description of above embodiment, those skilled in the art is it can be readily appreciated that example embodiment described herein It can also be realized in such a way that software is in conjunction with necessary hardware by software realization.Therefore, implemented according to the disclosure The technical solution of example can be embodied in the form of software products, which can store in a non-volatile memories In medium (can be CD-ROM, USB flash disk, mobile hard disk etc.) or on network, including some instructions are so that a calculating equipment (can To be personal computer, server, mobile terminal or network equipment etc.) it executes according to the method for the embodiment of the present disclosure.
It is particularly shown and described the exemplary embodiment of the disclosure above.It should be appreciated that the present disclosure is not limited to Detailed construction, set-up mode or implementation method described herein;On the contrary, disclosure intention covers included in appended claims Various modifications and equivalence setting in spirit and scope.
In addition, structure shown by this specification Figure of description, ratio, size etc., only to cooperate specification institute Disclosure, for skilled in the art realises that be not limited to the enforceable qualifications of the disclosure with reading, therefore Do not have technical essential meaning, the modification of any structure, the change of proportionate relationship or the adjustment of size are not influencing the disclosure Under the technical effect and achieved purpose that can be generated, it should all still fall in technology contents disclosed in the disclosure and obtain and can cover In the range of.Meanwhile cited such as "upper" in this specification, " first ", " second " and " one " term, be also only and be convenient for Narration is illustrated, rather than to limit the enforceable range of the disclosure, relativeness is altered or modified, without substantive change Under technology contents, when being also considered as the enforceable scope of the disclosure.

Claims (13)

1. a kind of application program analysis method characterized by comprising
Multiple applications are disposed by predetermined condition;
It runs the multiple application and records the operating condition of the multiple application by database journal;
Relationship forest is applied by establishing to the syntactic analysis of the multiple application, the application relationship forest includes multiple calling Relational tree, the call relation tree pass through the relationship between method and generate;And
By the database journal and the application relationship forest, generate call relation adjacency list with to it is the multiple apply into Row analysis.
2. the method as described in claim 1, which is characterized in that further include:
Test monitoring is carried out to the multiple application by the call relation adjacency list.
3. method according to claim 2, which is characterized in that by the call relation adjacency list to it is the multiple apply into Row test monitoring includes:
The call relation adjacency list is shown sequentially in time;
Database journal is filtered according to the database statement execution time;
The corresponding code of exception information is associated to the code snippet for obtaining call method;And
Test problem positioning is carried out to the multiple application by code snippet, database statement, the call relation adjacency list.
4. the method as described in claim 1, which is characterized in that further include:
The multiple application is assisted to carry out database deployment by the call relation adjacency list.
5. the method as described in claim 1, which is characterized in that multiple applications, which are carried out deployment by predetermined condition, includes:
The multiple application is deployed in same server;
It is deployed in the multiple in the same database instance with the database used;And
Extract it is the multiple using database configuration file in keyword, generate predetermined data-structure.
6. method as claimed in claim 5, which is characterized in that extract it is the multiple using database configuration file In keyword, generate predetermined data-structure include:
SQL statement in data base configuration file is segmented, the keyword is generated by the sentence node after participle;With And
Predetermined data-structure is generated by the keyword, in the predetermined data-structure, key is key value, and value is The mark of SQL statement.
7. the method as described in claim 1, which is characterized in that closed by establishing application to the syntactic analysis of the multiple application It is forest, the application relationship forest includes multiple call relation trees, and the call relation tree passes through the relationship between method and generates Include:
Syntactic analysis is carried out to the unit file of backstage language in the source code of application;
The call relation tree of unit file in source code is established by the syntactic analysis;And pass through the more of multiple applications A call relation tree generates the application relationship forest.
8. the method for claim 7, which is characterized in that establish unit file institute in source code by the syntactic analysis Stating call relation tree includes:
Recursive traversal is carried out to method used in the unit file;And
Using method as node, the call relation between method generates the call relation tree as side.
9. the method as described in claim 1, which is characterized in that by database journal and the application relationship forest, generate Call relation adjacency list with to the multiple application carry out analysis include:
Data in the database journal are filtered processing, generate predetermined data-structure;
The mark of SQL statement is determined by the predetermined data-structure;
The corresponding method call relationship of SQL statement is positioned in the application relationship forest by the mark of SQL statement;And
The call relation adjacency list is generated to the multiple application by all corresponding method call relationships of SQL statement It is analyzed.
10. method as claimed in claim 9, which is characterized in that the data in the database journal are filtered processing, Generating predetermined data-structure includes:
The data by database journal are subjected to natural language filtration treatment, generate predetermined data-structure.
11. a kind of application program analytical equipment characterized by comprising
Deployment module, for disposing multiple applications by predetermined condition;
Logging modle, for running the multiple operating condition applied and record the multiple application by database journal;
Relationship module, for applying relationship forest by establishing to the syntactic analysis of the multiple application, the application relationship is gloomy Woods includes multiple call relation trees, and the call relation tree passes through the relationship between method and generates;And
Analysis module, for generating call relation adjacency list to described by database journal and the application relationship forest Multiple applications are analyzed.
12. a kind of electronic equipment characterized by comprising
One or more processors;
Storage device, for storing one or more programs;
When one or more of programs are executed by one or more of processors, so that one or more of processors are real The now method as described in any in claim 1-10.
13. a kind of computer-readable medium, is stored thereon with computer program, which is characterized in that described program is held by processor The method as described in any in claim 1-10 is realized when row.
CN201810289532.XA 2018-04-03 2018-04-03 Application program analysis method, device, electronic equipment and computer readable medium Active CN110347573B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810289532.XA CN110347573B (en) 2018-04-03 2018-04-03 Application program analysis method, device, electronic equipment and computer readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810289532.XA CN110347573B (en) 2018-04-03 2018-04-03 Application program analysis method, device, electronic equipment and computer readable medium

Publications (2)

Publication Number Publication Date
CN110347573A true CN110347573A (en) 2019-10-18
CN110347573B CN110347573B (en) 2024-05-17

Family

ID=68172444

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810289532.XA Active CN110347573B (en) 2018-04-03 2018-04-03 Application program analysis method, device, electronic equipment and computer readable medium

Country Status (1)

Country Link
CN (1) CN110347573B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110995497A (en) * 2019-12-16 2020-04-10 厦门市美亚柏科信息股份有限公司 Method for unified operation and maintenance in cloud computing environment, terminal device and storage medium
CN112612944A (en) * 2020-12-07 2021-04-06 深圳价值在线信息科技股份有限公司 Case information management method, terminal equipment and system
CN112819577A (en) * 2021-01-28 2021-05-18 长沙市到家悠享网络科技有限公司 Dependency relationship visualization method, device, equipment and storage medium
CN113111367A (en) * 2021-04-28 2021-07-13 北京天空卫士网络安全技术有限公司 Security information management method, device and system

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050049999A1 (en) * 2003-08-29 2005-03-03 Immo-Gert Birn Database access statement tracing
CN104199831A (en) * 2014-07-31 2014-12-10 深圳市腾讯计算机系统有限公司 Information processing method and device
CN104636257A (en) * 2015-03-13 2015-05-20 胡兢玉 SQL coverage-based automatic testing method for application software in database based on
CN105354324A (en) * 2015-11-17 2016-02-24 国云科技股份有限公司 HC-SQL-based tree structure system and implementation method thereof
CN106020848A (en) * 2016-06-07 2016-10-12 北京信息科技大学 Function calling route generating method oriented to C#
CN106682210A (en) * 2016-12-30 2017-05-17 广州华多网络科技有限公司 Log file query method and device
CN106790718A (en) * 2017-03-16 2017-05-31 北京搜狐新媒体信息技术有限公司 Service call link analysis method and system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050049999A1 (en) * 2003-08-29 2005-03-03 Immo-Gert Birn Database access statement tracing
CN104199831A (en) * 2014-07-31 2014-12-10 深圳市腾讯计算机系统有限公司 Information processing method and device
CN104636257A (en) * 2015-03-13 2015-05-20 胡兢玉 SQL coverage-based automatic testing method for application software in database based on
CN105354324A (en) * 2015-11-17 2016-02-24 国云科技股份有限公司 HC-SQL-based tree structure system and implementation method thereof
CN106020848A (en) * 2016-06-07 2016-10-12 北京信息科技大学 Function calling route generating method oriented to C#
CN106682210A (en) * 2016-12-30 2017-05-17 广州华多网络科技有限公司 Log file query method and device
CN106790718A (en) * 2017-03-16 2017-05-31 北京搜狐新媒体信息技术有限公司 Service call link analysis method and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
吕照进;沈立炜;赵文耘;: "面向场景的安卓应用代码定位方法", 计算机科学, no. 02, 15 February 2017 (2017-02-15) *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110995497A (en) * 2019-12-16 2020-04-10 厦门市美亚柏科信息股份有限公司 Method for unified operation and maintenance in cloud computing environment, terminal device and storage medium
CN112612944A (en) * 2020-12-07 2021-04-06 深圳价值在线信息科技股份有限公司 Case information management method, terminal equipment and system
CN112612944B (en) * 2020-12-07 2024-05-31 深圳价值在线信息科技股份有限公司 Case information management method, terminal equipment and system
CN112819577A (en) * 2021-01-28 2021-05-18 长沙市到家悠享网络科技有限公司 Dependency relationship visualization method, device, equipment and storage medium
CN113111367A (en) * 2021-04-28 2021-07-13 北京天空卫士网络安全技术有限公司 Security information management method, device and system

Also Published As

Publication number Publication date
CN110347573B (en) 2024-05-17

Similar Documents

Publication Publication Date Title
CN106919655B (en) Answer providing method and device
Kagdi et al. Assigning change requests to software developers
US9697110B1 (en) Codeless system and tool for testing applications
US20190243831A1 (en) Query translation
US10303689B2 (en) Answering natural language table queries through semantic table representation
CN110347573A (en) Application program analysis method, device, electronic equipment and computer-readable medium
Nabil et al. Web-Based Applications quality factors: A survey and a proposed conceptual model
WO2010095867A2 (en) Customized intellectual system for searching internet information using symbols and icons through a mobile communication terminal and an ip-based information terminal
US10331441B2 (en) Source code mapping through context specific key word indexes and fingerprinting
US10769057B2 (en) Identifying potential errors in code using machine learning
CN106339380A (en) Method and device for recommending frequently asked question information
US9916158B2 (en) Cognitive feature analytics
US20110258531A1 (en) Method and Apparatus for Building Sales Tools by Mining Data from Websites
CN109033406A (en) For searching for the method, apparatus and storage medium of block chain data
US20140280228A1 (en) Semantic Mapping of Topic Map Meta-Models Identifying Assets and Events to Include Weights
US9123004B2 (en) Predicting an effect of events on assets
US11853196B1 (en) Artificial intelligence driven testing
Musleh et al. Automatic generation of android SQLite database components
CN113179183B (en) Service switch state control device and method
CN114328947A (en) Knowledge graph-based question and answer method and device
CN112416713A (en) Operation auditing system and method, computer readable storage medium and electronic equipment
CN112257100A (en) Method and device for detecting sensitive data protection effect and storage medium
CN109522226A (en) Big data platform test method, device, electronic equipment and computer-readable medium
CN109828983A (en) PG data base processing method, device, electronic equipment and storage medium
Wajid et al. Designing and evaluating a system of document recognition to support interoperability among collaborative enterprises

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