Airflow metrics to Google BigQuery
Project description
Airflow Metrics to BigQuery
Sends airflow metrics to Bigquery
Installation
pip install airflow-metrics-gbq
Usage
- Activate statsd metrics in
airflow.cfg
[metrics]
statsd_on = True
statsd_host = localhost
statsd_port = 8125
statsd_prefix = airflow
- Restart the webserver and the scheduler
systemctl restart airflow-webserver.service
systemctl restart airflow-scheduler.service
- Check that airflow is sending out metrics:
nc -l -u localhost 8125
- Install this package
- Create required tables (counters, gauges and timers), an example is shared here
- Create materialized views which refresh when the base table changes, as describe here
- Create a simple python script
monitor.py
to provide configuration:
from airflow_metrics_gbq.metrics import AirflowMonitor
if __name__ == '__main__':
monitor = AirflowMonitor(
host="localhost", # Statsd host (airflow.cfg)
port=8125, # Statsd port (airflow.cfg)
gcp_credentials="path/to/service/account.json",
dataset_id="monitoring", # dataset where the monitoring tables are
counts_table="counts", # counters table
last_table="last", # gauges table
timers_table="timers" # timers table
)
monitor.run()
- Run the program, ideally in the background to start sending metrics to BigQuery:
python monitor.py &
- The logs can be viewed in the GCP console under the
airflow_monitoring
app_name in Google Cloud Logging.
Future releases
- Increase test coverage (unit and integration tests)
- Add proper typing and mypy support and checks
- Provide more configurable options
- Provide better documentation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for airflow_metrics_gbq-0.0.5a3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f54066897d7a9c6a0064c4839cb5d9f53593620aee00a676a0a9e8b17de1e03 |
|
MD5 | 6d4b3e97745238cf68a56af2a08312a1 |
|
BLAKE2b-256 | c9cc3bc4cdb3a0ade6af10f71fd46125abec0ce7dd1d49b726fb29e3c1931cbc |
Close
Hashes for airflow_metrics_gbq-0.0.5a3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8f2df57affa69338b6f7c777a4c251ab61760b1bc66e8624733a31ca46aa2b3 |
|
MD5 | c5ad04dddca3673672d7ee4c7374ed8a |
|
BLAKE2b-256 | ecc6a91d721c23b3be98e5724e48446a9f529b79e094a377eb0b123bb560c401 |