Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

ServiceLevelObjective

Provides a Datadog service level objective resource. This can be used to create and manage Datadog service level objectives.

Example Usage

Metric-Based SLO

using Pulumi;
using Datadog = Pulumi.Datadog;

class MyStack : Stack
{
    public MyStack()
    {
        // Create a new Datadog service level objective
        var foo = new Datadog.ServiceLevelObjective("foo", new Datadog.ServiceLevelObjectiveArgs
        {
            Description = "My custom metric SLO",
            Name = "Example Metric SLO",
            Query = new Datadog.Inputs.ServiceLevelObjectiveQueryArgs
            {
                Denominator = "sum:my.custom.count.metric{*}.as_count()",
                Numerator = "sum:my.custom.count.metric{type:good_events}.as_count()",
            },
            Tags = 
            {
                "foo:bar",
                "baz",
            },
            Thresholds = 
            {
                new Datadog.Inputs.ServiceLevelObjectiveThresholdArgs
                {
                    Target = 99.9,
                    TargetDisplay = "99.900",
                    Timeframe = "7d",
                    Warning = 99.99,
                    WarningDisplay = "99.990",
                },
                new Datadog.Inputs.ServiceLevelObjectiveThresholdArgs
                {
                    Target = 99.9,
                    TargetDisplay = "99.900",
                    Timeframe = "30d",
                    Warning = 99.99,
                    WarningDisplay = "99.990",
                },
            },
            Type = "metric",
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-datadog/sdk/v2/go/datadog"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := datadog.NewServiceLevelObjective(ctx, "foo", &datadog.ServiceLevelObjectiveArgs{
            Description: pulumi.String("My custom metric SLO"),
            Name:        pulumi.String("Example Metric SLO"),
            Query: &datadog.ServiceLevelObjectiveQueryArgs{
                Denominator: pulumi.String("sum:my.custom.count.metric{*}.as_count()"),
                Numerator:   pulumi.String("sum:my.custom.count.metric{type:good_events}.as_count()"),
            },
            Tags: pulumi.StringArray{
                pulumi.String("foo:bar"),
                pulumi.String("baz"),
            },
            Thresholds: datadog.ServiceLevelObjectiveThresholdArray{
                &datadog.ServiceLevelObjectiveThresholdArgs{
                    Target:         pulumi.Float64(99.9),
                    TargetDisplay:  pulumi.String("99.900"),
                    Timeframe:      pulumi.String("7d"),
                    Warning:        pulumi.Float64(99.99),
                    WarningDisplay: pulumi.String("99.990"),
                },
                &datadog.ServiceLevelObjectiveThresholdArgs{
                    Target:         pulumi.Float64(99.9),
                    TargetDisplay:  pulumi.String("99.900"),
                    Timeframe:      pulumi.String("30d"),
                    Warning:        pulumi.Float64(99.99),
                    WarningDisplay: pulumi.String("99.990"),
                },
            },
            Type: pulumi.String("metric"),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_datadog as datadog

# Create a new Datadog service level objective
foo = datadog.ServiceLevelObjective("foo",
    description="My custom metric SLO",
    name="Example Metric SLO",
    query=datadog.ServiceLevelObjectiveQueryArgs(
        denominator="sum:my.custom.count.metric{*}.as_count()",
        numerator="sum:my.custom.count.metric{type:good_events}.as_count()",
    ),
    tags=[
        "foo:bar",
        "baz",
    ],
    thresholds=[
        datadog.ServiceLevelObjectiveThresholdArgs(
            target=99.9,
            target_display="99.900",
            timeframe="7d",
            warning=99.99,
            warning_display="99.990",
        ),
        datadog.ServiceLevelObjectiveThresholdArgs(
            target=99.9,
            target_display="99.900",
            timeframe="30d",
            warning=99.99,
            warning_display="99.990",
        ),
    ],
    type="metric")
import * as pulumi from "@pulumi/pulumi";
import * as datadog from "@pulumi/datadog";

// Create a new Datadog service level objective
const foo = new datadog.ServiceLevelObjective("foo", {
    description: "My custom metric SLO",
    name: "Example Metric SLO",
    query: {
        denominator: "sum:my.custom.count.metric{*}.as_count()",
        numerator: "sum:my.custom.count.metric{type:good_events}.as_count()",
    },
    tags: [
        "foo:bar",
        "baz",
    ],
    thresholds: [
        {
            target: 99.9,
            targetDisplay: "99.900",
            timeframe: "7d",
            warning: 99.99,
            warningDisplay: "99.990",
        },
        {
            target: 99.9,
            targetDisplay: "99.900",
            timeframe: "30d",
            warning: 99.99,
            warningDisplay: "99.990",
        },
    ],
    type: "metric",
});

Monitor-Based SLO

using Pulumi;
using Datadog = Pulumi.Datadog;

class MyStack : Stack
{
    public MyStack()
    {
        // Create a new Datadog service level objective
        var bar = new Datadog.ServiceLevelObjective("bar", new Datadog.ServiceLevelObjectiveArgs
        {
            Description = "My custom monitor SLO",
            MonitorIds = 
            {
                1,
                2,
                3,
            },
            Name = "Example Monitor SLO",
            Tags = 
            {
                "foo:bar",
                "baz",
            },
            Thresholds = 
            {
                new Datadog.Inputs.ServiceLevelObjectiveThresholdArgs
                {
                    Target = 99.9,
                    Timeframe = "7d",
                    Warning = 99.99,
                },
                new Datadog.Inputs.ServiceLevelObjectiveThresholdArgs
                {
                    Target = 99.9,
                    Timeframe = "30d",
                    Warning = 99.99,
                },
            },
            Type = "monitor",
        });
    }

}

Coming soon!

import pulumi
import pulumi_datadog as datadog

# Create a new Datadog service level objective
bar = datadog.ServiceLevelObjective("bar",
    description="My custom monitor SLO",
    monitor_ids=[
        1,
        2,
        3,
    ],
    name="Example Monitor SLO",
    tags=[
        "foo:bar",
        "baz",
    ],
    thresholds=[
        datadog.ServiceLevelObjectiveThresholdArgs(
            target=99.9,
            timeframe="7d",
            warning=99.99,
        ),
        datadog.ServiceLevelObjectiveThresholdArgs(
            target=99.9,
            timeframe="30d",
            warning=99.99,
        ),
    ],
    type="monitor")
import * as pulumi from "@pulumi/pulumi";
import * as datadog from "@pulumi/datadog";

// Create a new Datadog service level objective
const bar = new datadog.ServiceLevelObjective("bar", {
    description: "My custom monitor SLO",
    monitorIds: [
        1,
        2,
        3,
    ],
    name: "Example Monitor SLO",
    tags: [
        "foo:bar",
        "baz",
    ],
    thresholds: [
        {
            target: 99.9,
            timeframe: "7d",
            warning: 99.99,
        },
        {
            target: 99.9,
            timeframe: "30d",
            warning: 99.99,
        },
    ],
    type: "monitor",
});

Create a ServiceLevelObjective Resource

new ServiceLevelObjective(name: string, args: ServiceLevelObjectiveArgs, opts?: CustomResourceOptions);
def ServiceLevelObjective(resource_name: str, opts: Optional[ResourceOptions] = None, description: Optional[str] = None, force_delete: Optional[bool] = None, groups: Optional[Sequence[str]] = None, monitor_ids: Optional[Sequence[int]] = None, name: Optional[str] = None, query: Optional[ServiceLevelObjectiveQueryArgs] = None, tags: Optional[Sequence[str]] = None, thresholds: Optional[Sequence[ServiceLevelObjectiveThresholdArgs]] = None, type: Optional[str] = None, validate: Optional[bool] = None)
func NewServiceLevelObjective(ctx *Context, name string, args ServiceLevelObjectiveArgs, opts ...ResourceOption) (*ServiceLevelObjective, error)
public ServiceLevelObjective(string name, ServiceLevelObjectiveArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args ServiceLevelObjectiveArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args ServiceLevelObjectiveArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ServiceLevelObjectiveArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

ServiceLevelObjective Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The ServiceLevelObjective resource accepts the following input properties:

Name string

Name of Datadog service level objective

Thresholds List<ServiceLevelObjectiveThresholdArgs>

A list of thresholds and targets that define the service level objectives from the provided SLIs.

Type string

The type of the service level objective. The mapping from these types to the types found in the Datadog Web UI can be found in the Datadog API documentation page. Available options to choose from are: metric and monitor.

Description string

A description of this service level objective.

ForceDelete bool

A boolean indicating whether this monitor can be deleted even if it’s referenced by other resources (e.g. dashboards). - thresholds: (Required) - A list of thresholds and targets that define the service level objectives from the provided SLIs.

Groups List<string>

A static set of groups to filter monitor-based SLOs

MonitorIds List<int>

A static set of monitor IDs to use as part of the SLO

Query ServiceLevelObjectiveQueryArgs

The metric query of good / total events

Tags List<string>

A list of tags to associate with your service level objective. This can help you categorize and filter service level objectives in the service level objectives page of the UI. Note: it’s not currently possible to filter by these tags when querying via the API

Validate bool

Whether or not to validate the SLO.

Name string

Name of Datadog service level objective

Thresholds []ServiceLevelObjectiveThreshold

A list of thresholds and targets that define the service level objectives from the provided SLIs.

Type string

The type of the service level objective. The mapping from these types to the types found in the Datadog Web UI can be found in the Datadog API documentation page. Available options to choose from are: metric and monitor.

Description string

A description of this service level objective.

ForceDelete bool

A boolean indicating whether this monitor can be deleted even if it’s referenced by other resources (e.g. dashboards). - thresholds: (Required) - A list of thresholds and targets that define the service level objectives from the provided SLIs.

Groups []string

A static set of groups to filter monitor-based SLOs

MonitorIds []int

A static set of monitor IDs to use as part of the SLO

Query ServiceLevelObjectiveQuery

The metric query of good / total events

Tags []string

A list of tags to associate with your service level objective. This can help you categorize and filter service level objectives in the service level objectives page of the UI. Note: it’s not currently possible to filter by these tags when querying via the API

Validate bool

Whether or not to validate the SLO.

name string

Name of Datadog service level objective

thresholds ServiceLevelObjectiveThreshold[]

A list of thresholds and targets that define the service level objectives from the provided SLIs.

type string

The type of the service level objective. The mapping from these types to the types found in the Datadog Web UI can be found in the Datadog API documentation page. Available options to choose from are: metric and monitor.

description string

A description of this service level objective.

forceDelete boolean

A boolean indicating whether this monitor can be deleted even if it’s referenced by other resources (e.g. dashboards). - thresholds: (Required) - A list of thresholds and targets that define the service level objectives from the provided SLIs.

groups string[]

A static set of groups to filter monitor-based SLOs

monitorIds number[]

A static set of monitor IDs to use as part of the SLO

query ServiceLevelObjectiveQuery

The metric query of good / total events

tags string[]

A list of tags to associate with your service level objective. This can help you categorize and filter service level objectives in the service level objectives page of the UI. Note: it’s not currently possible to filter by these tags when querying via the API

validate boolean

Whether or not to validate the SLO.

name str

Name of Datadog service level objective

thresholds Sequence[ServiceLevelObjectiveThresholdArgs]

A list of thresholds and targets that define the service level objectives from the provided SLIs.

type str

The type of the service level objective. The mapping from these types to the types found in the Datadog Web UI can be found in the Datadog API documentation page. Available options to choose from are: metric and monitor.

description str

A description of this service level objective.

force_delete bool

A boolean indicating whether this monitor can be deleted even if it’s referenced by other resources (e.g. dashboards). - thresholds: (Required) - A list of thresholds and targets that define the service level objectives from the provided SLIs.

groups Sequence[str]

A static set of groups to filter monitor-based SLOs

monitor_ids Sequence[int]

A static set of monitor IDs to use as part of the SLO

query ServiceLevelObjectiveQueryArgs

The metric query of good / total events

tags Sequence[str]

A list of tags to associate with your service level objective. This can help you categorize and filter service level objectives in the service level objectives page of the UI. Note: it’s not currently possible to filter by these tags when querying via the API

validate bool

Whether or not to validate the SLO.

Outputs

All input properties are implicitly available as output properties. Additionally, the ServiceLevelObjective resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing ServiceLevelObjective Resource

Get an existing ServiceLevelObjective resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ServiceLevelObjectiveState, opts?: CustomResourceOptions): ServiceLevelObjective
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, description: Optional[str] = None, force_delete: Optional[bool] = None, groups: Optional[Sequence[str]] = None, monitor_ids: Optional[Sequence[int]] = None, name: Optional[str] = None, query: Optional[ServiceLevelObjectiveQueryArgs] = None, tags: Optional[Sequence[str]] = None, thresholds: Optional[Sequence[ServiceLevelObjectiveThresholdArgs]] = None, type: Optional[str] = None, validate: Optional[bool] = None) -> ServiceLevelObjective
func GetServiceLevelObjective(ctx *Context, name string, id IDInput, state *ServiceLevelObjectiveState, opts ...ResourceOption) (*ServiceLevelObjective, error)
public static ServiceLevelObjective Get(string name, Input<string> id, ServiceLevelObjectiveState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

Description string

A description of this service level objective.

ForceDelete bool

A boolean indicating whether this monitor can be deleted even if it’s referenced by other resources (e.g. dashboards). - thresholds: (Required) - A list of thresholds and targets that define the service level objectives from the provided SLIs.

Groups List<string>

A static set of groups to filter monitor-based SLOs

MonitorIds List<int>

A static set of monitor IDs to use as part of the SLO

Name string

Name of Datadog service level objective

Query ServiceLevelObjectiveQueryArgs

The metric query of good / total events

Tags List<string>

A list of tags to associate with your service level objective. This can help you categorize and filter service level objectives in the service level objectives page of the UI. Note: it’s not currently possible to filter by these tags when querying via the API

Thresholds List<ServiceLevelObjectiveThresholdArgs>

A list of thresholds and targets that define the service level objectives from the provided SLIs.

Type string

The type of the service level objective. The mapping from these types to the types found in the Datadog Web UI can be found in the Datadog API documentation page. Available options to choose from are: metric and monitor.

Validate bool

Whether or not to validate the SLO.

Description string

A description of this service level objective.

ForceDelete bool

A boolean indicating whether this monitor can be deleted even if it’s referenced by other resources (e.g. dashboards). - thresholds: (Required) - A list of thresholds and targets that define the service level objectives from the provided SLIs.

Groups []string

A static set of groups to filter monitor-based SLOs

MonitorIds []int

A static set of monitor IDs to use as part of the SLO

Name string

Name of Datadog service level objective

Query ServiceLevelObjectiveQuery

The metric query of good / total events

Tags []string

A list of tags to associate with your service level objective. This can help you categorize and filter service level objectives in the service level objectives page of the UI. Note: it’s not currently possible to filter by these tags when querying via the API

Thresholds []ServiceLevelObjectiveThreshold

A list of thresholds and targets that define the service level objectives from the provided SLIs.

Type string

The type of the service level objective. The mapping from these types to the types found in the Datadog Web UI can be found in the Datadog API documentation page. Available options to choose from are: metric and monitor.

Validate bool

Whether or not to validate the SLO.

description string

A description of this service level objective.

forceDelete boolean

A boolean indicating whether this monitor can be deleted even if it’s referenced by other resources (e.g. dashboards). - thresholds: (Required) - A list of thresholds and targets that define the service level objectives from the provided SLIs.

groups string[]

A static set of groups to filter monitor-based SLOs

monitorIds number[]

A static set of monitor IDs to use as part of the SLO

name string

Name of Datadog service level objective

query ServiceLevelObjectiveQuery

The metric query of good / total events

tags string[]

A list of tags to associate with your service level objective. This can help you categorize and filter service level objectives in the service level objectives page of the UI. Note: it’s not currently possible to filter by these tags when querying via the API

thresholds ServiceLevelObjectiveThreshold[]

A list of thresholds and targets that define the service level objectives from the provided SLIs.

type string

The type of the service level objective. The mapping from these types to the types found in the Datadog Web UI can be found in the Datadog API documentation page. Available options to choose from are: metric and monitor.

validate boolean

Whether or not to validate the SLO.

description str

A description of this service level objective.

force_delete bool

A boolean indicating whether this monitor can be deleted even if it’s referenced by other resources (e.g. dashboards). - thresholds: (Required) - A list of thresholds and targets that define the service level objectives from the provided SLIs.

groups Sequence[str]

A static set of groups to filter monitor-based SLOs

monitor_ids Sequence[int]

A static set of monitor IDs to use as part of the SLO

name str

Name of Datadog service level objective

query ServiceLevelObjectiveQueryArgs

The metric query of good / total events

tags Sequence[str]

A list of tags to associate with your service level objective. This can help you categorize and filter service level objectives in the service level objectives page of the UI. Note: it’s not currently possible to filter by these tags when querying via the API

thresholds Sequence[ServiceLevelObjectiveThresholdArgs]

A list of thresholds and targets that define the service level objectives from the provided SLIs.

type str

The type of the service level objective. The mapping from these types to the types found in the Datadog Web UI can be found in the Datadog API documentation page. Available options to choose from are: metric and monitor.

validate bool

Whether or not to validate the SLO.

Supporting Types

ServiceLevelObjectiveQuery

Denominator string
Numerator string
Denominator string
Numerator string
denominator string
numerator string

ServiceLevelObjectiveThreshold

Target double
Timeframe string

the time frame for the objective. The mapping from these types to the types found in the Datadog Web UI can be found in the Datadog API documentation page. Available options to choose from are: - 7d - 30d - 90d - target: (Required) the objective’s target [0,100] - target_display: (Optional) the string version to specify additional digits in the case of 99 but want 3 digits like 99.000 to display. - warning: (Optional) the objective’s warning value [0,100]. This must be > target value. - warning_display: (Optional) the string version to specify additional digits in the case of 99 but want 3 digits like 99.000 to display.

TargetDisplay string
Warning double
WarningDisplay string
Target float64
Timeframe string

the time frame for the objective. The mapping from these types to the types found in the Datadog Web UI can be found in the Datadog API documentation page. Available options to choose from are: - 7d - 30d - 90d - target: (Required) the objective’s target [0,100] - target_display: (Optional) the string version to specify additional digits in the case of 99 but want 3 digits like 99.000 to display. - warning: (Optional) the objective’s warning value [0,100]. This must be > target value. - warning_display: (Optional) the string version to specify additional digits in the case of 99 but want 3 digits like 99.000 to display.

TargetDisplay string
Warning float64
WarningDisplay string
target number
timeframe string

the time frame for the objective. The mapping from these types to the types found in the Datadog Web UI can be found in the Datadog API documentation page. Available options to choose from are: - 7d - 30d - 90d - target: (Required) the objective’s target [0,100] - target_display: (Optional) the string version to specify additional digits in the case of 99 but want 3 digits like 99.000 to display. - warning: (Optional) the objective’s warning value [0,100]. This must be > target value. - warning_display: (Optional) the string version to specify additional digits in the case of 99 but want 3 digits like 99.000 to display.

targetDisplay string
warning number
warningDisplay string
target float
timeframe str

the time frame for the objective. The mapping from these types to the types found in the Datadog Web UI can be found in the Datadog API documentation page. Available options to choose from are: - 7d - 30d - 90d - target: (Required) the objective’s target [0,100] - target_display: (Optional) the string version to specify additional digits in the case of 99 but want 3 digits like 99.000 to display. - warning: (Optional) the objective’s warning value [0,100]. This must be > target value. - warning_display: (Optional) the string version to specify additional digits in the case of 99 but want 3 digits like 99.000 to display.

target_display str
warning float
warning_display str

Import

Service Level Objectives can be imported using their string ID, e.g.

 $ pulumi import datadog:index/serviceLevelObjective:ServiceLevelObjective baz 12345678901234567890123456789012

Package Details

Repository
https://github.com/pulumi/pulumi-datadog
License
Apache-2.0
Notes
This Pulumi package is based on the datadog Terraform Provider.