ferruzzi commented on code in PR #31859:
URL: https://github.com/apache/airflow/pull/31859#discussion_r1228953001


##########
airflow/metrics/otel_logger.py:
##########
@@ -233,27 +255,32 @@ def gauge(
         if self.metrics_validator.test(stat):
             self.metrics_map.set_gauge_value(full_name(prefix=self.prefix, 
name=stat), value, delta, tags)
 
-    @validate_stat
     def timing(
         self,
         stat: str,
         dt: DeltaType,
         *,
         tags: Attributes = None,
     ) -> None:
-        warnings.warn(f"Create timer {stat}: OpenTelemetry Timers are not yet 
implemented.")
+        """
+        OpenTelemetry does not have a native timer, we will store
+        them as a Gauge whose value represents the seconds elapsed.
+        """
+        if self.metrics_validator.test(stat) and 
name_is_otel_safe(self.prefix, stat):
+            if isinstance(dt, datetime.timedelta):
+                dt = dt.total_seconds()
+            self.metrics_map.set_gauge_value(full_name(prefix=self.prefix, 
name=stat), float(dt), False, tags)
         return None

Review Comment:
   🤦



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