LoopCLI

Datadog Connector

Pipe telemetry into Datadog and respond to alerts automatically.

Required secrets

Vault key Description
datadog-api-key Datadog API key (DD_API_KEY).
datadog-app-key Datadog application key (DD_APP_KEY) for write operations.

Add them:

loopcli secret add datadog-api-key --value <api-key>
loopcli secret add datadog-app-key --value <app-key>

Common automations

  • Create or disable monitors based on deploy windows.
  • Ingest custom metrics from CLI scripts.
  • Auto-open incidents in Slack/Linear when monitors trip.

Example loop

name: datadog-deployment-guard
steps:
  - id: disable
    name: Silence monitor
    type: http
    config:
      url: https://api.datadoghq.com/api/v1/monitor/{{env:DATADOG_MONITOR_ID}}/mute
      method: POST
      headers:
        DD-API-KEY: "{{secret:datadog-api-key}}"
        DD-APPLICATION-KEY: "{{secret:datadog-app-key}}"
  - id: deploy
    name: Run deployment
    type: cli
    config:
      command: bash
      args: ["scripts/deploy.sh"]
  - id: enable
    name: Unmute monitor
    type: http
    config:
      url: https://api.datadoghq.com/api/v1/monitor/{{env:DATADOG_MONITOR_ID}}/unmute
      method: POST
      headers:
        DD-API-KEY: "{{secret:datadog-api-key}}"
        DD-APPLICATION-KEY: "{{secret:datadog-app-key}}"

Emit custom metrics

- id: metric
  type: http
  config:
    url: https://api.datadoghq.com/api/v1/series
    method: POST
    headers:
      DD-API-KEY: "{{secret:datadog-api-key}}"
      Content-Type: application/json
    body:
      series:
        - metric: loopcli.jobs.completed
          type: count
          points:
            - - "{{run.started_at_unix}}"
              - 1
          tags:
            - project:{{run.project.slug}}
            - loop:{{run.loop.slug}}

Templates

Helpful links

Related Documentation

Continue learning with these related topics