Schedule icon
Request icon
If icon
Log icon
SlackIncomingWebhook icon
Fail icon

GraphQL federated subgraph availability and SDL schema sentinel

Probe GraphQL federated subgraphs for _service SDL schema availability every 5 minutes and alert SRE teams in Slack to prevent supergraph composition outages.

Categories
CloudInfrastructure

Prevent distributed GraphQL supergraph outages and composition failures by continuously monitoring individual federated microservice subgraphs. In modern enterprise federated architectures (Apollo Federation, Hive Gateway, Cosmo Router), a central gateway dynamically delegates client queries to discrete underlying microservices (subgraphs) representing distinct business capabilities. Under the Apollo Federation specification, every subgraph must reliably expose its Schema Definition Language via the _service { sdl } field. When a single subgraph encounters an internal error, container crash loop, or invalid schema update, the gateway router can fail composition or drop entity resolution across user sessions. This blueprint executes a 5-minute health probe using io.kestra.plugin.graphql.Request, validates SDL response payloads, and trips an automated Slack incident alert and pipeline failure when a subgraph degrades.

How it works

  1. A Schedule trigger executes an automated probe every 5 minutes (shipped disabled by default).
  2. Task probe_subgraph_federation sends a federation probe query (query CheckFederationSDL { _service { sdl } __typename }) to the subgraph HTTP endpoint (subgraph_endpoint_url) authenticated via SUBGRAPH_API_KEY. It configures failOnGraphQLErrors: false and allowFailed: true to inspect error bodies safely.
  3. Task evaluate_subgraph_health (io.kestra.plugin.core.flow.If) evaluates two conditions: HTTP status 200 and the absence of any GraphQL error payloads:
    • If healthy: Task log_subgraph_healthy logs operational confirmation.
    • If degraded: Task alert_subgraph_outage delivers a high-priority Slack notification detailing the failing subgraph and HTTP status code. If inputs.fail_on_subgraph_down is enabled, task halt_pipeline_gate terminates the execution with an error.
  4. Task log_audit_summary logs the audit metrics.
  5. Top-level errors handler catches DNS resolution failures or VPC network drops.

What you get

  • Continuous 5-minute automated health verification of federated GraphQL subgraphs.
  • Early detection of broken _service SDL endpoints before router schema composition fails.
  • Targeted Slack notifications pinpointing the exact offending microservice team.
  • A reliable CI/CD gate preventing router deployment when downstream subgraphs are offline.

Who it's for

  • API Platform and Core Infrastructure teams managing federated GraphQL gateways.
  • Microservice backend engineers responsible for domain-specific subgraphs.
  • Site Reliability Engineers (SRE) monitoring distributed service-mesh availability.

Why orchestrate this with Kestra

Standard generic HTTP pings verify only that a web server is listening on port 80/443; they cannot detect whether a subgraph's GraphQL schema parser or federation metadata resolver is broken. Kestra provides native GraphQL execution via io.kestra.plugin.graphql.Request, secure secret management for service-to-service API tokens, declarative flow-control logic, and automated multi-channel incident dispatch in plain YAML.

Prerequisites

  • An accessible GraphQL subgraph endpoint supporting Apollo Federation (_service { sdl }).
  • An internal API token or bearer secret if the subgraph requires authentication.
  • A Slack Incoming Webhook URL.

Secrets

  • SUBGRAPH_API_KEY: API token passed in the Authorization: Bearer header.
  • SLACK_WEBHOOK_URL: Slack Incoming Webhook URL used to receive incident notifications.

Quick start

  1. Store your subgraph API key and Slack webhook in Kestra Secrets (SUBGRAPH_API_KEY and SLACK_WEBHOOK_URL).
  2. Configure subgraph_endpoint_url with your subgraph URL and provide a recognizable subgraph_name (e.g. billing-subgraph).
  3. Trigger a manual execution from the Kestra UI to verify that the query connects successfully.
  4. Enable the periodic_subgraph_probe schedule to establish continuous 5-minute availability monitoring.

How to extend

  • Wrap the probe task in a Loop task to query a complete array of all company subgraphs in a single execution.
  • Compare the returned SDL schema against a Git-versioned baseline to detect unauthorized schema drift.
  • Integrate with ArgoCD or Kubernetes restart tasks to automatically restart failed subgraph pods.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.