Hamburger Cross Icon
Observability Guardrails - Lunar Policy for Operational Readiness

Observability Guardrails

Policy Beta Operational Readiness

Enforce baseline observability for production services. Verify each service has a linked monitoring dashboard and at least one alert rule configured. Works with any observability-category collector (Grafana, Datadog, etc.) via the tool-agnostic .observability paths.

Add observability to your lunar-config.yml:
uses: github://earthly/lunar-lib/policies/observability@v1.0.5

Included Guardrails

This policy includes 2 guardrails that enforce standards for your operational readiness.

Guardrail

dashboard-exists

Verifies that the service has a linked monitoring dashboard by checking .observability.dashboard.exists is true. Fails if observability data is present but .observability.dashboard.exists is false (the UID is registered but the dashboard is gone in Grafana). Skips cleanly when no observability source has written data for this component.

observability dashboard monitoring grafana datadog
View Guardrail
Guardrail

alerts-configured

Verifies that at least one alert rule is configured for the service by checking .observability.alerts.configured is true. Fails if alerting data is present but no rules are configured. Skips cleanly when no observability source has written data for this component.

observability alerts alerting monitoring grafana datadog
View Guardrail

How Guardrails Fit into Lunar

Lunar guardrails define your engineering standards as code. They evaluate data collected by integrations and produce pass/fail checks with actionable feedback.

Policies support gradual enforcement—from silent scoring to blocking PRs or deployments—letting you roll out standards at your own pace without disrupting existing workflows.

Learn How Lunar Works
1
Integrations Gather Data
Collectors extract metadata from code, CI pipelines, tool outputs, and scans
2
{ } Centralized as JSON
All data merged into each component's unified metadata document
3
Guardrails Enforce Standards This Policy
Real-time feedback in PRs and AI workflows

Example Evaluated Data

This policy evaluates structured metadata from the Component JSON. Here's an example of the data it checks:

{ } component.json Example Input
{
  "observability": {
    "source": {
      "tool": "grafana",
      "integration": "api"
    },
    "dashboard": {
      "id": "abc123",
      "exists": true,
      "url": "https://grafana.example.com/d/abc123/payment-api"
    },
    "alerts": {
      "configured": true,
      "count": 5
    }
  }
}

Required Integrations

This policy evaluates data gathered by one or more of the following integration(s). Make sure to enable them in your lunar-config.yml.

Documentation

View on GitHub

Observability Guardrails

Enforce baseline observability standards for production services: linked monitoring dashboard and configured alert rules.

Overview

This policy validates that each service has a linked monitoring dashboard and at least one alert rule configured. It reads from the tool-agnostic .observability category, so the same checks work whether the data comes from Grafana, Datadog, or another provider.

Policies

This plugin provides the following policies (use include to select a subset):

Policy Description
dashboard-exists Verifies a monitoring dashboard is linked to the service
alerts-configured Verifies at least one alert rule is configured

Required Data

This policy reads from the following Component JSON paths:

Path Type Provided By
.observability.dashboard.exists boolean grafana collector (or any observability-category collector)
.observability.alerts.configured boolean grafana collector

Note: Ensure a collector that writes to the .observability category is configured before enabling this policy.

Installation

Add to your lunar-config.yml:

policies:
  - uses: github://earthly/lunar-lib/policies/observability@v1.0.0
    on: ["domain:your-domain"]
    enforcement: report-pr
    # include: [dashboard-exists]  # Only run specific checks

Examples

Passing Example

{
  "observability": {
    "source": { "tool": "grafana", "integration": "api" },
    "dashboard": { "id": "abc123", "exists": true, "url": "https://grafana.example.com/d/abc123/payment-api" },
    "alerts": { "configured": true, "count": 5 }
  }
}

Failing Example

{
  "observability": {
    "source": { "tool": "grafana", "integration": "api" },
    "dashboard": { "id": "abc123", "exists": false },
    "alerts": { "configured": false, "count": 0 }
  }
}

Failure message (dashboard-exists): "No monitoring dashboard is linked for this service"

Remediation

When this policy fails, you can resolve it by:

  1. dashboard-exists: Create or link a monitoring dashboard for the service. For Grafana, register the dashboard UID on the component via lunar catalog component --meta grafana/dashboard-uid <uid>.
  2. alerts-configured: Create at least one alert rule scoped to the service's dashboard folder in Grafana (or the equivalent construct in your monitoring tool).

Open Source

This policy is open source and available on GitHub. Contribute improvements, report issues, or fork it for your own use.

View Repository

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 100+ 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