Service Detection v2 (SDv2) allows you to detect failures based on the attributes of a span that is relevant to failure detection. These relevant spans include, for example, request root spans. You can use the default Dynatrace detection rules and also define your own custom rules.
This page describes failure detection for SDv2, how to use default detection rules, and how to create your own custom rules.
Failure detection consists of:
Dynatrace provides default failure detection rulesets and rules. Additionally, you can add custom rulesets and rules as described in Create new ruleset.
Condition
Failure reason
span.status_code is ERROR
Based on span status
http.response.status_code is 5xx (server-side error)
The HTTP error status code
rpc.grpc.status_code is 2, 4, 12, 13, 14, or 15 (that is, a server-side error code).
The gRPC error status code
Exited by exception
The exception itself
A request is considered successful if no failure detection rule matches.
Failure detection is customized in
Settings > Process and contextualize > Services > Failure detection.
To configure failure detection:
In Failure detection, select Add ruleset.
Fill in the following optional and required fields:
To save, select Save changes.
Within the ruleset, these parameters define conditions under which a span will fail.
500-599.2,4,12,13,14,15.Optional
Within a ruleset, you can exclude specific exceptions. If the span includes the defined exception type and message, this exception will not cause the span to fail.
Select Add ignored exception and enter values for both:
To ignore all NullPointerExceptions that contain the expected null value in their message, set the following values.
NullPointerException<Expected null value>Optional
Beyond the failure conditions that you already defined, you can define additional custom conditions under which a span will fail. These conditions are called custom failure rules. They are defined with any key/value pair using DQL matchers.
To define a rule, select Add custom rule.
Fill in the following required fields.
Rule name: A descriptive name.
DQL condition: A DQL matcher that consists of one or more DQL functions. If the matching condition applies, the rule is triggered. If the matching condition does not apply, the rule is not triggered.
Whether or not the condition applies, the span is evaluated against subsequent rules.
When a rule is triggered, a corresponding entry in the `dt.failure_detection.results array is created.
This is an example custom rule to detect business logic failures.
Business Transaction Failuretransaction.status == "FAILED"Optional
Sometimes, you want a span to succeed even if it contains error indicators. Within a ruleset, you can define certain conditions that will force success.
To do this, select > Override failure detection with success forcing rules. Then, define one or more rules.
OK it will succeed, regardless of any other error indicators.To force success on an example span that contains an escaped exception, set the following values.
Any(span.events[][span_event.name] == "exception" and span.events[][exception.escaped] != false)reason="exception", verdict="success", exception_idsThis is useful for applications that use exceptions as part of normal control flow rather than as error indicators.
To force success for an expected business condition, set the following values.
Expected Cache Misscache.result == "MISS" and operation.type == "READ"This is useful for business-specific scenarios where there are expected business conditions.
You can re-order custom rulesets and rules to affect the order of precedence.
You can also edit custom rulesets and rules. To do so, navigate to the ruleset or rule and select Details > . Edit the field(s) as appropriate and then select Save changes.
To delete a custom ruleset or rule, navigate to the ruleset or rule and select Delete > . Select Save changes to permanently delete the ruleset or rule, or Discard changes to keep the rule.
You can delete only custom rulesets and rules, not the built-in ones.