hussein-awala commented on code in PR #70517:
URL: https://github.com/apache/airflow/pull/70517#discussion_r3842361226
##########
airflow-core/src/airflow/observability/metrics/datadog_logger.py:
##########
@@ -30,6 +30,7 @@ def get_dogstatsd_logger() -> SafeDogStatsdLogger:
tags_in_string=conf.get("metrics", "statsd_datadog_tags"),
host=conf.get("metrics", "statsd_host"),
port=conf.getint("metrics", "statsd_port"),
Review Comment:
should we add a fallback here since they are optional now (when
`statsd_socket_path` is not None)? same for task-sdk
##########
airflow-core/newsfragments/70517.feature.rst:
##########
Review Comment:
Could you remove this please? it's reserved for significant changes, this PR
introduces a new feature.
##########
airflow-core/src/airflow/observability/metrics/statsd_logger.py:
##########
@@ -23,40 +23,48 @@
from airflow._shared.observability.metrics import statsd_logger
from airflow.configuration import conf
+log = logging.getLogger(__name__)
+
if TYPE_CHECKING:
from airflow._shared.observability.metrics.statsd_logger import
SafeStatsdLogger
-log = logging.getLogger(__name__)
-
def get_statsd_logger() -> SafeStatsdLogger:
- stats_class = conf.getimport("metrics", "statsd_custom_client_path",
fallback=None)
+ # Local import to avoid requiring statsd when other backends are used
(e.g. Datadog)
+ from statsd import StatsClient, UnixSocketStatsClient
- # no need to check for the scheduler/statsd_on -> this method is only
called when it is set
- # and previously it would crash with None is callable if it was called
without it.
- from statsd import StatsClient
+ socket_path = conf.get("metrics", "statsd_socket_path", fallback=None)
+ custom_class = conf.getimport("metrics", "statsd_custom_client_path",
fallback=None)
- if stats_class:
- if not issubclass(stats_class, StatsClient):
+ if custom_class is not None:
+ if socket_path is not None:
Review Comment:
I think this will not work as expected if someone deactivate the feature
using env vars: `AIRFLOW__METRICS__STATSD_SOCKET_PATH=""`, you can normalize
blank/whitespace-only values to None.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]