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
- Add a buffer (pyzmq or mp queue)
- Run sending metrics to GBQ in another process
- 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.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 571fc4096ff361bfe4d7dd48f04d94e8dedfc571551e4ae33919d9e3f46c8860 |
|
MD5 | d37b90e902196f7f45c6bbb1312d7ef8 |
|
BLAKE2b-256 | c0a0eb21e2e7322048acfd147eec743e878077f67734150fd1096d89a1503134 |
Close
Hashes for airflow_metrics_gbq-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d854e5ec7b249ee8ce7df8517dbf830ececfc5e0aa56bd3f4db188be105ffe27 |
|
MD5 | 21e410d740702632470b7421818fd0c7 |
|
BLAKE2b-256 | 835129c287abd400cef4e98b94ab669a13abb6737dc57bdcd25e532aaea6a765 |