Service Detection v2 (SDv2) allows you to detect failures based on span attributes. 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
Since the introduction of Unified Services, Dynatrace has provided several default failure detection rulesets and rules.
Condition
Failure reason
span.status_code
is ERROR
Based on span status
http.status_code
is greater than or equal to 400
The HTTP error status code
grpc.status_code
is not equal to 0
The gRPC error status code
Custom failure attributes (if configured)
Custom failure reason
A request is considered successful if either
span.status_code
is OK
, orFailure 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 Failure
transaction.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 of
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_ids
This 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 Miss
cache.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.