Hamburger Cross Icon
Slo Defined
+
Datadog Collector

Slo Defined + Datadog Collector

Guardrail Collector Beta Operational Readiness

Enforce Slo Defined using data collected by Datadog Collector. Automatically check operational readiness standards on every PR.

Guardrail: Verifies that at least one Service Level Objective is defined for the service by checking .observability.slo.defined is true. Fails if observability data is present but no SLOs are configured. Skips cleanly when no observability source has written data for this component. SLO data is provided by collectors that support SLOs (e.g. Datadog). Grafana-only deployments will skip this check unless SLO data is populated from another source.
Data Source: Query the Datadog API for dashboards, monitors, and SLOs linked to each component. Normalizes to .observability for tool-agnostic policies; raw data at .observability.native.datadog.

How Datadog Collector Powers This Guardrail

The Datadog Collector gathers metadata from your service catalog systems. This data flows into Lunar's Component JSON, where the Slo Defined guardrail evaluates it against your standards.

When enabled, this check runs automatically on every PR and in AI coding workflows, providing real-time enforcement with actionable feedback.

1
Datadog Collector Gathers Data Collector
Extracts metadata from code, configs, and tool outputs
2
{ } Component JSON
Data centralized in structured format for evaluation
3
Slo Defined Checks Guardrail
Pass/fail result with actionable feedback in PRs

Quick Start Configuration

Add both the collector and policy to your lunar-config.yml to enable this guardrail.

📄 lunar-config.yml
# Step 1: Enable the Datadog Collector
collectors:
  - uses: github://earthly/lunar-lib/collectors/datadog@v1.0.5
    # with: ...

# Step 2: Enable the Observability Guardrails
policies:
  - uses: github://earthly/lunar-lib/policies/observability@v1.0.5
    include: [slo-defined]
    # with: ...

What Datadog Collector Collects

This collector gathers the following data that the Slo Defined guardrail evaluates.

Collector code

service

Queries the Datadog REST API for the component's monitors, dashboard, and SLOs. Discovers the Datadog service tag from the component's datadog/service-name meta annotation (typically set by a company-specific cataloger via lunar catalog component --meta datadog/service-name <name>), or falls back to the explicit service_name input for static cases. Optionally resolves a dashboard UUID from the datadog/dashboard-id meta or the dashboard_id input — dashboards in Datadog are not universally tagged with service:, so they must be mapped explicitly. Monitors (via /api/v1/monitor) and SLOs (via /api/v1/slo) are filtered by the service:<name> tag; dashboard is fetched by UUID when set. Writes normalized data to .observability.dashboard, .observability.alerts (monitors), .observability.slo, and .observability.source, with raw API responses under .observability.native.datadog.api.

Collector code

repo-files

Walks the component repository looking for Datadog-as-code JSON files by content fingerprint. Dashboards are identified by a top-level widgets array plus a layout_type field (the shape produced by Datadog's dashboard JSON export and the datadog_dashboard_json Terraform resource). Monitors are identified by a top-level object with type (e.g. metric alert, query alert, service check), query, and name fields. Users can narrow the scan by setting the find_command input (e.g. to restrict to a datadog/ directory); by default the full repo is walked. Writes each matching file's raw JSON (plus its repo path) into .observability.native.datadog.repo_dashboards and .observability.native.datadog.repo_monitors for users to build custom policies against. This sub-collector does not write to normalized .observability.dashboard / .observability.alerts paths — the API sub-collector owns those; repo files only surface raw content.

Example Data Flow

Here's an example of the data that Datadog Collector writes to the Component JSON, which Slo Defined then evaluates.

{ } component.json From Datadog Collector
{
  "observability": {
    "source": {
      "tool": "datadog",
      "integration": "api"
    },
    "dashboard": {
      "id": "abc-123-def",
      "exists": true,
      "url": "https://app.datadoghq.com/dashboard/abc-123-def"
    },
    "alerts": {
      "configured": true,
      "count": 7
    },
    "slo": {
      "defined": true,
      "count": 2,
      "has_error_budget": true
    },
    "native": {
      "datadog": {
        "api": {
          "service_tag": "payment-api",
          "monitors": [ "...list of Datadog monitor objects..." ],
          "dashboard": { "...full Datadog dashboard API response..." },
          "slos": [ "...list of SLO objects..." ]
        },
        "repo_dashboards": [
          {
            "path": "datadog/payment-api-overview.json",
            "dashboard": { "title": "Payment API", "layout_type": "ordered", "widgets": [] }
          }
        ],
        "repo_monitors": [
          {
            "path": "datadog/monitors/latency.json",
            "monitor": { "name": "High p99 latency", "type": "metric alert", "query": "avg(last_5m):..." }
          }
        ]
      }
    }
  }
}

Configuration Options

Datadog Collector Inputs

Input Required Default Description
datadog_site Optional datadoghq.com Datadog site (e.g. `datadoghq.com`, `datadoghq.eu`, `us3.datadoghq.com`). Used to build API URLs and dashboard links. Defaults to the US1 site.
service_name Required Datadog service tag value (e.g. `payment-api`). Optional if the component has a `datadog/service-name` meta annotation set by a cataloger. Monitors and SLOs are filtered by `service:<name>`.
dashboard_id Required Datadog dashboard UUID (e.g. `abc-123-def`). Optional if the component has a `datadog/dashboard-id` meta annotation. Dashboards in Datadog are not universally tagged with `service:`, so they must be mapped explicitly.
find_command Optional find . -type f -name '*.json' Command used by the `repo-files` sub-collector to enumerate candidate JSON files (must output one path per line). Narrow this to restrict the scan to a subdirectory, e.g. `find ./datadog -type f -name '*.json'`.

Ready to Automate Your Standards?

See how Lunar can turn your AGENTS.md, engineering wiki, compliance docs, or postmortem action items into automated guardrails with our 200+ built-in guardrails.

Works with any process
check AI agent rules & prompt files
check Post-mortem action items
check Security & compliance policies
check Testing & quality requirements
Automate Now
Paste your AGENTS.md or manual process doc and get guardrails in minutes
Book a Demo