Skip to main content

datadog-error-rate-check

Last updated on

Datadog APM error rate check validates the error rate of a service using Datadog APM metrics. The target service and environment are supplied at runtime via probe variables, allowing this probe to be reused across services.

Infrastructure type

  • Kubernetes

Use cases

Datadog Error Rate Check probe helps you:

  • Verify error rate stays below threshold during chaos
  • Monitor error budget consumption during fault injection
  • Validate service recovery after dependency failures
  • Detect error spikes during network or pod chaos

Overview

This probe queries Datadog APM for the error_rate stat of the target service, converts the fraction to a percentage using the formula errorRate*100, and compares the mean aggregated value against your threshold.

Probe type

APM Probe (Datadog)

Prerequisites

  • Kubernetes chaos infrastructure with Harness Delegate
  • A configured Datadog connector
  • Datadog APM instrumented on the target service
  • Probe variable SERVICE_NAME set at experiment runtime

Probe properties

Comparator

TypeCriteriaDefault value
float<=5

The probe passes when the mean error rate (as a percentage) is less than or equal to the comparator value.

Datadog APM probe inputs

FieldDescriptionDefault
connectorIDIdentifier of the Datadog connectorRequired at runtime
durationInMinLook-back window in minutes10
queryTypeDatadog query API versionv2
queries[0].nameQuery alias used in the formulaerrorRate
queries[0].dataSourceMetric source typeapm_metrics
queries[0].params.envDatadog APM environment<+probe.variables.ENV>
queries[0].params.serviceDatadog APM service name<+probe.variables.SERVICE_NAME>
queries[0].params.statAPM error staterror_rate
formulaConverts fraction to percentageerrorRate*100
aggregationAggregation over the time windowmean

Probe variables

VariableDescriptionRequired
SERVICE_NAMEDatadog APM service nameYes
ENVDatadog APM environment tagNo

Configurable inputs

InputDescriptionRequiredDefault
CONNECTOR_IDDatadog connector identifierYes-
DURATION_IN_MINLook-back window in minutesNo10
COMPARATOR_VALUEError rate threshold as a percentageYes5

Run properties

PropertyDescriptionTypeDefault
timeoutMaximum time to wait for the probe to completeString30s
intervalTime between probe executionsString5s
attemptNumber of retry attempts before marking as failedInteger1
pollingIntervalTime between retry attemptsString30s
initialDelayInitial delay before starting the probeString1s
stopOnFailureStop the experiment if the probe failsBooleanfalse
verbosityLog verbosity levelStringdebug

Probe definition

You can define this probe in your chaos experiment as follows:

probe:
- name: datadog-error-rate-check
type: apmProbe
mode: Continuous
apmProbe/inputs:
type: Datadog
comparator:
type: float
value: "5"
criteria: <=
datadogApmProbeInputs:
connectorID: <+connector.identifier>
durationInMin: 10
queryType: v2
queries:
- name: errorRate
dataSource: apm_metrics
params:
env: <+probe.variables.ENV>
service: <+probe.variables.SERVICE_NAME>
stat: error_rate
formula: errorRate*100
aggregation: mean
runProperties:
timeout: 30s
interval: 5s
attempt: 1
pollingInterval: 30s
initialDelay: 1s
stopOnFailure: false
verbosity: debug

Next steps