Webhook icon
Schedule icon
WorkingDirectory icon
Commands icon
Docker icon
Script icon
If icon
SlackIncomingWebhook icon
Fail icon
Log icon

Gate Releases on Akamai Edge Cache Hit Ratio Degradation

Compare Akamai edge cache hit ratio windows per property, flag degradation past a threshold, alert Slack with the worst property, and fail the gate.

Categories
Infrastructure

How it works

  1. on_cache_metrics (io.kestra.plugin.core.trigger.Webhook, keyed with the AKAMAI_CACHE_WEBHOOK_KEY secret) receives the per property cache metrics from your CDN telemetry relay. morning_ratio_check (io.kestra.plugin.core.trigger.Schedule, cron 0 5 * * *) is the safety net and ships disabled: true until an operator turns it on.
  2. cache_workspace (io.kestra.plugin.core.flow.WorkingDirectory) opens one shared directory so the staged fixture and the scorer read the same file, a scratch directory outside a WorkingDirectory is purged between tasks and would break that hand-off.
  3. write_cache_metrics_fixture (io.kestra.plugin.scripts.shell.Commands on the io.kestra.plugin.scripts.runner.docker.Docker runner, image alpine:3.20) writes cache_metrics.json with a heredoc. The fixture holds a storefront property whose hit ratio fell from an 87.5 baseline to 61.2 after a config push, a static property that held its ratio and a low ratio API property, the shape a bad cache rule push produces. entryPoint: [] clears the image entrypoint so the shell script runs instead of the default command.
  4. score_hit_ratio (io.kestra.plugin.scripts.python.Script on python:3.12-slim) prefers the posted webhook body when present and falls back to the staged file. For every property it subtracts the current hit ratio from the baseline, counts the property as degraded when the drop meets min_degradation_pct and the window carried at least min_requests requests, and picks the largest drop as the worst property. The verdict, the counters and the worst property with its delta and config version are printed as a single ::{"outputs": ...}:: line.
  5. degradation_gate (io.kestra.plugin.core.flow.If) branches on verdict == 'DEGRADED'. Degraded windows reach alert_degraded (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) with the worst property, the delta and the config version, then fail_gate (io.kestra.plugin.core.execution.Fail) stops the pipeline so the push can be rolled back; healthy windows record log_healthy so the execution history doubles as edge evidence.
  6. The flow level errors handler (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) reports any failure with the execution id, because a dead scorer looks exactly like a healthy edge.

What you get

  • A gateable verdict that separates a bad config push from normal traffic noise, with UNKNOWN for a broken telemetry relay.
  • A Slack alert that names the worst property, its percentage point drop, its current ratio and the config version to roll back.
  • A failing execution your deploy pipeline can branch on, so origin load stops climbing the moment the ratio collapses.
  • verdict, degraded_count, worst_property, worst_delta_pct, worst_current_ratio and worst_config_version as typed outputs for edge performance dashboards.
  • A disabled morning schedule as a second net once the webhook path is trusted.

Who it's for

  • Edge platform teams that own Akamai properties and need a bad cache rule push caught before origin capacity is exhausted.
  • SREs on call for origin load spikes who want the offending property and config version in the page itself.
  • Release engineers wiring edge health into a progressive delivery gate instead of watching dashboards by eye.

Why orchestrate this with Kestra

The CDN reports hit ratios per property but nothing compares the current window against a baseline, names the worst offender and stops the deploy line when the ratio collapses. Kestra gives the check a keyed webhook for on demand scoring, a disabled schedule as the safety net, a fixture driven scorer whose comparison rules live in version control, an If that isolates the degraded window, and routing into Slack and execution failure from one declarative file. A cron job with a metrics script gives you none of the history, the branching or the gateable outputs.

Prerequisites

  • A worker with Docker access, the fixture runs in alpine:3.20 and the scorer in python:3.12-slim.
  • A CDN telemetry relay that can POST per property hit ratio windows with baseline, current, request counts and config version to the webhook, or rely on the staged fixture for trial runs.
  • A Slack incoming webhook for the degradation alert and for failure alerts.

Secrets

  • AKAMAI_CACHE_WEBHOOK_KEY: key segment guarding the metrics webhook URL, anyone holding it can trigger a scoring run.
  • SLACK_WEBHOOK_URL: Slack incoming webhook used by alert_degraded and by the errors block.

Quick start

  1. Add the two secrets to your Kestra namespace.
  2. Run the flow once with the default inputs. The staged fixture carries a 26.3 point drop on www.example.com, so expect verdict: DEGRADED, worst_property www.example.com, a Slack alert naming config v42-push-2026-10-14 and a red execution.
  3. Re-run with min_degradation_pct at 30 to watch the same fixture route log_healthy, because the worst drop stops meeting the threshold.
  4. Point your telemetry relay at /api/v1/{tenant}/executions/webhook/{namespace}/akamai-cache-hit-ratio-degradation-gate/{AKAMAI_CACHE_WEBHOOK_KEY} and POST a snapshot where every property held its baseline to see the all-clear branch.
  5. Enable morning_ratio_check once the webhook path is trusted so the staged snapshot is rescored every morning.

How to extend

  • Compare three windows, current, previous and trailing seven day, by extending score_hit_ratio so a slow slide is caught as well as a sudden cliff.
  • Persist every scored window with io.kestra.plugin.jdbc.postgresql.Queries to chart hit ratio deltas per property over the quarter.
  • Fan out across many Akamai contracts with io.kestra.plugin.core.flow.Loop over a subflow that scores one property group each.
  • Swap the Slack alert for a rollback subflow that calls the Akamai APIs to restore the previous config version automatically.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.