To create a Service Level Objective (SLO), you can use the Datadog Operator and DatadogSLO custom resource definition (CRD).

Prerequisites

Setup

  1. Create a file with the spec of your DatadogSLO deployment configuration.

    Example: Monitor-based SLO

    datadog-slo.yaml

       apiVersion: datadoghq.com/v1alpha1
       kind: DatadogSLO
       metadata:
         name: example-slo-monitor3
         namespace: system 
       spec:
         name: example-slo-monitor3
         description: "This is an example monitor SLO from datadog-operator"
         monitorIDs:
           - 1234
         tags:
           - "service:example"
           - "env:prod"
         targetThreshold: "99.9"
         timeframe: "7d"
         type: "monitor"
       

    Example: Metric-based SLO

    datadog-slo.yaml

       apiVersion: datadoghq.com/v1alpha1
       kind: DatadogSLO
       metadata:
         name: example-slo
         namespace: system 
       spec:
         name: example-slo
         description: "This is an example metric SLO from datadog-operator"
         query:
           denominator: "sum:requests.total{service:example,env:prod}.as_count()"
           numerator: "sum:requests.success{service:example,env:prod}.as_count()"
         tags:
           - "service:example"
           - "env:prod"
         targetThreshold: "99.9"
         timeframe: "7d"
         type: "metric"
       

    For all available configuration options, see the Create an SLO object API reference.

  2. Deploy your DatadogSLO:

    kubectl apply -f /path/to/your/datadog-slo.yaml
    

Additional examples

Metric-based SLO with Universal Service Monitoring