Datadog metrics Query

Datadog metrics Query

Certified

Query timeseries metrics from Datadog

Runs a Datadog metrics query over a time window and returns the matching series with their points. Needs the API key and an application key with the timeseries_query scope.

The window is from to to or the last lookback when from is not set. Datadog returns at most about 300 points per series and picks the rollup itself, so a long window returns coarser points: add .rollup(avg, 300) to the query to choose it.

yaml
type: io.kestra.plugin.datadog.metrics.Query

Fail the flow when the error rate of a service is too high

yaml
id: datadog_error_rate_gate
namespace: company.observability

tasks:
  - id: error_rate
    type: io.kestra.plugin.datadog.metrics.Query
    apiKey: "{{ secret('DATADOG_API_KEY') }}"
    appKey: "{{ secret('DATADOG_APP_KEY') }}"
    query: "avg:trace.http.request.errors{service:orders}.as_rate()"
    lookback: PT15M

  - id: check
    type: io.kestra.plugin.core.execution.Assert
    errorMessage: "No data returned for the orders error rate"
    conditions:
      - "{{ outputs.error_rate.pointCount > 0 }}"
Installation

Our standard Docker images already include this plugin. If you use a -slim image or another setup, install it with the following command:

kestractl plugins get io.kestra.plugin:plugin-datadog --compatible-for $KESTRA_VERSION

For kestractl, use your Kestra version with --compatible-for, or specify an exact plugin version.

Properties

Datadog API key

The organization API key. Use a Kestra secret, e.g. {{ secret('DATADOG_API_KEY') }}.

Metrics query

A Datadog metrics query, such as avg: system.cpu.user{env: prod} by {host}.

API base URL

Replaces https://api.<site> when set, for a proxy, a private link or a test server. Leave it empty for the public API. logs.Send does not use it: it calls the log intake, which has its own address (intakeUrl).

Datadog application key

An application key. Datadog asks for it on every call that reads data or manages monitors and downtimes, so the tasks that only send data (events.Create, metrics.Submit, logs.Send) work without it. Create it with the scopes the task needs. Use a Kestra secret, e.g. {{ secret('DATADOG_APP_KEY') }}.

Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.

Definitions
assetFailureBehaviorstring
Possible Values
IGNOREFAILWARN

Asset failure behavior

Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.

enableAutobooleanstring

Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.

inputsarray

The assets consumed as inputs.

id*string
Min length1
typestring
outputs

The assets produced as outputs.

id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*string
Min length1

Custom asset type

descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150

Start of the window

An ISO-8601 instant. When not set, the window starts lookback before to.

DefaultPT1H

Look-back

The length of the window when from is not set. One hour when it is not set.

Datadog site

The Datadog site of the organization, the domain you see in the Datadog URL: datadoghq.com (US1, the default), us3.datadoghq.com, us5.datadoghq.com, datadoghq.eu, ap1.datadoghq.com, ap2.datadoghq.com, uk1.datadoghq.com or ddog-gov.com. A key only works on the site of the organization that created it.

End of the window

An ISO-8601 instant. The time the task runs when it is not set.

Number of points

The points of all the series. 0 means the query matched no data in the window.

SubTypeobject

Series

The series returned. Each has metric, scope, expression, unit and pointlist, a list of [timestamp in milliseconds, value] pairs.

Number of series

Status

The status Datadog answers, ok when the query ran.