Script icon
Docker icon
If icon
SlackIncomingWebhook icon
Log icon
Return icon
Schedule icon

Backstage Software Catalog Entity Sync Error Sentinel

Queries Backstage Catalog API to track entity processing errors, orphan dependency node buildup, and stale locations with Slack alerting.

Categories
CoreInfrastructure

Production-grade platform engineering watchdog that continuously monitors Spotify Backstage developer portal instances. It tracks entity ingestion processing failures across catalog-info.yaml files, detects orphan entity node accumulation caused by deleted repository locations, monitors stale location refresh loops, and dispatches structured Slack alerts before developer portal software component discovery breaks.

How it works

  1. A recurring schedule trigger wakes the flow every 15 minutes to initiate Backstage catalog surveillance.
  2. A containerized Python script queries the Backstage Catalog REST API (/api/catalog/entities).
  3. The script identifies orphaned software components (backstage.io/orphan: true) lacking upstream parent manifests.
  4. The script monitors location refresh errors caused by deleted Git repositories or Git provider authentication tokens.
  5. A decision gate evaluates whether stale location counts or orphan entities breach platform hygiene standards.
  6. When catalog synchronization fails, high-priority notifications dispatch to Platform Engineering channels with runbooks.
  7. A structured audit manifest is emitted for enterprise compliance records and developer portal telemetry archives.

Architecture diagram

flowchart TD
    A[Schedule Trigger: Every 15 Mins] --> B[scan_backstage_catalog_status]
    B --> C{evaluate_backstage_threshold}
    C -- Alert Triggered --> D[notify_slack_platform_team]
    C -- Nominal State --> E[log_nominal_backstage_state]
    D --> F[emit_audit_manifest]
    E --> F[emit_audit_manifest]

Architecture components

  • Trigger (periodic_backstage_audit): Recurring cron schedule executing every 15 minutes for proactive catalog surveillance.
  • Scraper Task (scan_backstage_catalog_status): Docker-isolated Python script polling Backstage APIs with error handling.
  • Decision Gate (evaluate_backstage_threshold): Evaluates stale locations and orphan entities against user thresholds.
  • Notification Task (notify_slack_platform_team): Sends rich Slack alert with entity counts, errors, and platform runbooks.
  • Compliance Manifest (emit_audit_manifest): Emits structured JSON summary for platform audit archives.

Key capabilities

  • Continuous surveillance of software catalog entity ingestion and YAML schema validation status.
  • Early warning for GitHub or GitLab Personal Access Token (PAT) expiration before catalog refreshes halt.
  • Automated tracking of orphaned components, APIs, and system dependency graph nodes.
  • Standardized Slack alerting with operational runbook instructions for platform engineers.

What you get

  • Real-time visibility into internal developer portal software catalog accuracy and synchronization health.
  • Protection against stale service ownership records that hinder incident response and on-call routing.
  • Automated Slack incident notifications with entity processing metrics and remediation advice.
  • Clean compliance manifests recording software component ownership for SOC 2 platform audit trails.

Who it's for

  • Platform Engineers maintaining internal developer portals and Spotify Backstage instances.
  • Enterprise Software Architects managing microservice ownership registries and API catalogs.
  • Site Reliability Engineers relying on developer portal metadata for automated incident triage.
  • DevSecOps Teams enforcing repository metadata governance and software bill of materials (SBOM) standards.

Why orchestrate this with Kestra

  • Decoupled Architecture: Queries standard Backstage REST APIs externally without installing custom plugins.
  • Deterministic Scheduling: Native cron scheduling ensures consistent surveillance without cron daemon drift.
  • Isolated Execution: Runs Python scrapers inside isolated Docker containers with pre-installed libraries.
  • Enterprise Auditability: Generates structured execution histories and JSON manifests for regulatory reporting.

Use cases

  • GitHub Token Rate Limit Detection: Catch when catalog processor threads exhaust GitHub API secondary rate limits.
  • Repository Deletion Cleanup: Detect orphan components left behind when application microservice repos are archived.
  • Schema Syntax Validation: Identify developer PRs introducing broken catalog-info.yaml syntax before merging.
  • Multi-Entity Provider Stalls: Monitor custom entity provider ingest performance across AWS, GCP, and Kubernetes.

Inputs

Name Type Default Description
backstage_api_url STRING http://backstage.platform.svc.cluster.local:7007 Base HTTP URL exposing Backstage developer portal API.
target_catalog_namespace STRING default Target Backstage catalog namespace under active surveillance.
max_stale_locations_threshold INT 5 Maximum allowable stale catalog locations before alerting.
lookback_minutes INT 15 Lookback evaluation window in minutes for catalog telemetry.
alert_on_backstage_failures BOOL true Toggle Slack alert dispatch upon detecting sync errors or orphan nodes.

Expected outputs

  • {{ outputs.scan_backstage_catalog_status.vars.stale_locations_count }}: Count of catalog locations failing background refresh.
  • {{ outputs.scan_backstage_catalog_status.vars.orphan_entities_count }}: Total number of orphan entities lacking parent manifests.
  • {{ outputs.scan_backstage_catalog_status.vars.processing_errors_count }}: Count of unparseable catalog entities encountered.
  • {{ outputs.scan_backstage_catalog_status.vars.total_entities_count }}: Total number of registered software catalog entities.
  • {{ outputs.scan_backstage_catalog_status.vars.is_alerting }}: Boolean flag indicating whether failure thresholds were breached.
  • {{ outputs.emit_audit_manifest.value }}: Structured JSON audit manifest emitted for compliance archives.

Prerequisites

  • Backstage instance deployed with Catalog API exposed on port 7007.
  • Catalog API reachable from the Kestra worker execution environment.
  • Docker daemon running on the Kestra host to execute containerized Python tasks.

Secrets

  • BACKSTAGE_API_TOKEN: Service-to-service authentication token with read access to the Catalog API.
  • SLACK_WEBHOOK_URL: Incoming webhook URL for the target Platform Engineering Slack alerting channel.

Quick start

  1. Ensure Backstage backend service exposes /api/catalog to the Kestra worker pods.
  2. Configure the BACKSTAGE_API_TOKEN and SLACK_WEBHOOK_URL secrets in your Kestra namespace settings.
  3. Specify your catalog namespace in target_catalog_namespace.
  4. Execute a manual test run via the Kestra UI to verify API ingestion.
  5. Enable the periodic_backstage_audit trigger to establish automated continuous surveillance.

Common pitfalls and troubleshooting

  • GitHub Secondary Rate Limits: Parallel catalog processors without caching exhaust GitHub token limits rapidly.
  • Circular Entity Relations: Bad spec.dependsOn loops cause processor worker threads to hang indefinitely.
  • PostgreSQL Connection Pool: High catalog polling frequency exhausts PostgreSQL connection pools without PgBouncer.
  • Orphan Entity Cleanup Delay: Deleting a Location entity requires running the orphan pruner to delete child components.

How to extend

  • Automated Orphan Entity Deletion: Trigger a DELETE API request to prune orphan entities older than 7 days.
  • Slack Notification to Service Owner: Chain a task to alert the specific team owning a broken catalog-info.yaml.
  • PagerDuty Escalation: Escalate to on-call platform engineers if stale locations exceed 20 for over 30 minutes.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.