shahar1 commented on code in PR #66979:
URL: https://github.com/apache/airflow/pull/66979#discussion_r3252996100
##########
shared/observability/src/airflow_shared/observability/metrics/datadog_logger.py:
##########
@@ -45,16 +45,20 @@ class SafeDogStatsdLogger:
def __init__(
self,
dogstatsd_client: DogStatsd,
- metrics_validator: ListValidator = PatternAllowListValidator(),
+ metrics_validator: ListValidator | None = None,
metrics_tags: bool = False,
- metric_tags_validator: ListValidator = PatternAllowListValidator(),
+ metric_tags_validator: ListValidator | None = None,
stat_name_handler: Callable[[str], str] | None = None,
statsd_influxdb_enabled: bool = False,
) -> None:
self.dogstatsd = dogstatsd_client
- self.metrics_validator = metrics_validator
+ self.metrics_validator = (
+ metrics_validator if metrics_validator is not None else
PatternAllowListValidator()
+ )
Review Comment:
I replaced tha patterns where possible, but please note that there are
occasions where 0 is a legitimate input - so I can't use it there. For example:
```python
self.cpus = CpuResource(cpus if cpus is not None else
conf.getint("operators", "default_cpus"))
self.ram = RamResource(ram if ram is not None else
conf.getint("operators", "default_ram"))
self.disk = DiskResource(disk if disk is not None else
conf.getint("operators", "default_disk"))
self.gpus = GpuResource(gpus if gpus is not None else
conf.getint("operators", "default_gpus"))
```
--
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]