ersalil commented on code in PR #68284:
URL: https://github.com/apache/airflow/pull/68284#discussion_r3384685456


##########
shared/observability/src/airflow_shared/observability/metrics/otel_logger.py:
##########
@@ -270,12 +270,16 @@ def gauge(
         if _skip_due_to_rate(rate):
             return
 
-        if back_compat_name and self.metrics_validator.test(back_compat_name):
+        if (
+            back_compat_name
+            and self.metrics_validator.test(back_compat_name)
+            and name_is_otel_safe(self.prefix, back_compat_name)
+        ):
             self.metrics_map.set_gauge_value(
                 full_name(prefix=self.prefix, name=back_compat_name), value, 
delta, tags
             )
 
-        if self.metrics_validator.test(stat):
+        if self.metrics_validator.test(stat) and 
name_is_otel_safe(self.prefix, stat):

Review Comment:
   Good point. That makes sense! Since it matches incr()'s current behaviour, 
I've kept this PR focused on the crash fix for now. The log-once dedupe sounds 
like a good follow-up — happy to pick it up separately, or here if you'd 
prefer. Let me know what works best.



-- 
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]

Reply via email to