From d18286d206df01bf07459e203a5cb91e2915c665 Mon Sep 17 00:00:00 2001 From: Greg Neiheisel Date: Fri, 12 Oct 2018 01:51:13 -0400 Subject: [PATCH] [AIRFLOW-3177] Change scheduler_heartbeat from gauge to counter (#4027) This updates the scheduler_heartbeat metric from a gauge to a counter to better support the statsd_exporter for usage with Prometheus. A counter allows users to track the rate of the heartbeat, and integrates with the exporter better. A crashing or down scheduler will no longer emit the metric, but the statsd_exporter will continue to show a 1 for the metric value. This fixes that issue because a counter will continually change, and the lack of change indicates an issue with the scheduler. Add statsd change notice in UPDATING.md --- UPDATING.md | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ airflow/jobs.py | 2 +- 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/UPDATING.md b/UPDATING.md index 125a60ab66fb1..f1c3e9e8a62d7 100644 --- a/UPDATING.md +++ b/UPDATING.md @@ -21,6 +21,68 @@ that he has permissions on. If a new role wants to access all the dags, the admi We also provide a new cli command(``sync_perm``) to allow admin to auto sync permissions. + +### min_file_parsing_loop_time config option temporarily disabled + +The scheduler.min_file_parsing_loop_time config option has been temporarily removed due to +some bugs. + +### new `sync_parallelism` config option in celery section + +The new `sync_parallelism` config option will control how many processes CeleryExecutor will use to +fetch celery task state in parallel. Default value is max(1, number of cores - 1) + +### CLI Changes + +The ability to manipulate users from the command line has been changed. 'airflow create_user' and 'airflow delete_user' and 'airflow list_users' has been grouped to a single command `airflow users` with optional flags `--create`, `--list` and `--delete`. + +Example Usage: + +To create a new user: +```bash +airflow users --create --username jondoe --lastname doe --firstname jon --email jdoe@apache.org --role Viewer --password test +``` + +To list users: +```bash +airflow users --list +``` + +To delete a user: +```bash +airflow users --delete --username jondoe +``` + +### StatsD Metrics + +The `scheduler_heartbeat` metric has been changed from a gauge to a counter. Each loop of the scheduler will increment the counter by 1. This provides a higher degree of visibility and allows for better integration with Prometheus using the [StatsD Exporter](https://github.com/prometheus/statsd_exporter). Scheduler upness can be determined by graphing and alerting using a rate. If the scheduler goes down, the rate will drop to 0. + +### Custom auth backends interface change + +We have updated the version of flask-login we depend upon, and as a result any +custom auth backends might need a small change: `is_active`, +`is_authenticated`, and `is_anonymous` should now be properties. What this means is if +previously you had this in your user class + + def is_active(self): + return self.active + +then you need to change it like this + + @property + def is_active(self): + return self.active + +## Airflow 1.10 + +Installation and upgrading requires setting `SLUGIFY_USES_TEXT_UNIDECODE=yes` in your environment or +`AIRFLOW_GPL_UNIDECODE=yes`. In case of the latter a GPL runtime dependency will be installed due to a +dependency (python-nvd3 -> python-slugify -> unidecode). + +### Replace DataProcHook.await calls to DataProcHook.wait + +The method name was changed to be compatible with the Python 3.7 async/await keywords + ### Setting UTF-8 as default mime_charset in email utils ### Add a configuration variable(default_dag_run_display_number) to control numbers of dag run for display diff --git a/airflow/jobs.py b/airflow/jobs.py index f2caeda137721..21d7c498a25b8 100644 --- a/airflow/jobs.py +++ b/airflow/jobs.py @@ -1892,7 +1892,7 @@ def process_file(self, file_path, pickle_dags=False, session=None): @provide_session def heartbeat_callback(self, session=None): - Stats.gauge('scheduler_heartbeat', 1, 1) + Stats.incr('scheduler_heartbeat', 1, 1) class BackfillJob(BaseJob):