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.pyto 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_monitoringapp_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
Metadata
Release files for airflow-metrics-gbq 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| airflow_metrics_gbq-0.1.0.tar.gz | 7.4 kB | Without provenance | Details for airflow_metrics_gbq-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| airflow_metrics_gbq-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for airflow_metrics_gbq-0.1.0-py3-none-any.whl |
Total release size: 16.8 kB
Release files / airflow_metrics_gbq-0.1.0.tar.gz
| Download URL | airflow_metrics_gbq-0.1.0.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c28afee21ee86eb86bec9437b6dbf7ccba4f92e43cdeafb5813acf16538d30ad
|
|
BLAKE2b-256 checksum How to use checksums |
8487f54eb4a13169963eb49c829c4a65e5fc0b875ef84f471c2c9df620b2f9a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.11.2 Darwin/21.6.0
|
Release files / airflow_metrics_gbq-0.1.0-py3-none-any.whl
| Download URL | airflow_metrics_gbq-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e811375b8306eb26a8f17383e53cf45f6b56ab82009ef979daa321246df5aabb
|
|
BLAKE2b-256 checksum How to use checksums |
3a5be466183cd28a188672d1fd118c04d5b246fa92881825cd7fbb5e23db914c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.11.2 Darwin/21.6.0
|
Security for airflow-metrics-gbq 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.