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

Tempo Distributor Block Compaction and S3 Flush Sentinel

Audits Grafana Tempo Prometheus metrics to detect distributor span drops, compact block flush errors, and S3 upload stalls.

Categories
CloudInfrastructure

Automates continuous health and storage durability surveillance for Grafana Tempo distributed trace storage clusters.

How it works

  1. A schedule trigger executes the Tempo tracing audit workflow every 15 minutes.
  2. The Python task queries the Tempo distributor Prometheus metrics endpoint on port 3200.
  3. The script extracts received and dropped trace span counters, ingester compact block flush rates, and S3 upload errors.
  4. An evaluation gate determines whether dropped span counts or storage flush errors breach operational tolerance bounds.
  5. When thresholds are breached, a high-priority Slack alert is dispatched to telemetry engineering and observability SREs.
  6. When trace spans ingest cleanly and compact blocks upload without error, nominal telemetry is logged.
  7. A structured JSON audit manifest is emitted for distributed tracing governance and telemetry SLA compliance records.

Architecture diagram

graph TD
    Trigger[Schedule Trigger: 15m] --> ScanMetrics[Python Script: Scrape Tempo Metrics]
    ScanMetrics --> EvalBreach{Dropped Spans > Threshold OR Flush Errors > 2?}
    EvalBreach -- Yes --> SlackAlert[Slack: High-Urgency Telemetry Alert]
    EvalBreach -- No --> LogNominal[Log: Nominal Tempo State]
    SlackAlert --> EmitManifest[Debug Return: Tempo Audit Manifest]
    LogNominal --> EmitManifest

Architecture components

  • Trigger: Automated schedule polling at 15-minute intervals.
  • Script Task: Scrapes Tempo Prometheus telemetry endpoints using Docker container isolation.
  • Decision Gate: Evaluates whether dropped span rates or compact block flush failures exceed safety limits.
  • Notification Task: Dispatches structured Slack alerts with cluster identity and error counts.
  • Audit Manifest: Emits JSON execution payloads containing tracing storage health and timestamps.

Key capabilities

  • Continuous surveillance of Grafana Tempo distributor ingestion queues and OpenTelemetry span drop rates.
  • Rapid detection of ingester compact block flush failures to underlying Amazon S3 or Google Cloud Storage buckets.
  • Automated tracking of tenant rate-limiting and buffer backpressure across active trace streams.
  • Zero external dependency execution via isolated containerized Python runners.

What you get

  • Preemptive alerting on distributed trace data loss before backend service latency investigations are blinded.
  • Automated tracking of S3 object storage upload retries and block compaction deadlocks.
  • Real-time audit manifests capturing distributed tracing health for SOC 2 observability compliance.
  • Configurable tolerance thresholds adaptable to high-throughput production microservice fleets.

Who it's for

  • Observability Platform SREs maintaining high-volume distributed tracing infrastructure on Kubernetes.
  • Site Reliability Engineers relying on end-to-end trace context for root-cause incident response.
  • Cloud Infrastructure Architects optimizing long-term trace block compaction and cloud object storage costs.
  • DevOps Teams diagnosing intermittent trace ingestion dropouts and Tempo distributor 429 rate limits.

Why orchestrate this with Kestra

  • Deterministic Scheduling: Guarantees regular trace pipeline health audits without fragile local crontab scripts.
  • Containerized Runners: Runs Python tasks inside isolated Docker containers without host library dependencies.
  • Condition Branching: Flowable If tasks route alerts and nominal logging cleanly without spaghetti code.
  • Enterprise Secret Safety: Securely injects Slack webhook credentials without plain-text exposure.

Use cases

  • Trace Ingestion Throttle Alerting: Alerts operators when traffic surges cause distributors to shed unbuffered trace spans.
  • Object Storage Upload Error Detection: Identifies when S3 credential expiration or bucket permission errors stall flushes.
  • Compact Block Deadlock Guard: Catches compaction queue buildup before local ingester SSD volumes run out of disk space.
  • Continuous Telemetry SLA Auditing: Emits periodic manifests proving zero span loss across enterprise trace pipelines.

Inputs

Name Type Default Description
tempo_metrics_url STRING http://tempo-distributor.monitoring.svc.cluster.local:3200 Base HTTP URL exposing Tempo metrics.
cluster_name STRING production-tempo-cluster Target Grafana Tempo distributed tracing cluster identifier.
max_dropped_spans_threshold INT 20 Max allowable dropped trace spans in a single cycle before alerting.
max_flush_errors_threshold INT 2 Max allowable compact trace block flush or S3 upload failures.
alert_on_any_compact_stall BOOL false Whether any nonzero block compaction error triggers an alert.

Expected outputs

  • {{ outputs.scan_tempo_telemetry.vars.spans_received_total }}: Total trace spans received by Tempo distributors.
  • {{ outputs.scan_tempo_telemetry.vars.spans_dropped_total }}: Count of dropped trace spans due to backpressure.
  • {{ outputs.scan_tempo_telemetry.vars.block_flushes_total }}: Total compact blocks successfully uploaded to object storage.
  • {{ outputs.scan_tempo_telemetry.vars.flush_errors_total }}: Total block flush or storage upload failures.
  • {{ outputs.scan_tempo_telemetry.vars.is_alerting }}: Boolean flag indicating tracing threshold violation.
  • {{ outputs.emit_audit_manifest.value }}: Structured JSON audit manifest emitted for compliance archives.

Prerequisites

  • Grafana Tempo deployed with Prometheus metrics enabled on port 3200 (distributor and ingester).
  • Metrics port reachable from the Kestra worker execution environment.
  • Docker daemon running on the Kestra host to execute containerized Python tasks.

Secrets

  • SLACK_WEBHOOK_URL: Incoming webhook URL for the target Telemetry SRE Slack alerting channel.

Quick start

  1. Ensure Tempo distributor service exposes port 3200 for Prometheus metrics scraping.
  2. Configure the SLACK_WEBHOOK_URL secret in your Kestra namespace settings.
  3. Specify your cluster identifier in cluster_name.
  4. Execute a manual test run via the Kestra UI to verify metric ingestion.
  5. Enable the periodic_tempo_audit trigger to establish automated continuous surveillance.

Common pitfalls and troubleshooting

  • Port Accessibility: Verify port 3200 is open across Kubernetes namespaces via proper NetworkPolicy definitions.
  • Distributor vs Ingester: If components are scaled independently, scrape a unified Prometheus aggregator endpoint.
  • IAM S3 Role Expiration: Block flush failures often point to expired AWS IRSA tokens on ingester pod service accounts.
  • Tenant Quotas: High dropped span rates frequently correlate with tenant ingestion burst limits in overrides.yaml.

How to extend

  • Automated Ingester Scale-Out: Chain a Kubernetes HPA scaling task when ingester block queues reach 85% capacity.
  • Dynamic Ingestion Tuning: Adjust tenant rate limits and burst tolerances via Tempo dynamic configuration discovery.
  • PagerDuty Escalation: Escalate to on-call telemetry engineers if S3 upload errors persist across 2 consecutive runs.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.