ArshiaZr commented on code in PR #43340:
URL: https://github.com/apache/airflow/pull/43340#discussion_r1859144934
##########
airflow/metrics/validators.py:
##########
@@ -157,26 +155,11 @@ def stat_name_otel_handler(
if not (isinstance(stat_name, str) and isinstance(stat_prefix, str)):
raise InvalidStatsNameException("Stat name and prefix must both be
strings.")
- if len(proposed_stat_name) > OTEL_NAME_MAX_LENGTH:
- # If the name is in the exceptions list, do not fail it for being too
long.
- # It may still be deemed invalid for other reasons below.
- for exemption in BACK_COMPAT_METRIC_NAMES:
- if re2.match(exemption, stat_name):
- # There is a back-compat exception for this name; proceed
- name_length_exemption = True
- matched_exemption = exemption.pattern
- break
- else:
- raise InvalidStatsNameException(
- f"Invalid stat name: {proposed_stat_name}. Please see "
-
f"https://opentelemetry.io/docs/reference/specification/metrics/api/#instrument-name-syntax"
- )
-
# `stat_name_default_handler` throws InvalidStatsNameException if the
# provided value is not valid or returns the value if it is. We don't
# need the return value but will make use of the validation checks. If
# no exception is thrown, then the proposed name meets OTel requirements.
- stat_name_default_handler(proposed_stat_name, max_length=999 if
name_length_exemption else max_length)
+ stat_name_default_handler(proposed_stat_name, max_length=999)
Review Comment:
yeah that's true. My bad
--
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]