vandonr-amz commented on code in PR #31725:
URL: https://github.com/apache/airflow/pull/31725#discussion_r1224792093


##########
airflow/metrics/otel_logger.py:
##########
@@ -83,10 +95,51 @@ def name_is_otel_safe(prefix: str, name: str) -> bool:
     return bool(stat_name_otel_handler(prefix, name, 
max_length=OTEL_NAME_MAX_LENGTH))
 
 
+def _type_as_str(obj: Instrument) -> str:
+    """
+    Given an OpenTelemetry Instrument, returns the type of the instrument as a 
string.
+
+    :param obj: An OTel Instrument or subclass
+    :returns: The type() of the Instrument without all the nested class info
+    """
+    # type() will return something like: <class 
'opentelemetry.sdk.metrics._internal.instrument._Counter'>
+    # This extracts that down to just "Counter" (or "Gauge", etc.) for cleaner 
logging purposes.

Review Comment:
   this is out of date with the new code :p
   the only thing of interest to mention now is that class names are prefixed 
by `_`, which is why the `[1:]` is necessary



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