A kind of fault filling method, device and equipment
Technical field
This specification is related to field of computer technology more particularly to a kind of fault filling method, device and equipment.
Background technique
In internet system, after monomer applications are split into multiple applications, distribution can be passed through between different application
Service framework, or RPC (Remote Procedure Call, remote procedure call) can also may be implemented by scheduled
Service framework carry out communication interaction, to realize the internet system of Service-Oriented Architecture Based, and be facing generally towards service architecture
Internet system needs to carry out for certain service to monitor on line.
In general, can judge whether have abnormal behaviour by injecting fault data into specified services method to realize
Fault-tolerant ability specifically can inject fault data before or after the realization logic of original method of servicing, wherein the event
Writing and (being write by programming languages such as Java) for barrier data is completed inside method of servicing realization, can be made every time new
Increase fault type (or failure behavior) and/or when injection condition need to issue new application code, with update application accordingly and
Operation system, and application and operation system such as are also required to be compiled fault data at the processing accordingly, so that failure is infused
It is more complex to enter logic, direct fault location inefficiency, accordingly, it is desirable to provide it is a kind of it is more simple and fast, direct fault location is more efficient
Scheme.
Summary of the invention
The purpose of this specification embodiment is to provide a kind of fault filling method, device and equipment, a kind of simpler to provide
Single scheme quick, direct fault location is more efficient.
To realize that above-mentioned technical proposal, this specification embodiment are achieved in that
A kind of fault filling method that this specification embodiment provides, comprising:
The call request of interception target method of servicing, include in the call request destination service method mark and
The numerical value of call parameters;
If scheduled target faults description information and the mark of the destination service method and the numerical value phase of call parameters
Matching then injects the corresponding target faults injection logic of the target faults description information to the destination service method, with true
Surely the fail result that the target faults injection logic generates is executed, the target faults description information includes carrying out direct fault location
Method of servicing corresponding with the method for servicing call parameters of mark numerical value.
Optionally, described that the corresponding target faults note of the target faults description information is injected to the destination service method
Enter logic, comprising:
Obtain the corresponding fault type of the target faults injection logic, the fault type includes preposition class and non-preposition
Class;
If the fault type is preposition class, the target faults description information is injected to the destination service method
Corresponding target faults injection logic.
Optionally, the preposition class includes throwing mistake, postponing and distort parameter values,
If the fault type is preposition class, the target faults are injected to the destination service method and are described
The corresponding target faults injection logic of information, comprising:
If the fault type is that the first subclass in preposition class judges whether adjusting according to first subclass
Before the destination service method, the corresponding target faults of the target faults description information are injected to the destination service method
Injection logic, wherein first subclass is to throw mistake, postpone or distort parameter values.
Optionally, the target faults description information is write by Domain Specific Language DSL.
It optionally, include multiple critical fielies in the target faults description information, the multiple critical field is used respectively
The mark of the method for servicing of direct fault location and the numerical value of call parameters are carried out in characterization, and the content of the fault logic injected.
Optionally, multiple critical fielies of the target faults description information are respectively FROM, WHERE and UPDATE.
Optionally, the method also includes:
The content of the target faults description information is analyzed, the corresponding content of each critical field is respectively obtained;
If scheduled target faults description information and the mark of the destination service method and the numerical value phase of call parameters
Matching then injects the corresponding target faults injection logic of the target faults description information to the destination service method, comprising:
If the mark and call parameters of the obtained corresponding content of the critical field and the destination service method
Numerical value matches, then injects the corresponding target faults injection of the target faults description information to the destination service method and patrol
Volume.
Optionally, described that the corresponding target faults note of the target faults description information is injected to the destination service method
After entering logic, the method also includes:
Using Java tool Java Instrument or towards tangent plane programming AOP mechanism, target faults injection is patrolled
The return value of the numerical value or the call parameters of collecting corresponding call parameters is modified, and is patrolled with updating the target faults injection
Volume.
A kind of fault injection device that this specification embodiment provides, comprising:
Blocking module is requested, includes the mesh in the call request for the call request of interception target method of servicing
Mark the mark of method of servicing and the numerical value of call parameters;
Injection module, if mark and calling for scheduled target faults description information and the destination service method
The numerical value of parameter matches, then injects the corresponding target faults of the target faults description information to the destination service method and infuse
Enter logic, with the determining fail result for executing the target faults injection logic and generating, the target faults description information includes
Carry out the numerical value of the mark call parameters corresponding with the method for servicing of the method for servicing of direct fault location.
Optionally, described device towards tangent plane programming AOP mechanism by determining.
Optionally, the injection module, comprising:
Type acquiring unit, for obtaining the corresponding fault type of the target faults injection logic, the fault type
Including preposition class and non-preposition class;
Injection unit injects the mesh to the destination service method if being preposition class for the fault type
Mark the corresponding target faults injection logic of failure-description information.
Optionally, the preposition class includes throwing mistake, postponing and distort parameter values,
The injection unit, if being the first subclass in preposition class for the fault type, according to described first
Subclass judges whether before calling the destination service method, injects the target faults to the destination service method and describes
The corresponding target faults injection logic of information, wherein first subclass is to throw mistake, postpone or distort parameter values.
Optionally, the target faults description information is write by Domain Specific Language DSL.
It optionally, include multiple critical fielies in the target faults description information, the multiple critical field is used respectively
The mark of the method for servicing of direct fault location and the numerical value of call parameters are carried out in characterization, and the content of the fault logic injected.
Optionally, multiple critical fielies of the target faults description information are respectively FROM, WHERE and UPDATE.
Optionally, described device further include:
Analysis module is analyzed for the content to the target faults description information, respectively obtains each keyword
The corresponding content of section;
The injection module, if the corresponding content of the critical field and the destination service method for obtaining
The numerical value of mark and call parameters matches, then it is corresponding to inject the target faults description information to the destination service method
Target faults injection logic.
Optionally, described device further include:
Data update module, it is right for utilizing Java tool Java Instrument or towards tangent plane programming AOP mechanism
The numerical value of the corresponding call parameters of the target faults injection logic or the return value of the call parameters are modified, to update
The target faults injection logic.
A kind of Fault Insertion Equipment that this specification embodiment provides, the Fault Insertion Equipment include:
Processor;And
It is arranged to the memory of storage computer executable instructions, the executable instruction makes the place when executed
Manage device:
The call request of interception target method of servicing, include in the call request destination service method mark and
The numerical value of call parameters;
If scheduled target faults description information and the mark of the destination service method and the numerical value phase of call parameters
Matching then injects the corresponding target faults injection logic of the target faults description information to the destination service method, with true
Surely the fail result that the target faults injection logic generates is executed, the target faults description information includes carrying out direct fault location
Method of servicing corresponding with the method for servicing call parameters of mark numerical value.
The technical solution provided by above this specification embodiment is as it can be seen that this specification embodiment passes through interception target service
The call request of method includes the mark of destination service method and the numerical value of call parameters in the call request, in scheduled mesh
In the case that the numerical value of the mark and call parameters of mark failure-description information and destination service method matches, to destination service side
Method injects the corresponding target faults injection logic of target faults description information, to determine what performance objective direct fault location logic generated
Fail result, target faults description information include carrying out the mark and the corresponding calling of method of servicing of the method for servicing of direct fault location
The numerical value of parameter, in this way, it is only necessary to by described in failure-description information carry out direct fault location method of servicing mark and
The information such as the numerical value of the corresponding call parameters of method of servicing can select the method for servicing in operation system, and carry out
The injection of corresponding target faults injection logic, so that the fail result of performance objective direct fault location logic generation is obtained, without
Need to write the mark of the method for servicing of above-mentioned carry out direct fault location and the numerical value and mesh of the corresponding call parameters of method of servicing
The related program code for marking the information such as direct fault location logic does not need to carry out using the server or terminal device of operation system yet
The compilation process of program code enormously simplifies the treatment process of direct fault location, improves direct fault location efficiency.
Detailed description of the invention
In order to illustrate more clearly of this specification embodiment or technical solution in the prior art, below will to embodiment or
Attached drawing needed to be used in the description of the prior art is briefly described, it should be apparent that, the accompanying drawings in the following description is only
The some embodiments recorded in this specification, for those of ordinary skill in the art, in not making the creative labor property
Under the premise of, it is also possible to obtain other drawings based on these drawings.
Fig. 1 is a kind of fault filling method embodiment of this specification;
Fig. 2 is the process schematic of one of the relevant technologies direct fault location scheme;
Fig. 3 is this specification another kind fault filling method embodiment;
Fig. 4 is a kind of structural schematic diagram of fault injection system of this specification;
Fig. 5 is a kind of fault injection device embodiment of this specification;
Fig. 6 is a kind of Fault Insertion Equipment embodiment of this specification.
Specific embodiment
This specification embodiment provides a kind of fault filling method, device and equipment.
In order to make those skilled in the art more fully understand the technical solution in this specification, below in conjunction with this explanation
Attached drawing in book embodiment is clearly and completely described the technical solution in this specification embodiment, it is clear that described
Embodiment be only this specification a part of the embodiment, instead of all the embodiments.The embodiment of base in this manual,
Every other embodiment obtained by those of ordinary skill in the art without making creative efforts, all should belong to
The range of this specification protection.
Embodiment one
As shown in Figure 1, this specification embodiment provides a kind of fault filling method, the executing subject of this method can be clothes
Business device, wherein the server can be to be made of an independent server, is also possible to the service being made of multiple servers
Device cluster etc., which, which can be, provides the server of service for a certain item business or multinomial business, which can use
In the one or more operation systems of carrying.This method can be used for judging whether certain operation system has a certain or certain one kind and refer to
In the processing such as fault-tolerant ability of fixed abnormal behaviour.This method can specifically include following steps:
In step s 102, the call request of interception target method of servicing includes the destination service side in the call request
The mark of method and the numerical value of call parameters.
Wherein, destination service method can be in certain one or more service in any business for solve the problems, such as certain or
The method for realizing certain function, destination service method can be created in the application, and be cited elsewhere, target clothes
Business method can be by multiple sentences write using predetermined programming language, to solve the problems, such as certain or the step of realizing certain function is
Multiple sentences are composed by built-up sequence, and multiple sentences, which are combined, can execute a function or solve the problems, such as a certain
Deng.Call request can be to be executed for invocation target method of servicing, to realize the request of certain function.The mark of destination service method
Knowledge can be title (i.e. method name) or coding of destination service method of destination service method etc..Call parameters, which can be, to be used for
Parameter required for invocation target method of servicing executes.
In an implementation, for internet system, with the continuous promotion of business complexity, amount of access and data volume, before
Common monomer applications are gradually split into multiple applications, can pass through Distributed Services between the different application in multiple applications
Frame can also pass through the scheduled service that RPC (Remote Procedure Call, remote procedure call) may be implemented
Frame carries out communication interaction, to realize the internet system of Service-Oriented Architecture Based.Business dismantling through the above way, can be with
So that the complexity of operation system with the dismantling of application (or application system) by cohesion inside each application, also, it is each
O&M, capacity planning of application etc. can be carried out independently.At the same time, application process under Service-Oriented Architecture Based itself is ill-mannered
The status information of state information, application process can be external into external persistent storage system, such as external can arrive DB
In (DataBase, database).
Based on above content, business dismantling can make the application generated have above-mentioned two variation, and then can make
The service that primary complete service request has been disassembled at striding course service call tree, as tree node can have following spy
Sign: method of servicing can towards interface rather than realize;It the call parameters of method of servicing and returns the result as POJO (Plain
Ordinary Java Object, simple Java object), rather than the object of conditioning;Method of servicing be far call rather than
It is local to call.
For having accomplished the internet system of Service-Oriented Architecture Based, monitored on line generally directed to servicing: for each clothes
Desired indicator (rate that such as reports an error, response time, upstream and downstream data consistency and amount of access) configuration monitoring deep bid of business;For difference
Monitoring deep bid can configure different monitoring threshold values, to alarm etc. the exception service method call occurred in system.
And for the validity of monitoring deep bid monitoring, it can usually take the mode of direct fault location to realize, specifically, for
The special services of inline system are called, and abnormal behaviour data are injected under special parameter, period, for example, the abnormal row of delay
For data, the abnormal behaviour data to report an error or the abnormal behaviour data for distorting parameter values etc..Then, it is infused in abnormal behaviour data
After entering, can observe monitoring alarm as a result, to judge to monitor whether deep bid has the ability for finding such abnormal behaviour.
For example, that is, using A and using B, two applications are respectively arranged with clothes as shown in Fig. 2, two applications can be split as
Be engaged in interface, in general, in the application may include multiple method of servicing, as using in A including method of servicing 1 and method of servicing 2,
Using in B include method of servicing 1 and method of servicing 2 etc., in general, can by into specified services method inject fault data come
The fault-tolerant ability for judging whether to have abnormal behaviour is realized, as shown in Fig. 2, can be before the realization logic of original method of servicing
Or fault data is injected later.By the processing mode of upper figure it is found that being write due to fault data is in method of servicing realization
Portion completes, and new applies generation so that increasing fault type (or failure behavior) newly every time and/or needing when injection condition to issue
Code, moreover, the injection of fault data and the realization of method of servicing are indicated by same programming language (such as Java language),
And common programming language is procedural programming language, rather than the programming language of descriptionization, express and be meant that " how
Do " rather than " what does ", so that the meaning (failure is semantic) of sentence behind can not be embodied in speech level.In addition, above-mentioned
Direct fault location logic in processing mode has certain model utility, such as both for special services method, in call parameters number
Value and calling time of origin meet to be injected under specified conditions, moreover, the failure of injection generally comprises delay, throws mistake, distorts
Three kinds of parameter values etc., in order to solve the above problem existing for direct fault location in method of servicing, this specification embodiment provides one
Kind implementation, can specifically include the following contents:
In view of different direct fault location scenes is the various combination for above-mentioned mode, therefore exists and pass through DSL
(Domain Specific Language, Domain Specific Language) language is abstracted a possibility that direct fault location logic, meanwhile, consider
Fault type to injection can be enumerated, and therefore, fault type can also be abstracted as the syntactic element in DSL language, so that
Syntactic element includes that failure is semantic.If direct fault location logic can be expressed by the DSL language of descriptionization, DSL language
Grammatical element itself can embody direct fault location semanteme, moreover, fault logic can drive enforcement engine to be infused by DSL
Enter, the mode used for explanatory rather than compiled, can make change or update fault type and/or when injection condition without
It need to issue and restart and be applied on the line injected, be based on this, failure can be write by DSL language in this specification embodiment and retouched
State information.
Specified application can be installed in the terminal device (such as mobile phone, tablet computer or computer) of user, passed through
The application can provide one or more different services for user, each service can be real by one or more method of servicing
Existing, different functions may be implemented in different method of servicing.When user needs to carry out a certain item operation or a certain using the application
When item business, the key provided in application or link etc. can be provided, after getting trigger action, the triggering can be executed
Operate corresponding processing logic, wherein may include the calling to certain method of servicing (i.e. destination service method), work as terminal device
Determine that title of available destination service method etc. identifies and the number of call parameters when needing invocation target method of servicing
Value etc., and the call request of destination service method can be generated based on the information or data of above-mentioned acquisition, and can be by the calling
Request is sent to server, at this point, server can intercept the call request.
In step S104, if the mark and call parameters of scheduled target faults description information and destination service method
Numerical value match, then to the corresponding target faults injection logic of destination service method injection target faults description information, with true
Determine the fail result of performance objective direct fault location logic generation, which includes carrying out the service of direct fault location
The numerical value of the mark of method call parameters corresponding with the method for servicing.
Wherein, it is based on above content, target faults description information can be is write by DSL language, target faults description
Information can be used for describing needing the case where meeting preset injection condition, patrol certain method of servicing injection direct fault location
Volume, to determine the fail result for executing the direct fault location logic and generating, the failure tolerant ability of operation system, failure are judged according to this
Fault-tolerant ability may include that whether there is or not self-healing abilities and operation system management whether there is or not the ability for the behavior of noting abnormalities, operation system itself
Emergency investigation ability of person etc..Failure-description information does not need operation system and is compiled to it, but can be directly by business
Network analysis goes out the mark of method of servicing therein and the numerical value of call parameters and its corresponding target faults injection logic
Deng, and execute and target faults injection logic corresponding operation.Target faults injection logic can be by corresponding data come table
Sign, then at this point, target faults injection logic can be target faults injection data, which injects tables of data and service is illustrated
The mark of method and the numerical value of call parameters etc., and to which method of servicing, any failure is injected under which kind of injection condition
(or fault logic) etc., in addition, target faults injection logic can also can be characterized by other to which method of servicing, at what
Any way what failure is injected under kind injection condition indicates, for example, pass through flow chart or the logic figure of implementation procedure etc.,
This specification embodiment does not limit this.
In an implementation, can be believed according to different requirements, by the failure-description that DSL language writes different method of servicing
It ceases, may include the mark of different method of servicing and the call parameters of corresponding method of servicing in different failure-description information
Numerical value.The failure-description information (i.e. target faults description information) write for interim storage and management can be preset
Management system can store it in above-mentioned management system after the completion of by failure-description message composition, and can be by this
Management system pushes corresponding failure-description information to corresponding operation system in real time.Operation system receives failure-description letter
After breath, which can be analyzed, therefrom the targeted method of servicing of the available failure-description information
(that is to say to which method of servicing injection direct fault location logic) injects failure note in what under the conditions of of the method for servicing
Entering logic (that is to say the injection condition of direct fault location logic, may include the corresponding call parameters of the method for servicing and its numerical value
Deng) and the content of fault logic etc., after obtaining above- mentioned information, above- mentioned information can be stored in the server of operation system
In.
It, can be to this after the call request of destination service method is intercepted in the processing of server S102 through the above steps
Call request is analyzed, therefrom the numerical value of the mark of available destination service method and call parameters, and then, server can
The method of servicing that the mark of destination service method and target faults description information are directed to first is carried out matching comparison, if target
The method of servicing that the mark of method of servicing is directed to target faults description information matches, then can further by call parameters and
Call parameters and its numerical value in its numerical value and above-mentioned target faults description information carry out matching comparison, if the two match,
It can then determine that the target faults description information is the failure-description information for destination service method.If destination service method
The method of servicing that is directed to the target faults description information of mark mismatch, and/or, call parameters and its numerical value and above-mentioned mesh
The call parameters and its numerical value marked in failure-description information mismatch, then continue to execute the processing of above-mentioned steps S102, that is, continue
Other method of servicing are intercepted, and carry out the processing of above-mentioned steps S104.
Target faults description information can be the associated description information for the direct fault location that destination service method needs to carry out, this
When, the corresponding target faults injection logic of target faults description information can be injected to destination service method can after the completion of injection
To execute the target faults injection logic of injection, pass through the available corresponding failure knot of the target faults injection logic of execution
It is corresponding with target faults injection logic can to judge whether server or operation system have by obtained fail result for fruit
The fault-tolerant ability of the abnormal behaviour of fault category.If verification passes through, it may indicate that the operation system can continue to use, such as
Fruit verification does not pass through, then can modify to operation system, also guarantees the safety of operation system.
It should be noted that in above-mentioned treatment process, it can be according to failure-description information, from the normal call of method of servicing
In filter out expectation inject failure (or fault logic) one or many calling carry out direct fault location logic injection, specifically
Ground might have a method of servicing and call (such as 10 times or 5 inferior) many times, if merely desire to wherein certain is primary (such as
Call parameters meet certain requirement etc.) do failure (or fault logic) injection, then what the failure-description information that DSL writes described can
To be how to be selected from above-mentioned multiple calling the method for servicing to call desired that time and inject current calling assorted
Failure (or fault logic) etc..
This specification embodiment provides a kind of fault filling method, should by the call request of interception target method of servicing
The numerical value of mark and call parameters in call request including destination service method, in scheduled target faults description information and mesh
In the case that the numerical value of the mark and call parameters of marking method of servicing matches, to the injection target faults description of destination service method
The corresponding target faults injection logic of information, to determine the fail result of performance objective direct fault location logic generation, target faults
Description information includes the numerical value for carrying out the mark and the corresponding call parameters of method of servicing of the method for servicing of direct fault location, in this way,
Only need the mark and the corresponding tune of method of servicing of the method for servicing by carrying out direct fault location described in failure-description information
The information such as the numerical value with parameter can select the method for servicing in operation system, and carry out corresponding target faults note
Enter the injection of logic, so that the fail result of performance objective direct fault location logic generation is obtained, without writing above-mentioned progress
The numerical value of the corresponding call parameters of mark and method of servicing of the method for servicing of direct fault location and target faults injection logic etc.
The related program code of information does not need to carry out the compiled of program code using the server or terminal device of operation system yet
Journey enormously simplifies the treatment process of direct fault location, improves direct fault location efficiency.
Embodiment two
As shown in figure 3, this specification embodiment provides a kind of fault filling method, the executing subject of this method can be clothes
Business device, wherein the server can be to be made of an independent server, is also possible to the service being made of multiple servers
Device cluster etc., which, which can be, provides the server of service for a certain item business or multinomial business, which can use
In the one or more operation systems of carrying.This method can be used for judging whether certain operation system has a certain or certain one kind and refer to
In the processing such as fault-tolerant ability of fixed abnormal behaviour.This method can specifically include following steps:
As shown in figure 4, in operation system AOP (Aspect Oriented can be passed through to the reference of downstream service
Programming, towards tangent plane programming) mechanism determines direct fault location blocker, direct fault location blocker can be used for carrying therefore
Barrier description information simultaneously analyzes failure-description information, at the same time it can also be intercepted to the method for servicing that downstream request is called, and it is right
Specified method of servicing injection direct fault location logic etc..
In step s 302, the content of target faults description information is analyzed, respectively obtains each critical field pair
The content answered.
In an implementation, during injecting direct fault location logic to method of servicing, it is to be understood that the information of three aspects, i.e.,
Which method of servicing the direct fault location logic (that is to say the targeted method of servicing of failure-description information) is injected, in the clothes to
Business method what under the conditions of inject the direct fault location logic and (that is to say the injection condition of direct fault location logic, may include this
The corresponding call parameters of method of servicing and its numerical value etc.), and injection fault logic content etc., in this specification embodiment
Based on the information of above-mentioned three aspect, failure-description information is write using DSL, the specific syntax can be such that
Dsl:='UPDATE'inject [', ' inject]+' FROM'serviceSignature'WHERE'
expression
Inject:=delay | throw | manipulate
Delay:='DELAY (' time') '
Time:=digit+
Throw:='THROW (' exceptionClassName') '
Manipulate:='MANIPULATE (' paraIdx', ' targetValue') '
ParaIdx:=digit+
TargetValue:=literal
ServiceSignature:=packageName'.'interfaceName'.'methodNa me
Expression:=expression logicOperator expression
|'('expression')'
|paramKey compareOperator literal
LogicOperator:='OR'| ' AND'
CompareOperator:='>' | '<' | '=' | '!='
Literal:=' " ' char+' " '
ParamKey:='['digit+'] " .'OGNL | ' { time } '
Wherein, font is italic but non-overstriking is nonterminal symbol, and font is italic and overstriking is the language of Java language
The grammer etc. of method or OGNL (Object-Graph Navigation Language, object diagram navigation language) language, single quotation marks
Interior part is character, and remaining part can be terminal symbol etc..
The failure-description information write by above-mentioned DSL can be determined including multiple critical fielies, such as " UPDATE "
Field, " FROM " field and " WHERE " field etc., different fields can correspond to different effects, and different field is corresponding
Content can be different, as the corresponding content of UPDATE field can be the content of fault logic (or failure), FROM field pair
The content answered can be injects (mark etc. that is to say method of servicing) for which method of servicing, and WHERE field is corresponding
Content can be call parameters and its numerical value etc..
For example, certain serviced component is realized such as lower interface:
Wherein, AssetDecreaseRequest may include following critical field:
Wherein, the content of above-mentioned multiple critical fielies may refer to following failure-description information are as follows:
UPDATE DELAY(100)
FROM com.alipay.paycore.service.payment.asset.AssetFluxService.decren
ent
WHERE [1] .assetExtra [" userId "]=208800000000000000;AND{time}>
'2017-12-3122:01:00'AND{time}>'2017-12-31 22:01:59'。
Above-mentioned failure-description information can be indicated for com.alipay.paycore.service.payment.asset.
This method of servicing of AssetFluxService.decrement, in the primary calling to it, the 1st parameter
The key of assetExtra field (really a map), i.e. userId correspond to value be equal to ' 2088000000000000', and adjust
When with the time between 2017-12-3122:01:00 to 2017-12-31 22:01:59, injection postpones 100 milliseconds of failure
(or fault logic) (wherein, it should be noted that for calling every time, need to postpone 100 milliseconds).
The failure-description information of different method of servicing can be write by DSL according to different requirements,.As shown in figure 4, can
To preset the management system of failure-description information, after the completion of by failure-description message composition, can store it in
It states in management system, and corresponding failure-description information can be pushed to corresponding operation system by the management system in real time.
After operation system receives the failure-description information, which can be analyzed, can therefrom be respectively obtained
UPDATE field, FROM field and the corresponding content of WHERE field.Based on above-mentioned example, available UPDATE field is corresponding
Content be DELAY (100), the corresponding content of FROM field be com.alipay.paycore.service.payment.ass
The corresponding content of et.AssetFluxService.decrenent, WHERE field be [1] .assetExtra [" userId "]=
208800000000000000;AND{time}>'2017-12-3122:01:00'AND{time}>'2017-12-31 22:01:
59'.Above content correspondence can be stored in the server of operation system.
It should be noted that the failure-description information write by DSL does not need operation system and is compiled to it, but
The mark of method of servicing therein and the numerical value of call parameters, and corresponding failure note can be directly analyzed by operation system
Enter logic etc., and executes and the direct fault location logic corresponding operation.
In addition, the critical field for including in failure-description information is not limited to UPDATE field mentioned above, FROM word
Section and WHERE field etc. can also include in practical applications a variety of other critical fielies, can specifically set according to the actual situation
It is fixed, it is not limited this in this specification embodiment.
In step s 304, the call request of interception target method of servicing includes destination service method in the call request
Mark and call parameters numerical value.
In an implementation, as shown in figure 4, when the method for servicing (i.e. destination service method) that downstream relies on needs called,
Downstream can send call request to operation system can be by direct fault location blocker institute after the call request reaches operation system
It intercepts, to intercept the call request of destination service method, wherein may include destination service method in the call request
The numerical value of mark and call parameters.
In step S306, if the mark and call parameters of scheduled target faults description information and destination service method
Numerical value match, then the corresponding fault type of target faults injection logic is obtained, before which includes preposition class and is non-
Set class.
Wherein, target faults description information can be is write by Domain Specific Language DSL.In target faults description information
It may include multiple critical fielies, and multiple critical fielies are respectively used to the corresponding method of servicing of characterization target faults description information
Mark and call parameters numerical value.Multiple critical fielies of target faults description information respectively can for FROM, WHERE and
UPDATE etc..In addition, the critical field for including in failure-description information is not limited to UPDATE field mentioned above, FROM word
Section and WHERE field etc. can also include in practical applications a variety of other critical fielies, can specifically set according to the actual situation
It is fixed, it is not limited this in this specification embodiment.
In an implementation, since failure usually may include preposition class failure and non-preposition class failure, rather than preposition class failure
Fail result can not usually be showed to user or technical staff, and be only in operation system internal record, therefore, before non-
It sets class failure and possibly can not directly obtain corresponding direct viewing fault as a result, for this purpose, in this specification embodiment, it can be only to failure
Type is the injection that preposition class failure carries out direct fault location logic, therefore, to the injection target faults injection of destination service method
Before logic, the corresponding fault type of target faults injection logic can be obtained from target faults description information, alternatively, can be with
By preassign etc. modes determine the corresponding fault type of target faults injection logic, and judge the fault type whether be before
Class is set, if it is not, then original destination service method logic can be executed with invocation target method of servicing, it is corresponding to realize
Function.
It should be noted that if the method for servicing that the mark of destination service method is directed to the target faults description information
It mismatches, and/or, call parameters and its call parameters and its numerical value mismatch in numerical value and above-mentioned failure-description information, then
Original destination service method logic can be executed with invocation target method of servicing, to realize corresponding function, meanwhile, Ke Yiji
The continuous processing for executing above-mentioned steps S304, that is, continue to intercept other method of servicing.
In step S308, if above-mentioned fault type is preposition class, destination service method injection target faults are retouched
State the corresponding target faults injection logic of information.
In an implementation, as shown in figure 4, if the processing of S306 determines that target faults injection logic is corresponding through the above steps
Fault type is preposition class, then can inject target faults injection logic to destination service method, after the completion of injection, can execute
The target faults injection logic of injection can be with by the available corresponding fail result of the target faults injection logic of execution
Obtained fail result is recorded in serve log (such as log file etc.).When user or technical staff need to check it is above-mentioned
When fail result, corresponding serve log can be obtained by monitoring system, and can be obtained from the serve log corresponding
Fail result can judge whether server or operation system have and target faults injection logic by obtained fail result
The fault-tolerant ability of the abnormal behaviour of corresponding fault category.If verification passes through, it may indicate that the operation system can continue
It uses, if verification does not pass through, operation system can be modified, also guarantee the safety of operation system.
In practical applications, above-mentioned preposition class may include three subclasses such as throwing mistake, postponing and distort parameter values, above-mentioned
The processing of step S308 can be varied, and a kind of optional processing mode presented below can specifically include the following contents: such as
The above-mentioned fault type of fruit is that the first subclass in preposition class judges whether then according to the first subclass in invocation target method of servicing
Before, target faults injection logic corresponding to destination service method injection target faults description information, the first subclass is to throw mistake, prolong
Late or distort parameter values.
In an implementation, it if the corresponding fault type of target faults injection logic is preposition class, may further determine that
The corresponding failure of target faults injection logic (or fault logic), which belongs to, throws mistake, which son in parameter values is postponed and distort
Class, and can the specific subclass according to belonging to the failure (or fault logic), judge need before invocation target method of servicing,
Target faults injection logic corresponding to destination service method injection target faults description information, it is desired nonetheless to be taken in invocation target
After business method, target faults injection logic corresponding to destination service method injection target faults description information, and can root
It is judged that as a result, to the corresponding target faults injection logic of destination service method injection target faults description information.
In step s310, using Java tool Java Instrument or towards tangent plane programming AOP mechanism, to target
The numerical value of the corresponding call parameters of direct fault location logic or the return value of the call parameters are modified, to update target faults note
Enter logic.
In an implementation, after to the corresponding target faults injection logic of destination service method injection target faults description information,
If necessary to modify to the target faults injection logic after injection, then it can use Java tool Java Instrument
Or towards tangent plane programming AOP mechanism (or being also possible to be similar to AOP mechanism etc.), tune corresponding to target faults injection logic
It is modified with the return value of the numerical value of parameter or the call parameters, and online code replacement is carried out to operation system, to plant
Enter specific fault logic, to realize the detection or verification of failure by corresponding fault logic.
This specification embodiment provides a kind of fault filling method, should by the call request of interception target method of servicing
The numerical value of mark and call parameters in call request including destination service method, in scheduled target faults description information and mesh
In the case that the numerical value of the mark and call parameters of marking method of servicing matches, to the injection target faults description of destination service method
The corresponding target faults injection logic of information, to determine the fail result of performance objective direct fault location logic generation, target faults
Description information includes the numerical value for carrying out the mark and the corresponding call parameters of method of servicing of the method for servicing of direct fault location, in this way,
Only need the mark and the corresponding tune of method of servicing of the method for servicing by carrying out direct fault location described in failure-description information
The information such as the numerical value with parameter can select the method for servicing in operation system, and carry out corresponding target faults note
Enter the injection of logic, so that the fail result of performance objective direct fault location logic generation is obtained, without writing above-mentioned progress
The numerical value of the corresponding call parameters of mark and method of servicing of the method for servicing of direct fault location and target faults injection logic etc.
The related program code of information does not need to carry out the compiled of program code using the server or terminal device of operation system yet
Journey enormously simplifies the treatment process of direct fault location, improves direct fault location efficiency.
Embodiment three
The above are the fault filling methods that this specification embodiment provides, and are based on same thinking, this specification embodiment
A kind of fault injection device is also provided, as shown in Figure 5.
The fault injection device includes: request blocking module 501 and injection module 502, in which:
Blocking module 501 is requested, includes described for the call request of interception target method of servicing, in the call request
The mark of destination service method and the numerical value of call parameters;
Injection module 502, if for scheduled target faults description information and the destination service method mark and
The numerical value of call parameters matches, then injects the corresponding target event of the target faults description information to the destination service method
Hinder injection logic, to determine the fail result for executing the target faults injection logic and generating, the target faults description information
Numerical value including carrying out the mark call parameters corresponding with the method for servicing of the method for servicing of direct fault location.
In this specification embodiment, described device towards tangent plane programming AOP mechanism by determining.
In this specification embodiment, the injection module 502, comprising:
Type acquiring unit, for obtaining the corresponding fault type of the target faults injection logic, the fault type
Including preposition class and non-preposition class;
Injection unit injects the mesh to the destination service method if being preposition class for the fault type
Mark the corresponding target faults injection logic of failure-description information.
In this specification embodiment, the preposition class includes throwing mistake, postponing and distort parameter values,
The injection unit, if being the first subclass in preposition class for the fault type, according to described first
Subclass judges whether before calling the destination service method, injects the target faults to the destination service method and describes
The corresponding target faults injection logic of information, wherein first subclass is to throw mistake, postpone or distort parameter values.
In this specification embodiment, the target faults description information is write by Domain Specific Language DSL.
It include multiple critical fielies, the multiple key in the target faults description information in this specification embodiment
Field is respectively used to the mark of the method for servicing of characterization progress direct fault location and the numerical value of call parameters, and the failure of injection is patrolled
The content collected.
In this specification embodiment, multiple critical fielies of the target faults description information be respectively FROM, WHERE and
UPDATE。
In this specification embodiment, described device further include:
Analysis module is analyzed for the content to the target faults description information, respectively obtains each keyword
The corresponding content of section;
The injection module, if the corresponding content of the critical field and the destination service method for obtaining
The numerical value of mark and call parameters matches, then it is corresponding to inject the target faults description information to the destination service method
Target faults injection logic.
In this specification embodiment, described device further include:
Data update module, it is right for utilizing Java tool Java Instrument or towards tangent plane programming AOP mechanism
The numerical value of the corresponding call parameters of the target faults injection logic or the return value of the call parameters are modified, to update
The target faults injection logic.
This specification embodiment provides a kind of fault injection device, should by the call request of interception target method of servicing
The numerical value of mark and call parameters in call request including destination service method, in scheduled target faults description information and mesh
In the case that the numerical value of the mark and call parameters of marking method of servicing matches, to the injection target faults description of destination service method
The corresponding target faults injection logic of information, to determine the fail result of performance objective direct fault location logic generation, target faults
Description information includes the numerical value for carrying out the mark and the corresponding call parameters of method of servicing of the method for servicing of direct fault location, in this way,
Only need the mark and the corresponding tune of method of servicing of the method for servicing by carrying out direct fault location described in failure-description information
The information such as the numerical value with parameter can select the method for servicing in operation system, and carry out corresponding target faults note
Enter the injection of logic, so that the fail result of performance objective direct fault location logic generation is obtained, without writing above-mentioned progress
The numerical value of the corresponding call parameters of mark and method of servicing of the method for servicing of direct fault location and target faults injection logic etc.
The related program code of information does not need to carry out the compiled of program code using the server or terminal device of operation system yet
Journey enormously simplifies the treatment process of direct fault location, improves direct fault location efficiency.
Example IV
The above are the fault injection devices that this specification embodiment provides, and are based on same thinking, this specification embodiment
A kind of Fault Insertion Equipment is also provided, as shown in Figure 6.
The Fault Insertion Equipment can be server provided by the above embodiment, may include passing through face in the server
(or it can be direct fault location to the direct fault location blocker of tangent plane programming AOP Mechanism establishing and intercept function or direct fault location and block
Mechanism of cutting etc.).
Fault Insertion Equipment can generate bigger difference because configuration or performance are different, may include one or one with
On processor 601 and memory 602, can store one or more storage application programs or number in memory 602
According to.Wherein, memory 602 can be of short duration storage or persistent storage.The application program for being stored in memory 602 may include one
A or more than one module (diagram is not shown), each module may include can to the series of computation machine in Fault Insertion Equipment
It executes instruction.Further, processor 601 can be set to communicate with memory 602, executes and deposits on Fault Insertion Equipment
Series of computation machine executable instruction in reservoir 602.Fault Insertion Equipment can also include one or more power supplys
603, one or more wired or wireless network interfaces 604, one or more input/output interfaces 605, one or
More than one keyboard 606.
Specifically in the present embodiment, Fault Insertion Equipment includes memory and one or more program,
In one perhaps more than one program is stored in memory and one or more than one program may include one or one
With upper module, and each module may include and being configured to the series of computation machine executable instruction in Fault Insertion Equipment
With by one or more than one processor execute this or more than one program include can for carrying out following computer
It executes instruction:
The call request of interception target method of servicing, include in the call request destination service method mark and
The numerical value of call parameters;
If scheduled target faults description information and the mark of the destination service method and the numerical value phase of call parameters
Matching then injects the corresponding target faults injection logic of the target faults description information to the destination service method, with true
Surely the fail result that the target faults injection logic generates is executed, the target faults description information includes carrying out direct fault location
Method of servicing corresponding with the method for servicing call parameters of mark numerical value.
Optionally, described that the corresponding target faults note of the target faults description information is injected to the destination service method
Enter logic, comprising:
Obtain the corresponding fault type of the target faults injection logic, the fault type includes preposition class and non-preposition
Class;
If the fault type is preposition class, the target faults description information is injected to the destination service method
Corresponding target faults injection logic.
Optionally, the preposition class includes throwing mistake, postponing and distort parameter values,
If the fault type is preposition class, the target faults are injected to the destination service method and are described
The corresponding target faults injection logic of information, comprising:
If the fault type is that the first subclass in preposition class judges whether adjusting according to first subclass
Before the destination service method, the corresponding target faults of the target faults description information are injected to the destination service method
Injection logic, wherein first subclass is to throw mistake, postpone or distort parameter values.
Optionally, the target faults description information is write by Domain Specific Language DSL.
It optionally, include multiple critical fielies in the target faults description information, the multiple critical field is used respectively
The mark of the method for servicing of direct fault location and the numerical value of call parameters are carried out in characterization, and the content of the fault logic injected.
Optionally, multiple critical fielies of the target faults description information are respectively FROM, WHERE and UPDATE.
Optionally, further includes:
The content of the target faults description information is analyzed, the corresponding content of each critical field is respectively obtained;
If scheduled target faults description information and the mark of the destination service method and the numerical value phase of call parameters
Matching then injects the corresponding target faults injection logic of the target faults description information to the destination service method, comprising:
If the mark and call parameters of the obtained corresponding content of the critical field and the destination service method
Numerical value matches, then injects the corresponding target faults injection of the target faults description information to the destination service method and patrol
Volume.
Optionally, described that the corresponding target faults note of the target faults description information is injected to the destination service method
After entering logic, further includes:
Using Java tool Java Instrument or towards tangent plane programming AOP mechanism, target faults injection is patrolled
The return value of the numerical value or the call parameters of collecting corresponding call parameters is modified, and is patrolled with updating the target faults injection
Volume.
This specification embodiment provides a kind of Fault Insertion Equipment, should by the call request of interception target method of servicing
The numerical value of mark and call parameters in call request including destination service method, in scheduled target faults description information and mesh
In the case that the numerical value of the mark and call parameters of marking method of servicing matches, to the injection target faults description of destination service method
The corresponding target faults injection logic of information, to determine the fail result of performance objective direct fault location logic generation, target faults
Description information includes the numerical value for carrying out the mark and the corresponding call parameters of method of servicing of the method for servicing of direct fault location, in this way,
Only need the mark and the corresponding tune of method of servicing of the method for servicing by carrying out direct fault location described in failure-description information
The information such as the numerical value with parameter can select the method for servicing in operation system, and carry out corresponding target faults note
Enter the injection of logic, so that the fail result of performance objective direct fault location logic generation is obtained, without writing above-mentioned progress
The numerical value of the corresponding call parameters of mark and method of servicing of the method for servicing of direct fault location and target faults injection logic etc.
The related program code of information does not need to carry out the compiled of program code using the server or terminal device of operation system yet
Journey enormously simplifies the treatment process of direct fault location, improves direct fault location efficiency.
It is above-mentioned that this specification specific embodiment is described.Other embodiments are in the scope of the appended claims
It is interior.In some cases, the movement recorded in detail in the claims or step can be come according to the sequence being different from embodiment
It executes and desired result still may be implemented.In addition, process depicted in the drawing not necessarily require show it is specific suitable
Sequence or consecutive order are just able to achieve desired result.In some embodiments, multitasking and parallel processing be also can
With or may be advantageous.
In the 1990s, the improvement of a technology can be distinguished clearly be on hardware improvement (for example,
Improvement to circuit structures such as diode, transistor, switches) or software on improvement (improvement for method flow).So
And with the development of technology, the improvement of current many method flows can be considered as directly improving for hardware circuit.
Designer nearly all obtains corresponding hardware circuit by the way that improved method flow to be programmed into hardware circuit.Cause
This, it cannot be said that the improvement of a method flow cannot be realized with hardware entities module.For example, programmable logic device
(Programmable Logic Device, PLD) (such as field programmable gate array (Field Programmable Gate
Array, FPGA)) it is exactly such a integrated circuit, logic function determines device programming by user.By designer
Voluntarily programming comes a digital display circuit " integrated " on a piece of PLD, designs and makes without asking chip maker
Dedicated IC chip.Moreover, nowadays, substitution manually makes IC chip, this programming is also used instead mostly " is patrolled
Volume compiler (logic compiler) " software realizes that software compiler used is similar when it writes with program development,
And the source code before compiling also write by handy specific programming language, this is referred to as hardware description language
(Hardware Description Language, HDL), and HDL is also not only a kind of, but there are many kind, such as ABEL
(Advanced Boolean Expression Language)、AHDL(Altera Hardware Description
Language)、Confluence、CUPL(Cornell University Programming Language)、HDCal、JHDL
(Java Hardware Description Language)、Lava、Lola、MyHDL、PALASM、RHDL(Ruby
Hardware Description Language) etc., VHDL (Very-High-Speed is most generally used at present
Integrated Circuit Hardware Description Language) and Verilog.Those skilled in the art also answer
This understands, it is only necessary to method flow slightly programming in logic and is programmed into integrated circuit with above-mentioned several hardware description languages,
The hardware circuit for realizing the logical method process can be readily available.
Controller can be implemented in any suitable manner, for example, controller can take such as microprocessor or processing
The computer for the computer readable program code (such as software or firmware) that device and storage can be executed by (micro-) processor can
Read medium, logic gate, switch, specific integrated circuit (Application Specific Integrated Circuit,
ASIC), the form of programmable logic controller (PLC) and insertion microcontroller, the example of controller includes but is not limited to following microcontroller
Device: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20 and Silicone Labs C8051F320 are deposited
Memory controller is also implemented as a part of the control logic of memory.It is also known in the art that in addition to
Pure computer readable program code mode is realized other than controller, can be made completely by the way that method and step is carried out programming in logic
Controller is obtained to come in fact in the form of logic gate, switch, specific integrated circuit, programmable logic controller (PLC) and insertion microcontroller etc.
Existing identical function.Therefore this controller is considered a kind of hardware component, and to including for realizing various in it
The device of function can also be considered as the structure in hardware component.Or even, it can will be regarded for realizing the device of various functions
For either the software module of implementation method can be the structure in hardware component again.
System, device, module or the unit that above-described embodiment illustrates can specifically realize by computer chip or entity,
Or it is realized by the product with certain function.It is a kind of typically to realize that equipment is computer.Specifically, computer for example may be used
Think personal computer, laptop computer, cellular phone, camera phone, smart phone, personal digital assistant, media play
It is any in device, navigation equipment, electronic mail equipment, game console, tablet computer, wearable device or these equipment
The combination of equipment.
For convenience of description, it is divided into various units when description apparatus above with function to describe respectively.Certainly, implementing this
The function of each unit can be realized in the same or multiple software and or hardware when specification one or more embodiment.
It should be understood by those skilled in the art that, the embodiment of this specification can provide as method, system or computer journey
Sequence product.Therefore, complete hardware embodiment, complete software embodiment or knot can be used in this specification one or more embodiment
The form of embodiment in terms of conjunction software and hardware.Moreover, this specification one or more embodiment can be used at one or more
A wherein includes computer-usable storage medium (the including but not limited to magnetic disk storage, CD- of computer usable program code
ROM, optical memory etc.) on the form of computer program product implemented.
The embodiment of this specification is referring to the method, equipment (system) and computer journey according to this specification embodiment
The flowchart and/or the block diagram of sequence product describes.It should be understood that flow chart and/or box can be realized by computer program instructions
The combination of the process and/or box in each flow and/or block and flowchart and/or the block diagram in figure.It can provide this
A little computer program instructions are to general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices
Processor to generate a machine so that the finger executed by the processor of computer or other programmable data processing devices
It enables and generates to specify in one or more flows of the flowchart and/or one or more blocks of the block diagram
The device of function.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy
Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates,
Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or
The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting
Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or
The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one
The step of function of being specified in a box or multiple boxes.
In a typical configuration, calculating equipment includes one or more processors (CPU), input/output interface, net
Network interface and memory.
Memory may include the non-volatile memory in computer-readable medium, random access memory (RAM) and/or
The forms such as Nonvolatile memory, such as read-only memory (ROM) or flash memory (flash RAM).Memory is computer-readable medium
Example.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any method
Or technology come realize information store.Information can be computer readable instructions, data structure, the module of program or other data.
The example of the storage medium of computer includes, but are not limited to phase change memory (PRAM), static random access memory (SRAM), moves
State random access memory (DRAM), other kinds of random access memory (RAM), read-only memory (ROM), electric erasable
Programmable read only memory (EEPROM), flash memory or other memory techniques, read-only disc read only memory (CD-ROM) (CD-ROM),
Digital versatile disc (DVD) or other optical storage, magnetic cassettes, tape magnetic disk storage or other magnetic storage devices
Or any other non-transmission medium, can be used for storage can be accessed by a computing device information.As defined in this article, it calculates
Machine readable medium does not include temporary computer readable media (transitory media), such as the data-signal and carrier wave of modulation.
It should also be noted that, the terms "include", "comprise" or its any other variant are intended to nonexcludability
It include so that the process, method, commodity or the equipment that include a series of elements not only include those elements, but also to wrap
Include other elements that are not explicitly listed, or further include for this process, method, commodity or equipment intrinsic want
Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including described want
There is also other identical elements in the process, method of element, commodity or equipment.
It will be understood by those skilled in the art that the embodiment of this specification can provide as the production of method, system or computer program
Product.Therefore, this specification one or more embodiment can be used complete hardware embodiment, complete software embodiment or combine software
With the form of the embodiment of hardware aspect.Moreover, this specification one or more embodiment can be used it is one or more wherein
It include computer-usable storage medium (including but not limited to magnetic disk storage, CD-ROM, the light of computer usable program code
Learn memory etc.) on the form of computer program product implemented.
This specification one or more embodiment can computer executable instructions it is general on
It hereinafter describes, such as program module.Generally, program module includes executing particular task or realization particular abstract data type
Routine, programs, objects, component, data structure etc..Can also practice in a distributed computing environment this specification one or
Multiple embodiments, in these distributed computing environments, by being executed by the connected remote processing devices of communication network
Task.In a distributed computing environment, the local and remote computer that program module can be located at including storage equipment is deposited
In storage media.
All the embodiments in this specification are described in a progressive manner, same and similar portion between each embodiment
Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for system reality
For applying example, since it is substantially similar to the method embodiment, so being described relatively simple, related place is referring to embodiment of the method
Part explanation.
The foregoing is merely the embodiments of this specification, are not limited to this specification.For art technology
For personnel, this specification can have various modifications and variations.It is all made any within the spirit and principle of this specification
Modification, equivalent replacement, improvement etc., should be included within the scope of the claims of this specification.