Skip to main content

Datadog P95 Latency Check

Last updated on

Datadog APM P95 latency check validates the 95th percentile latency 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 P95 Latency Check probe helps you:

  • Verify tail latency stays within SLO during network chaos
  • Monitor p95 latency after dependency failures
  • Validate latency recovery after fault injection
  • Detect latency regressions during rollout chaos

Overview

This probe queries Datadog APM for the latency_p95 stat of the target service, converts seconds to milliseconds using the formula p95*1000, 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<=500

The probe passes when the mean p95 latency (in milliseconds) 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 formulap95
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 latency statlatency_p95
formulaConverts seconds to millisecondsp95*1000
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_VALUEp95 latency threshold in millisecondsYes500

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-p95-latency-check
type: apmProbe
mode: Continuous
apmProbe/inputs:
type: Datadog
comparator:
type: float
value: "500"
criteria: <=
datadogApmProbeInputs:
connectorID: <+connector.identifier>
durationInMin: 10
queryType: v2
queries:
- name: p95
dataSource: apm_metrics
params:
env: <+probe.variables.ENV>
service: <+probe.variables.SERVICE_NAME>
stat: latency_p95
formula: p95*1000
aggregation: mean
runProperties:
timeout: 30s
interval: 5s
attempt: 1
pollingInterval: 30s
initialDelay: 1s
stopOnFailure: false
verbosity: debug

Next steps