The Simplest Way to Make Airflow and Prometheus Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Pairing airflow and prometheus lets your team track pipeline runs and spot slow tasks fast. Airflow sends out run counts and task times, and Prometheus scrapes and stores those numbers. This workflow helps engineers catch broken jobs before data delays hurt downstream reports. You get clear charts for task queues, worker load, and scheduler health in one place. How data and roles flow between airflow and prometheus Airflow tracks internal events like task starts, failures, and scheduler loop

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Pairing airflow and prometheus lets your team track pipeline runs and spot slow tasks fast. Airflow sends out run counts and task times, and Prometheus scrapes and stores those numbers.

This workflow helps engineers catch broken jobs before data delays hurt downstream reports. You get clear charts for task queues, worker load, and scheduler health in one place.

How data and roles flow between airflow and prometheus

Airflow tracks internal events like task starts, failures, and scheduler loop times during each run. It does not speak the native Prometheus format out of the box in most setups. Teams run a small translator service next to the scheduler to bridge this gap. Airflow pushes raw event counts to that translator over a local network port. The translator turns those stats into text metrics that Prometheus can read on a schedule.

Prometheus reaches out to the translator endpoint to pull fresh numbers every few seconds. You should secure this pull path with strict network rules and service accounts. Give the Prometheus scraper a read-only role so it can only fetch metric pages. Never let the metric collector write data back to the workflow database or trigger jobs. Use TLS certificates on the scrape port so network snoopers cannot read your job names. Keep the translator on an internal subnet that blocks public web traffic by default.

Common failure modes and how to scope network paths

Many teams make the mistake of using one broad service key for all metric endpoints. If an attacker steals that shared key, they can read data across every cluster. Another common flaw is leaving the metric port open to the whole internal network. Any user on the network can then poll the endpoint and map your pipeline logic. High metric volume is a third risk that breaks production monitoring setups fast.

If Airflow attaches unique run tags to every metric, Prometheus will run out of memory. You can fix this by dropping run IDs and keeping only high-level job names. Scope your network paths so only the metric server IP can reach the translator port. Assign a dedicated service identity to each environment so dev tools cannot read prod stats. Rotate your scrape tokens on a regular schedule and log every failed login attempt.

End-to-End Encryption + Prometheus Security: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Keeping pipeline metrics clean and reliable

Good monitoring depends on clean metric labels and steady scrape rates across your fleet. Set up clear drop rules in your collector to filter out noisy task stats. Track only the signals that point to real bottlenecks, like queued task counts and worker slots. Test your alert rules in a staging setup before pushing them to production servers.

Review your network firewall rules each month to remove dead collector IPs and old roles. When developers need to check live scheduler databases or worker nodes, avoid shared admin keys. Tie every engineer action to their own work identity and log all database queries. If your team queries tables with sensitive fields, apply data masking to rewrite emails or card numbers in results.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

How does Prometheus get metrics from Airflow?

Airflow sends raw stats to a local translator service over a fast network port. Prometheus then scrapes that translator endpoint on a fixed timer to store the metrics.

Why did Prometheus run out of memory after adding Airflow?

Airflow often sends unique task and run labels that create millions of separate metric series. You must filter out dynamic run labels in your translator so only job names remain.

How should we lock down the metric scrape endpoint?

Place the metric endpoint on a private network and require TLS and a read-only token. Set firewall rules so only the Prometheus server IP address can reach that port.

The query runs. The emails stay hidden.