Schedule icon
Request icon
Switch icon
Log icon
SlackIncomingWebhook icon

Flagsmith Feature Flag Health and Drift Sentinel

Audit Flagsmith feature flag engine readiness, evaluate critical production toggle states, and dispatch automated Slack incident alerts on service drift.

Categories
Infrastructure

Automated drift auditor and health gate that continuously monitors Flagsmith open-source feature flagging engines for service availability and verifies critical production toggle states against expected baselines. Dispatches structured Slack incident notifications upon toggle drift or missing flags, preventing inadvertent feature rollouts and deployment regressions.

How it works

  1. A recurrent scheduled trigger initiates the feature flag audit every 4 hours, or executes on-demand via webhook before rolling out CD deployments.
  2. The probe_engine_health task queries GET /health on the target Flagsmith server to verify HTTP service availability and database connectivity.
  3. The probe_environment_flags task queries GET /api/v1/flags/ using an authenticated environment API key to retrieve live flag values, enabled statuses, and segment rules.
  4. Pebble expressions inspect the returned flag list, isolating the critical_feature_flag and comparing its live enabled state against expected_flag_state.
  5. The evaluate_flag_state_and_health flow-control Switch evaluates the classified operational posture:
    • COMPLIANT: Logs clean operational metrics when the engine is responsive and the flag matches its expected state.
    • FLAG_STATE_DRIFT: Formats and dispatches a rich Slack warning notifying on-call engineers of an unintended toggle state change.
    • FLAG_NOT_FOUND: Posts a high-priority Slack incident alert notifying platform engineers that the expected feature flag is missing from the environment.
    • ENGINE_UNHEALTHY: Alerts DevOps teams immediately if the Flagsmith health endpoint indicates service degradation or database errors.
  6. A final log_audit_summary task records execution audit telemetry, and an errors block intercepts connection timeouts or authentication failures with automated Slack escalations.

What you get

  • Early detection of accidental or unauthorized feature flag toggles in production environments.
  • Continuous health monitoring of the Flagsmith API preventing client application fallback failures.
  • Automated Slack incident routing with detailed diagnostic attachments including flag names and expected states.
  • Pre-deployment validation gate to verify required feature flags are active before triggering release pipelines.
  • Complete audit trail of feature flag compliance evaluations preserved directly in Kestra's execution history.

Who it's for

  • Platform Engineers and SREs maintaining self-hosted Flagsmith feature flagging clusters.
  • DevOps Teams operating CI/CD release pipelines and progressive canary rollouts.
  • Software Engineering Leads governing feature toggles and production runtime configurations.

Why orchestrate this with Kestra

  • Declarative Release Governance: Codify feature flag compliance policies, expected states, and escalation channels in revision-controlled YAML workflows.
  • Native Secret Isolation: Securely manage Flagsmith environment keys and Slack webhook URLs in namespace secret stores via {{ secret(...) }} without plaintext exposure.
  • Coordinated CI/CD Gating: Chain this flow as an approval gate before deploying frontend or backend microservices to confirm feature flags are provisioned.
  • Resilient Multi-State Routing: Differentiate between infrastructure downtime, missing configuration, and toggle drift using native Pebble logic and Switch tasks.

Prerequisites

  • A running Flagsmith instance (accessible over HTTP/HTTPS) with standard health and API endpoints exposed.
  • Network connectivity from the Kestra worker or runner environment to the Flagsmith server.
  • A Slack Incoming Webhook URL configured with permissions to post into your target operations channel.

Secrets

  • FLAGSMITH_ENVIRONMENT_KEY: Environment API key used for authenticating against the Flagsmith environment flags API.
  • SLACK_WEBHOOK_URL: Slack Incoming Webhook endpoint URL used for operational alerts.

Quick start

  1. Configure the required secrets (FLAGSMITH_ENVIRONMENT_KEY, SLACK_WEBHOOK_URL) in your Kestra namespace settings.
  2. Import this blueprint into your Kestra instance under your desired namespace (e.g., company.platform).
  3. Click Execute with default inputs or provide your custom flagsmith_host and critical_feature_flag to validate connectivity against your instance.
  4. Review execution logs under the Executions tab to confirm that flag states and engine health codes are parsed correctly.
  5. Enable the scheduled_sentinel_audit trigger to establish recurrent 4-hour automated flag health evaluations.

How to extend

  • Automated Rollback / Remediate: Extend the drift branch with an authenticated HTTP request (POST /api/v1/flags/{id}/) to restore the expected flag state automatically.
  • Multi-Environment Comparison: Combine with a Kestra ForEach loop task to verify flag parity across staging, canary, and production environments.
  • PagerDuty Escalation: Route critical ENGINE_UNHEALTHY states directly to PagerDuty or Opsgenie on-call schedules.
  • CI/CD Pipeline Webhook: Trigger this flow via an incoming webhook trigger from GitHub Actions or GitLab CI to gate production deployment jobs.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.