Webhook icon
Script icon
Docker icon
Request icon
If icon
Log icon
SlackIncomingWebhook icon
Fail icon

Deployment Marker & Grafana Dashboard Annotation Trigger

Automatically post deployment annotation markers to Grafana dashboards via webhook and notify Slack with direct links for faster incident triage.

Categories
CloudInfrastructure

When a production outage or latency spike occurs, the first question on-call engineers ask is: "Did someone just deploy something?"

Correlating deployments and configuration changes with metrics (CPU spikes, memory leaks, HTTP 5xx error rates) is an essential Site Reliability Engineering (SRE) practice. Without markers on your dashboards, responders must manually cross-reference release logs, Git commits, and CI/CD runs while the clock is ticking.

This blueprint provides an automated deployment marker gateway:

  • Exposes an event-driven Webhook endpoint ready to be called by any CI/CD pipeline (GitHub Actions, GitLab CI, ArgoCD post-sync hooks, or Jenkins).
  • Formats deployment context (service name, version tag, commit SHA, deployer, release notes) into Grafana's native annotation format.
  • Writes the vertical event marker directly into Grafana metric panels using the Grafana REST API (POST /api/annotations).
  • Validates API delivery and delivers an announcement to Slack containing deployment metadata and dashboard links.

How it works

  1. deployment_webhook listens for incoming HTTP POST events containing release metadata payload (service_name, environment, version, commit_sha).
  2. build_annotation_payload (io.kestra.plugin.scripts.python.Script on python:3.11-slim) calculates millisecond Unix timestamps, structures Grafana tags (deployment, environment, service), and formats HTML tooltips for dashboard popups.
  3. post_grafana_annotation (io.kestra.plugin.core.http.Request) submits the payload to {{ secret('GRAFANA_URL') }}/api/annotations authenticated with a Grafana Service Account token.
  4. evaluate_post_response (io.kestra.plugin.core.flow.If) inspects the HTTP response status:
    • On 200/201: Logs success, captures the annotation ID, and sends a Slack card to the team.
    • On error: Alerts Slack with the HTTP error code and fails the execution via Fail.
  5. An errors block catches unexpected worker failures or connectivity issues.

What you get

  • Instant Triage Context: SREs immediately see vertical markers on latency and error rate charts indicating the exact moment of rollout.
  • Global or Dashboard-Specific Scoping: Annotate globally across all dashboards or target a specific dashboard UID.
  • Universal CI/CD Compatibility: Plugs cleanly into curl steps in GitHub Actions, GitLab CI, ArgoCD, or Kubernetes lifecycle hooks.
  • Zero Credential Exposure: Tokens and webhook URLs remain secured inside Kestra namespace secrets.

Prerequisites

  • A running Grafana instance (v8.0+ OSS, Enterprise, or Grafana Cloud).
  • A Grafana Service Account token with Annotations: Writer or Editor role.
  • An incoming Slack webhook URL for notifications.

Secrets

  • GRAFANA_URL: Base URL of your Grafana server (e.g. https://grafana.example.com or https://org.grafana.net).
  • GRAFANA_API_TOKEN: Service Account token generated from Grafana (Administration -> Users and access -> Service accounts).
  • SLACK_WEBHOOK_URL: Slack Incoming Webhook URL.

Quick start

  1. Add GRAFANA_URL, GRAFANA_API_TOKEN, and SLACK_WEBHOOK_URL to your Kestra namespace secrets.
  2. Retrieve the Webhook URL from the Kestra UI under the deployment_webhook trigger tab.
  3. Add a step in your CI/CD pipeline (e.g. GitHub Actions) to call the webhook:
    curl -X POST "https://kestra.example.com/api/v1/executions/webhook/company.sre/grafana-deployment-annotation-marker/deploy-marker" \
      -H "Content-Type: application/json" \
      -d '{
        "service_name": "checkout-api",
        "environment": "production",
        "version": "v2.4.0",
        "commit_sha": "${{ github.sha }}",
        "deployed_by": "${{ github.actor }}",
        "release_notes": "Database connection optimization"
      }'
    
  4. Check your Grafana dashboard to see the vertical deployment annotation line appear on all panels.

How to extend

  • Grafana Cloud Alerting Silence: Pair the annotation with a temporary alert silence during scheduled deployment maintenance windows.
  • Rollback Markers: Add an input flag is_rollback: true to color-code rollback markers distinctly (e.g. red tag vs green tag).
  • Datadog / New Relic Fanout: Extend the flow to publish markers simultaneously to multiple APM tools using io.kestra.plugin.core.flow.Parallel.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.