CN109542444A - Monitoring method, device, server and the storage medium of JAVA application - Google Patents

Monitoring method, device, server and the storage medium of JAVA application Download PDF

Info

Publication number
CN109542444A
CN109542444A CN201710641288.4A CN201710641288A CN109542444A CN 109542444 A CN109542444 A CN 109542444A CN 201710641288 A CN201710641288 A CN 201710641288A CN 109542444 A CN109542444 A CN 109542444A
Authority
CN
China
Prior art keywords
monitored
point
obtains
accurate
function
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
CN201710641288.4A
Other languages
Chinese (zh)
Other versions
CN109542444B (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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201710641288.4A priority Critical patent/CN109542444B/en
Publication of CN109542444A publication Critical patent/CN109542444A/en
Application granted granted Critical
Publication of CN109542444B publication Critical patent/CN109542444B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages

Abstract

The application provides monitoring method, device, server and the storage medium of a kind of JAVA application, combines DSL to carry out precompile this method comprises: applying to JAVA to be monitored, obtains filter;Filter is used to screen the key point for needing to monitor in the program code of JAVA application;In JAVA application operation to be monitored, Hash operation filtering is carried out using program code of the filter to JAVA application to be monitored, obtains doubtful inserting point;Word is carried out to doubtful inserting point according to filter and syntactic match is handled, obtains accurate inserting point and inserting logic;According to inserting logic, alternate form instrumentation operations are carried out to accurate inserting point, obtain monitored results.By combining DSL precompile, Bloom filter is generated, to accelerate the matching process for being populated class, improving performance is inserted by alternate form, can flexibly control monitoring.

Description

Monitoring method, device, server and the storage medium of JAVA application
Technical field
Monitoring method, device, server and the storage applied this application involves the communication technology more particularly to a kind of JAVA are situated between Matter.
Background technique
The complexity of large-scale JAVA application is higher and higher, will be used wider and wider.Therefore, application is monitored, is protected Its stable and high effective operation is demonstrate,proved, being out of order quickly to position, and become the important need of software development company.
Currently, the monitoring to large-scale JAVA application, mostly uses and buries mode a little in frame or program or without intrusion monitoring Technology is monitored.The mode buried in program a little refers to: it is buried in frame or program manually a little by exploitation or maintenance personnel, It is online simultaneously with monitored application, while output journal data, monitoring report is obtained by convergence analysis.Such as comment on the CAT of net System needs application developer, and in application development process, well-designed frame, selection suitably buries a position, compiles manually Program writing record log, which just now can run website, accomplishes to monitor in real time.The record log in application operational process is then right Data do aggregation process, and final analysis statistics obtains result.No intrusion monitoring technology is by answering by inserting to modify Java File is executed with the binary system of program, to realize the monitoring to the function in JAVA application.
However, the mode for burying a little in program is needed to do and be developed in advance, buries a program and application program and deposit, need exploit person It is low that member writes program flexibility, availability manually;Although no intrusion monitoring technology can not change program, without compiling, nothing Need it is offline in the case where realize monitoring, but inserting can introduce performance cost, and can not accomplish finely to the Java function applied Monitoring, and lack flexibility.
Summary of the invention
The application provides monitoring method, device, server and the storage medium of a kind of JAVA application, above-mentioned several for solving Developer is needed to write the low problem of program flexibility, availability manually in kind scheme.
The application first aspect provides a kind of monitoring method of JAVA application, which comprises
Applying to JAVA to be monitored combines DSL to carry out precompile, obtains filter;The filter is described for screening The key point for needing to monitor in the program code of JAVA application;
When the JAVA application to be monitored is run, using the filter to the journey of the JAVA application to be monitored Sequence code carries out Hash operation filtering, obtains doubtful inserting point;
Word is carried out to the doubtful inserting point according to the filter and syntactic match is handled, obtain accurate inserting point and Insert logic;
According to the inserting logic, alternate form instrumentation operations are carried out to the accurate inserting point, obtain monitored results.
In the present solution, generating Bloom filter by combining DSL precompile and being mentioned to accelerate the matching process for being populated class Performance is risen, and can flexibly control monitoring.
In a kind of concrete implementation mode, JAVA to be monitored is applied, DSL is combined to carry out precompile, obtains filter, Include:
Applying to the JAVA to be monitored combines DSL to carry out precompile, obtains the journey of the JAVA application to be monitored The point for needing to monitor in sequence code, and by the corresponding function signature typing Bloom filter of point for needing to monitor, obtain institute State filter.
It is described in the JAVA application operation to be monitored in a kind of concrete implementation mode, using the filter Hash operation filtering is carried out to the program code of the JAVA application to be monitored, obtains doubtful inserting point, comprising:
When running environment loads the JAVA to be monitored using corresponding code, JAVA application to be monitored is corresponded to Code in code carry out a Hash operation respectively, the result obtained after Hash operation was carried out using the filter Filter obtains the doubtful inserting point in the JAVA application to be monitored.
It is described according to the inserting logic in another specific implementation, the accurate inserting point is replaced Formula instrumentation operations obtain monitored results, comprising:
According to the inserting logic, the input and output of each accurate inserting point are taken over, and to the accurate inserting The corresponding programmer's code of point is replaced online;
The replaced program code of each accurate inserting point of operation, records monitored results.
This programme proposes the online replacement method inserted based on alternate form, replaces and control program behavior, Neng Gou completely Program execution logic is changed to line, the tasks such as online upgrading, accuracy controlling are completed.
Optionally, described according to the inserting logic, alternate form instrumentation operations are carried out to the accurate inserting point, obtain prison Control result, comprising:
According to the inserting logic, the original function of each accurate inserting point is obtained, and to the former letter of the accurate inserting point Replacement of modifying is counted, an inserting point replacement function is obtained;
It is alternately performed the corresponding original function of each accurate inserting point and replacement function, obtains and calls when executing replacement function Stack information, and bury a little in each call stack;When executing original function, statistics obtain at each call stack node function when Between information;
The monitored results are obtained according to each accurate corresponding call stack information of inserting point and the temporal information.
This programme proposes time-division replacement method on the basis of above-mentioned online replacement, and realizes that obtaining function accurately executes The mechanism of storehouse.
Optionally, described according to the inserting logic, alternate form instrumentation operations are carried out to the accurate inserting point, obtain prison Control result, comprising:
According to the inserting logic, the original function of each accurate inserting point is obtained, and to the former letter of the accurate inserting point Replacement of modifying is counted, an inserting point replacement function is obtained;
While executing the original function of each accurate inserting point, the replacement function is executed using another process, and Sampling is monitored to the execution of the original function by the replacement function, obtains the monitored results.
This programme is extended on the basis of above-mentioned online replacement, proposes space division replacement method, and realize acquisition function Execute the mechanism of flame figure.
Further, described to be alternately performed the corresponding original function of each accurate inserting point and replacement function, executing replacement Call stack information is obtained when function, and bury a little in each call stack;When executing original function, statistics obtains each call stack Temporal information at node function, comprising:
For each accurate inserting point, when calling for the first time, replacement function is executed, obtains call stack information and in each tune Bury a little with stack;Original function is executed in subsequent calling process, statistics obtains the time letter at each call stack node function Breath.
The application second aspect provides a kind of monitoring device of JAVA application, and described device includes:
First processing module combines DSL to carry out precompile, obtains filter for applying to JAVA to be monitored;It is described Filter is used to screen the key point for needing to monitor in the program code of the JAVA application;
Second processing module, in the JAVA application operation to be monitored, using the filter to it is described to The program code of the JAVA application of monitoring carries out Hash operation filtering, obtains doubtful inserting point;
Third processing module, for being carried out at word and syntactic match according to the filter to the doubtful inserting point Reason obtains accurate inserting point and inserting logic;
Fourth processing module, for carrying out alternate form instrumentation operations to the accurate inserting point according to the inserting logic, Obtain monitored results.
Optionally, the first processing module is specifically used for:
Applying to the JAVA to be monitored combines DSL to carry out precompile, obtains the journey of the JAVA application to be monitored The point for needing to monitor in sequence code, and by the corresponding function signature typing Bloom filter of point for needing to monitor, obtain institute State filter.
Optionally, the Second processing module is specifically used for:
When running environment loads the JAVA to be monitored using corresponding code, JAVA application to be monitored is corresponded to Code in code carry out a Hash operation respectively, the result obtained after Hash operation was carried out using the filter Filter obtains the doubtful inserting point in the JAVA application to be monitored.
Optionally, the fourth processing module is specifically used for:
According to the inserting logic, the input and output of each accurate inserting point are taken over, and to the accurate inserting The corresponding programmer's code of point is replaced online;
The replaced program code of each accurate inserting point of operation, records monitored results.
Optionally, the fourth processing module is specifically used for:
According to the inserting logic, the original function of each accurate inserting point is obtained, and to the former letter of the accurate inserting point Replacement of modifying is counted, an inserting point replacement function is obtained;
It is alternately performed the corresponding original function of each accurate inserting point and replacement function, obtains and calls when executing replacement function Stack information, and bury a little in each call stack;When executing original function, statistics obtain at each call stack node function when Between information;
The monitored results are obtained according to each accurate corresponding call stack information of inserting point and the temporal information.
Optionally, the fourth processing module is specifically used for:
According to the inserting logic, the original function of each accurate inserting point is obtained, and to the former letter of the accurate inserting point Replacement of modifying is counted, an inserting point replacement function is obtained;
While executing the original function of each accurate inserting point, the replacement function is executed using another process, and Sampling is monitored to the execution of the original function by the replacement function, obtains the monitored results.
Optionally, the fourth processing module is specifically used for:
For each accurate inserting point, when calling for the first time, replacement function is executed, obtains call stack information and in each tune Bury a little with stack;Original function is executed in subsequent calling process, statistics obtains the time letter at each call stack node function Breath.
The application third aspect provides a kind of server, comprising: memory, processor and computer program, the meter Calculation machine program stores in the memory, and the processor runs the computer program and executes described in any one of first aspect JAVA application monitoring method.
In above-mentioned server in the specific implementation, memory can be integrated in inside processor.The quantity of processor is at least One, for executing executing instruction for memory storage, i.e. computer program.
The application fourth aspect provides a kind of storage medium, comprising: readable storage medium storing program for executing and computer program, the calculating The monitoring method that machine program is applied for realizing the described in any item JAVA of first aspect.
The 5th aspect of the application provides a kind of program product, which includes computer program (executing instruction), The computer program is stored in readable storage medium storing program for executing.At least one processor of server can be read from readable storage medium storing program for executing The computer program, at least one processor execute the computer program and make server implementation first aspect or first aspect Various embodiments provide JAVA application monitoring method.
Monitoring method, device, server and the storage medium of JAVA application provided by the present application, by to be monitored JAVA, which is applied, combines DSL to carry out precompile, and the key point for needing to monitor in the program code for screening JAVA application obtained Filter, and in JAVA application operation to be monitored, it is breathed out using program code of the filter to JAVA application to be monitored Uncommon operation filtering, obtains doubtful inserting point, carries out word to doubtful inserting point according to filter and syntactic match is handled, obtain essence Really inserting point and inserting logic carry out alternate form instrumentation operations to accurate inserting point, obtain monitored results according to inserting logic. By combining DSL precompile, Bloom filter is generated, to accelerate the matching process for being populated class, improving performance, and can be flexible Control monitoring.
Detailed description of the invention
Fig. 1 is the flow chart of the monitoring method embodiment one of JAVA provided by the present application application;
Fig. 2 is the flow chart of the monitoring method embodiment two of JAVA provided by the present application application;
Fig. 3 is the flow chart of the monitoring method embodiment three of JAVA provided by the present application application;
Fig. 4 is the flow chart of the monitoring method example IV of JAVA provided by the present application application;
Fig. 5 is the structural schematic diagram of the monitoring device embodiment one of JAVA provided by the present application application.
Specific embodiment
The monitoring of large-scale java application, fault location are a problems.Point, data are buried to what no intrusion was done in Java application It extracts, can accomplish immediately monitoring under the premise of not modifying program code and binary system executes file.It is this to be supervised without intrusion Control technology is that current system detects tool, such as Jprofiler and application performance management (Application Performance Monitor, APM) system, such as AppDynamics, the foundation stone of NewRelic etc..However, being invaded for current nothing Enter the loss of monitoring technology performance height, inserting mode is short of flexibility, and precision is low etc., and disadvantages, the application first proposed performance optimization Scheme is then based on alternate form inserting, proposes more flexible, and finer online alternate form inserts scheme, compensates for technology sky It is white.
In the specific embodiment of this programme, it is related to following some concepts:
No intrusion monitoring (Non-intrusive Monitoring): by way of not interfering monitored system, to quilt Monitoring system expansion monitoring.
It inserts (Instrumentation): on the basis of guarantee tested program original logic integrality, inserting in a program Enter some probes, is dished out the mechanism of program operation characteristic data by the execution of probe.The technology in conjunction with data analysis technique, The control stream and the multidate informations such as traffic flow information and Logic coverage of program can be obtained, realizes test purpose.
Java Virtual Machine (Java Virtual Machine, JVM): the running environment of java applet, there are many different realities It is existing, the more commonly used Hotspot for oracle company, i.e., conventionally used java applet running environment.
Application performance management (Application Performance Management, APM): application performance management belongs to Field of network management refers mainly to be monitored the Mission critical applications of enterprise, optimize, and improves the reliability and matter of enterprise's application Amount, guarantees that user obtains good service.
Fig. 1 is the flow chart of the monitoring method embodiment one of JAVA provided by the present application application, as shown in Figure 1, the program It is realized on the server of operation JAVA application, the specific steps of the monitoring method of JAVA application include:
S101: applying JAVA to be monitored and DSL combined to carry out precompile, obtains filter;The filter is for sieving Select the key point for needing to monitor in the program code of the JAVA application.
In this step, it is applied for the large-scale JAVA towards specific area, designs domain-oriented language-specific (domain-specific languages, DSL), such as metadata, HTML etc., therefore carried out in the operation applied to JAVA When monitoring, it is thus necessary to determine that the key point that the needs in JAVA application monitor is determined, and specific method of determination is then pair JAVA combination DSL to be monitored carries out precompile, analyzes wherein possible key point, and the function label that will represent those key points In name typing Bloom filter, corresponding filter is obtained.
S102: when the JAVA application to be monitored is run, the JAVA to be monitored is answered using the filter Program code carries out Hash operation filtering, obtains doubtful inserting point.
It combines DSL to carry out precompile in the specific implementation, can apply to the JAVA to be monitored in this step, obtains institute State the point for needing to monitor in the program code of JAVA application to be monitored, and the corresponding function signature of point that the needs are monitored Typing Bloom filter obtains the filter.It is meant that: when JVM program of JAVA application to be monitored in load, I.e. when JVM loads java class, the filter (i.e. Bloom filter) obtained using above-mentioned steps quickly filters such, The mode of filtering is to be based on a Hash operation to the program of JAVA application quickly to exclude non-inserting point, obtains doubtful inserting point, Improving performance.
S103: carrying out word to the doubtful inserting point according to the filter and syntactic match handled, and obtains accurate insert Decorate and insert logic.
In this step, when running environment loads the JAVA to be monitored using corresponding code, to be monitored JAVA carries out a Hash operation using the code in corresponding code respectively, to described in the result use obtained after Hash operation Filter is filtered, and obtains the doubtful inserting point in the JAVA application to be monitored.The program is meant that: being passed through The Hash filters of previous step, have obtained doubtful inserting point, and inserting logic here refers to be replaced at the accurate inserting point Content, that is, inserting replacement can be carried out by indicating those codes.In order to accurately determine the essence in the JAVA application to be monitored Really inserting point, needs accurately to match obtained doubtful inserting point again, can specifically do to the content of doubtful inserting point Word, syntactic match (such as: regular grammar matching) obtain accurate inserting point therein, and determine that its inserts logic.
S104: according to the inserting logic, alternate form instrumentation operations is carried out to the accurate inserting point, obtain monitoring knot Fruit.
By the processing in above-mentioned two stage, most of java class, the Bloom filter filtering that can all generate the first stage Fall, without participating in subsequent morphology, grammer fine match and inserting process, can determine essence from JAVA to be monitored application Really inserting point, subsequent needs to carry out inserting monitoring at accurate inserting point.
Instrumentation operations in this programme and the Hook formula for increasing operation in the context for being populated function in the prior art Insert different, this programme is inserted using alternate form, i.e., replaces and grasp class behavior mode completely, is realized to accurate inserting point Monitoring, obtain corresponding monitored results.
The monitoring method of JAVA provided in this embodiment application, relate to it is a kind of towards JAVA application without intrusion monitoring system System, the precompile, compiling and inserting of domain-oriented language are connected, and can greatly improve the accuracy of inserting, are focused and are closed The relevant inserting point in the field of note, the field correlation inserting point that is determined in loading according to back do quick filtering, raising property Can, to the inserting point of confirmation, completes inserting monitoring and obtains corresponding monitored results, do not need developer and write program manually, Flexibility is improved, and additional performance cost will not be introduced, JAVA application function to be monitored is accomplished finely to monitor.
Based on the above embodiments it is found that this programme has designed and Implemented one towards JAVA application without intrusion monitoring system System has designed and Implemented precompile & compiling, has loaded, is woven into, operation, storage, the monitoring process shown.In step 1, by face Precompile, compiling and inserting to domain language connect, and can greatly improve the accuracy of inserting, focus the field of concern Relevant inserting point;Step 2, the field correlation inserting point that is determined in loading according to back do quick filtering, improve performance; Step 3 completes inserting to the inserting point of confirmation;4th step executes the function and inserting logic of JAVA class;5th step, collects The monitoring data extracted and a storage are buried in inserting;6th step completes data and analyzes and show.
On the basis of the above embodiments, the alternate form inserting monitoring scheme in S104 includes at least online replacement, time-division Replacement and space division replace several implementations, and these types of scheme is described in detail below.
The first implementation, Fig. 2 are the flow chart of the monitoring method embodiment two of JAVA provided by the present application application.Such as Shown in Fig. 2, alternate form in S104 inserting monitoring scheme specifically includes the following steps:
S201: according to the inserting logic, the input and output of each accurate inserting point are taken over, and to described accurate The corresponding programmer's code of inserting point is replaced online.
S202: the replaced program code of each accurate inserting point of operation records monitored results.
In this scenario, server obtains accurately inserting point and inserting logic according to abovementioned steps, is connect completely by inserting The right of execution of the function of point is inserted, and keeps the ability of the pending class of dynamic acquisition;In this way, by being inserted without intrusion, Neng Gou The execution logic for changing to line accurate inserting point, completes upgrading, or even replacement completely, supervises to replaced program code Control, obtains monitored results.
The traditional method of alternate form inserting is that adapter tube is populated the input of class (by taking Hello World class as an example), output, The Byte Code of HelloWorld is called to insert various logic before and later, it might even be possible to change input parameter and output is tied Fruit, user is it is seen that one is equivalent to the black box of HelloWorld.The online replacement of this programme is completely taken over by inserting The right of execution of HelloWorld, and the ability of the pending class of dynamic acquisition is kept, holding for HelloWorld can be changed online Row logic completes upgrading, or even replaces the Hello World class completely.Concrete implementation process are as follows: firstly, intercepting Hello The load of World is weighed;Choose operation, dynamic read configuration, obtain the class needed to be implemented: New Version;Finally carry out Execute operation, loads New Version, the right of execution of Hello World is handed to New Version.
The monitoring method for the JAVA application that this programme provides, proposes the online replacement method inserted based on alternate form, completely Program behavior is replaced and controlled, program execution logic can be changed online, completes the tasks such as online upgrading, accuracy controlling.
Based on the dynamic characteristic of Choose operation in online replacement, time-division effect may be implemented, i.e. the time-division replaces, not homogeneous When number calls, different programs is executed, complex logic is completed in combination.
Second of implementation, Fig. 3 are the flow chart of the monitoring method embodiment three of JAVA provided by the present application application.Such as Shown in Fig. 3, alternate form in S104 inserting monitoring scheme specifically includes the following steps:
S301: according to the inserting logic, the original function of each accurate inserting point is obtained, and to the accurate inserting point Original function is modified replacement, and an inserting point replacement function is obtained.
S302: it is alternately performed the corresponding original function of each accurate inserting point and replacement function, is obtained when executing replacement function Call stack information is taken, and bury a little in each call stack;When executing original function, statistics obtains each call stack node function The temporal information at place.
S303: the monitoring is obtained according to each accurate corresponding call stack information of inserting point and the temporal information As a result.
In above-mentioned steps, on the basis of embodiment shown in Fig. 2, the dynamic based on Choose operation in online replacement Time-division effect may be implemented in characteristic, i.e. the time-division replaces, and when different numbers call, executes different programs, combination is completed complexity and patrolled Volume, performance point function, i.e. original function at the point are obtained according to accurate inserting point, it specifically can be automatic based on DSL precompile It obtains, can also be specified by user, with no restrictions to this this programme, then modify, replaced to the logic of the original function Exchange the letters number executes original function and replacement function finally in the way of time-division replacement in turn, and dynamic tracing obtains replacement function Call stack information, and bury a little in each node of call stack, when calling original function, in each node function of above-mentioned call stack Place's output time statistical information, then can obtain executing timing diagram SpanTree. according to the result of statistics
In a kind of specific implementation of the program, for each accurate inserting point, when calling for the first time, replacement letter is executed Number obtains call stack information and bury a little in each call stack;Original function is executed in subsequent calling process, statistics obtains every Temporal information at a call stack node function.
Similarly by taking above-mentioned Hello World class as an example, the realization process of the time-division alternative are as follows: firstly, according to DSL precompile obtains the function Hello World of accurate inserting point;Time-division replaces Hello World, obtains replacement function;? When calling for the first time, replacement function is executed, dynamic tracing exports Hello World call stack information, and in each section of call stack Point bury a little, when calling for second, goes out to execute in Hello World and each function of above-mentioned call stack and buries a logic, Time statistical information is exported, SpanTree is obtained.
The monitoring method of JAVA application provided in this embodiment, is extended on the basis of above-mentioned online alternative, It proposes time-division replacement method, and realizes the mechanism for obtaining the accurate execution stack of function.
In the Execute operation replaced online, space division replacement can be completed, by deriving from new JVM process, concurrent is more It can cooperate with communication synchronization between process and complete complex logic.
The third implementation, Fig. 4 are the flow chart of the monitoring method example IV of JAVA provided by the present application application.Such as Shown in Fig. 4, alternate form in S104 inserting monitoring scheme specifically includes the following steps:
S401: according to the inserting logic, the original function of each accurate inserting point is obtained, and to the accurate inserting point Original function is modified replacement, and an inserting point replacement function is obtained.
S402: while executing the original function of each accurate inserting point, the replacement letter is executed using another process Number, and sampling is monitored to the execution of the original function by the replacement function, obtain the monitored results.
In above-mentioned steps, runtime server obtains performance point function, i.e. original function at the point according to accurate inserting point, It can specifically be obtained, can also be specified by user, with no restrictions to this this programme, then to this automatically based on DSL precompile The logic of original function is modified, and replacement function is obtained, and then space division replaces original function, and space division replacement here refers to holding Pair it before row original function, derives from a new JVM and executes replacement function, while the execution of original function is monitored, i.e., The JVM for executing original function is monitored, and (passes through interprocess communication (Inter- between two JVM processes between two JVM processes Process Communication, IPC) mechanism communicated) synchronous operation, monitoring JVM carries out the operation of original function whole Sampling, and sampled data is obtained, and flame figure can be drawn with the sampled data.
Likewise, by taking original function is Hello World class as an example, the specific implementation process of space division replacement are as follows: firstly, The function Hello World of accurate inserting point is obtained according to DSL precompile, space division replaces Hello World, intercepts Hello World derives from a new JVM process, to do jstack sampling to the process for executing Hello World.Then former letter is executed Number Hello World, while new JVM process is initialized, attach operation is done according to JVM of the pid to original function, whole process is to execution The execution state of the JVM process of original function is sampled, and the drafting and rendering of flame figure are finally carried out according to sampled result.
The monitoring method for the JAVA application that this programme provides, is extended on the basis of above-mentioned online replacement, passes through two A task parallelism executes, and is monitored to the executive condition of original function, flexibility is higher, and available flame figure.
Technical solution provided by the present application can be used in debugging, performance is called, accident analysis, because it does not require to recompilate Program, the binary system of program executes file can not be offline, is particularly suitable for the on line real-time monitoring for large size JAVA application.
Meanwhile the technical solution is not limited to JAVA language, the high-level language of any (such as JVM) when having operation, It can flexible, the high-precision function monitoring based on technology completion inserting speed-raising and mode.
Fig. 5 is the structural schematic diagram of the monitoring device embodiment one of JAVA provided by the present application application;As shown in figure 5, should JAVA application monitoring device 10 include:
First processing module 11 combines DSL to carry out precompile, obtains filter for applying to JAVA to be monitored;Institute State the key point for needing to monitor in program code of the filter for screening the JAVA application;
Second processing module 12, in the JAVA application operation to be monitored, using the filter to described The program code of JAVA application to be monitored carries out Hash operation filtering, obtains doubtful inserting point;
Third processing module 13, for being carried out at word and syntactic match according to the filter to the doubtful inserting point Reason obtains accurate inserting point and inserting logic;
Fourth processing module 14, for carrying out alternate form inserting behaviour to the accurate inserting point according to the inserting logic Make, obtains monitored results.
The monitoring device of JAVA application provided in this embodiment, for executing the monitoring method embodiment of aforementioned JAVA application Technical solution, it is similar that the realization principle and technical effect are similar, by JAVA to be monitored apply combine DSL carry out precompile, Filter is obtained, the key point for needing to monitor in the program code of JAVA application is then screened by filter, was then used Filter carries out Hash operation filtering to the program code of JAVA application to be monitored, doubtful inserting point is obtained, finally according to word Accurate inserting point and inserting logic are obtained from doubtful inserting point with syntactic match, alternate form finally is carried out to accurate inserting point and is inserted Dress operation is monitored, and accelerates the matching process for being populated class, improving performance, and can flexibly control monitoring.
On the basis of the above embodiments, in the monitoring device embodiment two of JAVA application, the first processing module 11 are specifically used for:
Applying to the JAVA to be monitored combines DSL to carry out precompile, obtains the journey of the JAVA application to be monitored The point for needing to monitor in sequence code, and by the corresponding function signature typing Bloom filter of point for needing to monitor, obtain institute State filter.
Optionally, the Second processing module 12 is specifically used for:
When running environment loads the JAVA to be monitored using corresponding code, JAVA application to be monitored is corresponded to Code in code carry out a Hash operation respectively, the result obtained after Hash operation was carried out using the filter Filter obtains the doubtful inserting point in the JAVA application to be monitored.
Optionally, the fourth processing module 14 is specifically used for:
According to the inserting logic, the input and output of each accurate inserting point are taken over, and to the accurate inserting The corresponding programmer's code of point is replaced online;
The replaced program code of each accurate inserting point of operation, records monitored results.
Optionally, the fourth processing module 11 is specifically used for:
According to the inserting logic, the original function of each accurate inserting point is obtained, and to the former letter of the accurate inserting point Replacement of modifying is counted, an inserting point replacement function is obtained;
It is alternately performed the corresponding original function of each accurate inserting point and replacement function, obtains and calls when executing replacement function Stack information, and bury a little in each call stack;When executing original function, statistics obtain at each call stack node function when Between information;
The monitored results are obtained according to each accurate corresponding call stack information of inserting point and the temporal information.
Optionally, the fourth processing module 14 is specifically used for:
According to the inserting logic, the original function of each accurate inserting point is obtained, and to the former letter of the accurate inserting point Replacement of modifying is counted, an inserting point replacement function is obtained;
While executing the original function of each accurate inserting point, the replacement function is executed using another process, and Sampling is monitored to the execution of the original function by the replacement function, obtains the monitored results.
Optionally, the fourth processing module 14 is specifically used for:
For each accurate inserting point, when calling for the first time, replacement function is executed, obtains call stack information and in each tune Bury a little with stack;Original function is executed in subsequent calling process, statistics obtains the time letter at each call stack node function Breath.
The monitoring device of JAVA application provided in this embodiment, for executing the monitoring method embodiment of aforementioned JAVA application Technical solution, it is similar that the realization principle and technical effect are similar, and details are not described herein.
The application also provides a kind of server, comprising: memory, processor and computer program, the computer journey Sequence stores in the memory, and the processor runs the JAVA application that the aforementioned any embodiment of the computer program provides Monitoring method technical solution.
In above-mentioned server in the specific implementation, the quantity of processor is at least one, for executing memory storage It executes instruction, i.e. computer program.Optionally, memory can also be integrated in inside processor.
The application also provides a kind of storage medium, comprising: readable storage medium storing program for executing and computer program, the computer program The technical solution of the monitoring method of JAVA application is provided for realizing aforementioned either method embodiment.
The application also provides a kind of program product, which includes computer program (executing instruction), the calculating Machine program is stored in readable storage medium storing program for executing.At least one processor of server can read the calculating from readable storage medium storing program for executing Machine program, at least one processor execute the JAVA that the computer program provides the aforementioned various embodiments of server implementation The technical solution of the monitoring method of application.
In server in the specific implementation, it should be understood that processor can be central processing unit (English: Central Processing Unit, referred to as: CPU), it can also be other general processors, digital signal processor (English: Digital Signal Processor, referred to as: DSP), specific integrated circuit (English: Application Specific Integrated Circuit, referred to as: ASIC) etc..General processor can be microprocessor or the processor is also possible to any conventional place Manage device etc..It can be embodied directly in hardware processor in conjunction with the step of method disclosed in the present application and execute completion or use Hardware and software module combination in reason device execute completion.
Realizing all or part of the steps of above-mentioned each method embodiment, this can be accomplished by hardware associated with program instructions. Program above-mentioned can store in a readable access to memory.When being executed, execute includes above-mentioned each method embodiment to the program The step of;And memory (storage medium) above-mentioned include: read-only memory (English: read-only memory, abbreviation: ROM), RAM, flash memory, hard disk, solid state hard disk, tape (English: magnetic tape), floppy disk (English: floppy Disk), CD (English: optical disc) and any combination thereof.

Claims (16)

1. a kind of monitoring method of JAVA application, which is characterized in that the described method includes:
Applying to JAVA to be monitored combines language-specific DSL in field to carry out precompile, obtains filter;The filter is used for Screen the key point for needing to monitor in the program code of the JAVA application;
When the JAVA application to be monitored is run, using the filter to the program generation of the JAVA application to be monitored Code carries out Hash operation filtering, obtains doubtful inserting point;
Word is carried out to the doubtful inserting point according to the filter and syntactic match is handled, obtains accurate inserting point and inserting Logic;
According to the inserting logic, alternate form instrumentation operations are carried out to the accurate inserting point, obtain monitored results.
2. combine DSL to carry out precompile the method according to claim 1, wherein applying to JAVA to be monitored, Obtain filter, comprising:
Applying to the JAVA to be monitored combines DSL to carry out precompile, obtains the program generation of the JAVA application to be monitored The point for needing to monitor in code, and by the corresponding function signature typing Bloom filter of point for needing to monitor, obtain the mistake Filter.
3. method according to claim 1 or 2, which is characterized in that it is described when the JAVA application to be monitored is run, Hash operation filtering is carried out using program code of the filter to the JAVA application to be monitored, obtains doubtful inserting Point, comprising:
When running environment loads the JAVA to be monitored using corresponding code, is applied to JAVA to be monitored corresponding generation Code in code carries out a Hash operation respectively, is filtered to the result obtained after Hash operation using the filter, Obtain the doubtful inserting point in the JAVA application to be monitored.
4. according to the described in any item methods of claims 1 to 3, which is characterized in that it is described according to the inserting logic, to the essence Really inserting point carries out alternate form instrumentation operations, obtains monitored results, comprising:
According to the inserting logic, the input and output of each accurate inserting point are taken over, and to the accurate inserting point pair The programmer's code answered is replaced online;
The replaced program code of each accurate inserting point of operation, records monitored results.
5. method according to any one of claims 1 to 3, which is characterized in that it is described according to the inserting logic, to described Accurate inserting point carries out alternate form instrumentation operations, obtains monitored results, comprising:
According to the inserting logic, obtain the original function of each accurate inserting point, and to the original function of the accurate inserting point into Row modification replacement obtains inserting point replacement function;
It is alternately performed the corresponding original function of each accurate inserting point and replacement function, call stack letter is obtained when executing replacement function Breath, and bury a little in each call stack;When executing original function, statistics obtains the time letter at each call stack node function Breath;
The monitored results are obtained according to each accurate corresponding call stack information of inserting point and the temporal information.
6. method according to any one of claims 1 to 3, which is characterized in that it is described according to the inserting logic, to described Accurate inserting point carries out alternate form instrumentation operations, obtains monitored results, comprising:
According to the inserting logic, obtain the original function of each accurate inserting point, and to the original function of the accurate inserting point into Row modification replacement obtains inserting point replacement function;
While executing the original function of each accurate inserting point, the replacement function is executed using another process, and pass through The replacement function is monitored sampling to the execution of the original function, obtains the monitored results.
7. according to the method described in claim 5, it is characterized in that, described be alternately performed the corresponding former letter of each accurate inserting point Several and replacement function obtains call stack information when executing replacement function, and bury a little in each call stack;Executing former letter When number, statistics obtains the temporal information at each call stack node function, comprising:
For each accurate inserting point, when calling for the first time, replacement function is executed, obtains call stack information and in each call stack Bury a little;Original function is executed in subsequent calling process, statistics obtains the temporal information at each call stack node function.
8. a kind of monitoring device of JAVA application, which is characterized in that described device includes:
First processing module combines language-specific DSL in field to carry out precompile, obtains filtering for applying to JAVA to be monitored Device;The filter is used to screen the key point for needing to monitor in the program code of the JAVA application;
Second processing module, in the JAVA application operation to be monitored, using the filter to described to be monitored JAVA application program code carry out Hash operation filtering, obtain doubtful inserting point;
Third processing module is obtained for carrying out word and syntactic match processing to the doubtful inserting point according to the filter Take accurate inserting point and inserting logic;
Fourth processing module, for carrying out alternate form instrumentation operations to the accurate inserting point, obtaining according to the inserting logic Monitored results.
9. device according to claim 8, which is characterized in that the first processing module is specifically used for:
Applying to the JAVA to be monitored combines DSL to carry out precompile, obtains the program generation of the JAVA application to be monitored The point for needing to monitor in code, and by the corresponding function signature typing Bloom filter of point for needing to monitor, obtain the mistake Filter.
10. device according to claim 8 or claim 9, which is characterized in that the Second processing module is specifically used for:
When running environment loads the JAVA to be monitored using corresponding code, is applied to JAVA to be monitored corresponding generation Code in code, such as function name carry out a Hash operation respectively, use the filtering to the result obtained after Hash operation Device is filtered, and obtains the doubtful inserting point in the JAVA application to be monitored.
11. according to the described in any item devices of claim 8 to 10, which is characterized in that the fourth processing module is specifically used for:
According to the inserting logic, the input and output of each accurate inserting point are taken over, and to the accurate inserting point pair The programmer's code answered is replaced online;
The replaced program code of each accurate inserting point of operation, records monitored results.
12. according to the described in any item devices of claim 8 to 10, which is characterized in that the fourth processing module is specifically used for:
According to the inserting logic, obtain the original function of each accurate inserting point, and to the original function of the accurate inserting point into Row modification replacement obtains inserting point replacement function;
It is alternately performed the corresponding original function of each accurate inserting point and replacement function, call stack letter is obtained when executing replacement function Breath, and bury a little in each call stack;When executing original function, statistics obtains the time letter at each call stack node function Breath;
The monitored results are obtained according to each accurate corresponding call stack information of inserting point and the temporal information.
13. according to the described in any item devices of claim 8 to 10, which is characterized in that the fourth processing module is specifically used for:
According to the inserting logic, obtain the original function of each accurate inserting point, and to the original function of the accurate inserting point into Row modification replacement obtains inserting point replacement function;
While executing the original function of each accurate inserting point, the replacement function is executed using another process, and pass through The replacement function is monitored sampling to the execution of the original function, obtains the monitored results.
14. device according to claim 12, which is characterized in that the fourth processing module is specifically used for:
For each accurate inserting point, when calling for the first time, replacement function is executed, obtains call stack information and in each call stack Bury a little;Original function is executed in subsequent calling process, statistics obtains the temporal information at each call stack node function.
15. a kind of server characterized by comprising memory, processor and computer program, the computer program In the memory, it is described in any item that the processor runs the computer program perform claim requirement 1 to 7 for storage The monitoring method of JAVA application.
16. a kind of storage medium characterized by comprising readable storage medium storing program for executing and computer program, the computer program are used In the monitoring method for realizing the described in any item JAVA applications of claim 1 to 7.
CN201710641288.4A 2017-07-31 2017-07-31 JAVA application monitoring method, device, server and storage medium Active CN109542444B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710641288.4A CN109542444B (en) 2017-07-31 2017-07-31 JAVA application monitoring method, device, server and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710641288.4A CN109542444B (en) 2017-07-31 2017-07-31 JAVA application monitoring method, device, server and storage medium

Publications (2)

Publication Number Publication Date
CN109542444A true CN109542444A (en) 2019-03-29
CN109542444B CN109542444B (en) 2022-03-25

Family

ID=65823529

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710641288.4A Active CN109542444B (en) 2017-07-31 2017-07-31 JAVA application monitoring method, device, server and storage medium

Country Status (1)

Country Link
CN (1) CN109542444B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111338613A (en) * 2020-03-03 2020-06-26 中国工商银行股份有限公司 Front-end point burying method and device based on jsp
CN111580813A (en) * 2020-03-25 2020-08-25 博雅信安科技(北京)有限公司 Automatic management method for Java class hot update
CN113419935A (en) * 2021-06-22 2021-09-21 康键信息技术(深圳)有限公司 Mobile terminal performance monitoring method, device, equipment and storage medium
CN113434399A (en) * 2021-06-23 2021-09-24 青岛海尔科技有限公司 Service node log processing method and device, storage medium and electronic device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103617705A (en) * 2013-12-10 2014-03-05 北京邮电大学 Rule-based method and system for alarming of Internet of things
US20170024194A1 (en) * 2015-07-22 2017-01-26 Oracle International Corporation Optimization techniques for high-level graph language compilers
CN106664322A (en) * 2014-08-29 2017-05-10 微软技术许可有限责任公司 Event stream transformations

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103617705A (en) * 2013-12-10 2014-03-05 北京邮电大学 Rule-based method and system for alarming of Internet of things
CN106664322A (en) * 2014-08-29 2017-05-10 微软技术许可有限责任公司 Event stream transformations
US20170024194A1 (en) * 2015-07-22 2017-01-26 Oracle International Corporation Optimization techniques for high-level graph language compilers

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
高伟: "可定制的web监控系统的设计与实现", 《中国优秀硕士学位论文全文数据库信息科技辑》 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111338613A (en) * 2020-03-03 2020-06-26 中国工商银行股份有限公司 Front-end point burying method and device based on jsp
CN111580813A (en) * 2020-03-25 2020-08-25 博雅信安科技(北京)有限公司 Automatic management method for Java class hot update
CN111580813B (en) * 2020-03-25 2022-09-02 博雅信安科技(北京)有限公司 Automatic management method for Java class hot update
CN113419935A (en) * 2021-06-22 2021-09-21 康键信息技术(深圳)有限公司 Mobile terminal performance monitoring method, device, equipment and storage medium
CN113419935B (en) * 2021-06-22 2023-10-20 康键信息技术(深圳)有限公司 Mobile terminal performance monitoring method, device, equipment and storage medium
CN113434399A (en) * 2021-06-23 2021-09-24 青岛海尔科技有限公司 Service node log processing method and device, storage medium and electronic device
CN113434399B (en) * 2021-06-23 2023-06-16 青岛海尔科技有限公司 Service node log processing method and device, storage medium and electronic device

Also Published As

Publication number Publication date
CN109542444B (en) 2022-03-25

Similar Documents

Publication Publication Date Title
US11099820B2 (en) Reconfiguring application software into microservice architecture
CN107704392B (en) Test case processing method and server
US10621068B2 (en) Software code debugger for quick detection of error root causes
CN105094783B (en) method and device for testing stability of android application
CN103970659B (en) Android application software automation testing method based on pile pitching technology
US7933759B2 (en) Predicate checking for distributed systems
US7900198B2 (en) Method and system for parameter profile compiling
US9355003B2 (en) Capturing trace information using annotated trace output
CN101393535B (en) Method and system for associating event and assembly while working
CN107832207A (en) Interface performance test method, apparatus, storage medium and computer equipment
CN109542444A (en) Monitoring method, device, server and the storage medium of JAVA application
Ng et al. Identification of behavioural and creational design motifs through dynamic analysis
CN101794224B (en) Software run-time property monitoring method based on property specification mode
CN105184166A (en) Kernel-based Android application real-time behavior analysis method and system
Kirbas et al. The relationship between evolutionary coupling and defects in large industrial software
CN106156353A (en) A kind of method and system increasing multilingual on-the-flier compiler enforcement engine for data base
CN114978940B (en) Link monitoring and alarming method, device, computer equipment and storage medium
CN103186463B (en) Determine the method and system of the test specification of software
CN106529304B (en) A kind of Android applies concurrent leakage location
US11119899B2 (en) Determining potential test actions
CN108021495B (en) Code debugging method based on playback
US10417116B2 (en) System, method, and apparatus for crowd-sourced gathering of application execution events for automatic application testing and replay
CN115061837B (en) Method and device for scheduling, tracking and acquiring user space call stack
Burrows et al. Coupling metrics for aspect-oriented programming: A systematic review of maintainability studies
CN104778087B (en) A kind of information processing method and information processing unit

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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20200217

Address after: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen

Applicant after: HUAWEI TECHNOLOGIES Co.,Ltd.

Address before: 210012 HUAWEI Nanjing base, 101 software Avenue, Yuhuatai District, Jiangsu, Nanjing

Applicant before: Huawei Technologies Co.,Ltd.

GR01 Patent grant
GR01 Patent grant