This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 6a6bff3edf Rename statsd_allow_list and statsd_block_list to
metrics_*_list (#30174)
6a6bff3edf is described below
commit 6a6bff3edf16c9f2eec40cd0812fcdad3afcc201
Author: D. Ferruzzi <[email protected]>
AuthorDate: Tue Mar 21 05:06:36 2023 -0700
Rename statsd_allow_list and statsd_block_list to metrics_*_list (#30174)
* Rename statsd_allow_list and statsd_block_list to metrics_*_list
* Remove deprecated values from config
* Fix unit tests
---
airflow/config_templates/config.yml | 38 ++++++++++++++--------------
airflow/config_templates/default_airflow.cfg | 22 ++++++++--------
airflow/configuration.py | 2 ++
airflow/stats.py | 26 ++++++++++---------
tests/core/test_stats.py | 8 +++---
5 files changed, 50 insertions(+), 46 deletions(-)
diff --git a/airflow/config_templates/config.yml
b/airflow/config_templates/config.yml
index 7e1a3455a1..f06ab2c0cf 100644
--- a/airflow/config_templates/config.yml
+++ b/airflow/config_templates/config.yml
@@ -876,6 +876,25 @@ metrics:
description: |
StatsD (https://github.com/etsy/statsd) integration settings.
options:
+ metrics_allow_list:
+ description: |
+ If you want to avoid emitting all the available metrics, you can
configure an
+ allow list of prefixes (comma separated) to send only the metrics that
start
+ with the elements of the list (e.g: "scheduler,executor,dagrun")
+ version_added: 2.0.0
+ type: string
+ example: ~
+ default: ""
+ metrics_block_list:
+ description: |
+ If you want to avoid emitting all the available metrics, you can
configure a
+ block list of prefixes (comma separated) to filter out metrics that
start with
+ the elements of the list (e.g: "scheduler,executor,dagrun").
+ If metrics_allow_list and metrics_block_list are both configured,
metrics_block_list is ignored.
+ version_added: 2.6.0
+ type: string
+ example: ~
+ default: ""
statsd_on:
description: |
Enables sending metrics to StatsD.
@@ -901,25 +920,6 @@ metrics:
type: string
example: ~
default: "airflow"
- statsd_allow_list:
- description: |
- If you want to avoid sending all the available metrics to StatsD,
- you can configure an allow list of prefixes (comma separated) to send
only the metrics that
- start with the elements of the list (e.g: "scheduler,executor,dagrun")
- version_added: 2.0.0
- type: string
- example: ~
- default: ""
- statsd_block_list:
- description: |
- If you want to avoid sending all the available metrics to StatsD,
- you can configure a block list of prefixes (comma separated) to filter
out metrics that
- start with the elements of the list (e.g: "scheduler,executor,dagrun").
- If statsd_allow_list and statsd_block_list are both configured,
statsd_block_list is ignored
- version_added: 2.6.0
- type: string
- example: ~
- default: ""
stat_name_handler:
description: |
A function that validate the StatsD stat name, apply changes to the
stat name if necessary and return
diff --git a/airflow/config_templates/default_airflow.cfg
b/airflow/config_templates/default_airflow.cfg
index 5874028917..14ef880aa1 100644
--- a/airflow/config_templates/default_airflow.cfg
+++ b/airflow/config_templates/default_airflow.cfg
@@ -492,23 +492,23 @@ file_task_handler_new_file_permissions = 0o664
[metrics]
# StatsD (https://github.com/etsy/statsd) integration settings.
+# If you want to avoid emitting all the available metrics, you can configure an
+# allow list of prefixes (comma separated) to send only the metrics that start
+# with the elements of the list (e.g: "scheduler,executor,dagrun")
+metrics_allow_list =
+
+# If you want to avoid emitting all the available metrics, you can configure a
+# block list of prefixes (comma separated) to filter out metrics that start
with
+# the elements of the list (e.g: "scheduler,executor,dagrun").
+# If metrics_allow_list and metrics_block_list are both configured,
metrics_block_list is ignored.
+metrics_block_list =
+
# Enables sending metrics to StatsD.
statsd_on = False
statsd_host = localhost
statsd_port = 8125
statsd_prefix = airflow
-# If you want to avoid sending all the available metrics to StatsD,
-# you can configure an allow list of prefixes (comma separated) to send only
the metrics that
-# start with the elements of the list (e.g: "scheduler,executor,dagrun")
-statsd_allow_list =
-
-# If you want to avoid sending all the available metrics to StatsD,
-# you can configure a block list of prefixes (comma separated) to filter out
metrics that
-# start with the elements of the list (e.g: "scheduler,executor,dagrun").
-# If statsd_allow_list and statsd_block_list are both configured,
statsd_block_list is ignored
-statsd_block_list =
-
# A function that validate the StatsD stat name, apply changes to the stat
name if necessary and return
# the transformed stat name.
#
diff --git a/airflow/configuration.py b/airflow/configuration.py
index e5c9a1a6bc..b28d173fc1 100644
--- a/airflow/configuration.py
+++ b/airflow/configuration.py
@@ -199,6 +199,8 @@ class AirflowConfigParser(ConfigParser):
"2.0.0",
),
("logging", "task_log_reader"): ("core", "task_log_reader", "2.0.0"),
+ ("metrics", "metrics_allow_list"): ("metrics", "statsd_allow_list",
"2.5.3"),
+ ("metrics", "metrics_block_list"): ("metrics", "statsd_block_list",
"2.5.3"),
("metrics", "statsd_on"): ("scheduler", "statsd_on", "2.0.0"),
("metrics", "statsd_host"): ("scheduler", "statsd_host", "2.0.0"),
("metrics", "statsd_port"): ("scheduler", "statsd_port", "2.0.0"),
diff --git a/airflow/stats.py b/airflow/stats.py
index 3ed8c1f52c..39c79d6d5b 100644
--- a/airflow/stats.py
+++ b/airflow/stats.py
@@ -600,14 +600,15 @@ class _Stats(type):
port=conf.getint("metrics", "statsd_port"),
prefix=conf.get("metrics", "statsd_prefix"),
)
- if conf.get("metrics", "statsd_allow_list", fallback=None):
- metrics_validator = AllowListValidator(conf.get("metrics",
"statsd_allow_list"))
- if conf.get("metrics", "statsd_block_list", fallback=None):
+ if conf.get("metrics", "metrics_allow_list", fallback=None):
+ metrics_validator = AllowListValidator(conf.get("metrics",
"metrics_allow_list"))
+ if conf.get("metrics", "metrics_block_list", fallback=None):
log.warning(
- "Ignoring statsd_block_list as both statsd_allow_list and
statsd_block_list have been set"
+ "Ignoring metrics_block_list as both metrics_allow_list "
+ "and metrics_block_list have been set"
)
- elif conf.get("metrics", "statsd_block_list", fallback=None):
- metrics_validator = BlockListValidator(conf.get("metrics",
"statsd_block_list"))
+ elif conf.get("metrics", "metrics_block_list", fallback=None):
+ metrics_validator = BlockListValidator(conf.get("metrics",
"metrics_block_list"))
else:
metrics_validator = AllowListValidator()
influxdb_tags_enabled = conf.getboolean("metrics",
"statsd_influxdb_enabled", fallback=False)
@@ -627,14 +628,15 @@ class _Stats(type):
namespace=conf.get("metrics", "statsd_prefix"),
constant_tags=cls.get_constant_tags(),
)
- if conf.get("metrics", "statsd_allow_list", fallback=None):
- metrics_validator = AllowListValidator(conf.get("metrics",
"statsd_allow_list"))
- if conf.get("metrics", "statsd_block_list", fallback=None):
+ if conf.get("metrics", "metrics_allow_list", fallback=None):
+ metrics_validator = AllowListValidator(conf.get("metrics",
"metrics_allow_list"))
+ if conf.get("metrics", "metrics_block_list", fallback=None):
log.warning(
- "Ignoring statsd_block_list as both statsd_allow_list and
statsd_block_list have been set"
+ "Ignoring metrics_block_list as both metrics_allow_list "
+ "and metrics_block_list have been set"
)
- elif conf.get("metrics", "statsd_block_list", fallback=None):
- metrics_validator = BlockListValidator(conf.get("metrics",
"statsd_block_list"))
+ elif conf.get("metrics", "metrics_block_list", fallback=None):
+ metrics_validator = BlockListValidator(conf.get("metrics",
"metrics_block_list"))
else:
metrics_validator = AllowListValidator()
datadog_metrics_tags = conf.getboolean("metrics",
"statsd_datadog_metrics_tags", fallback=True)
diff --git a/tests/core/test_stats.py b/tests/core/test_stats.py
index 005133967f..9116721c1a 100644
--- a/tests/core/test_stats.py
+++ b/tests/core/test_stats.py
@@ -130,7 +130,7 @@ class TestStats:
with conf_vars(
{
("metrics", "statsd_on"): "True",
- ("metrics", "statsd_allow_list"): "name1,name2",
+ ("metrics", "metrics_allow_list"): "name1,name2",
}
):
importlib.reload(airflow.stats)
@@ -143,7 +143,7 @@ class TestStats:
with conf_vars(
{
("metrics", "statsd_on"): "True",
- ("metrics", "statsd_block_list"): "name1,name2",
+ ("metrics", "metrics_block_list"): "name1,name2",
}
):
importlib.reload(airflow.stats)
@@ -156,8 +156,8 @@ class TestStats:
with conf_vars(
{
("metrics", "statsd_on"): "True",
- ("metrics", "statsd_allow_list"): "name1,name2",
- ("metrics", "statsd_block_list"): "name1,name2",
+ ("metrics", "metrics_allow_list"): "name1,name2",
+ ("metrics", "metrics_block_list"): "name1,name2",
}
):
importlib.reload(airflow.stats)