aeroyorch commented on code in PR #69371:
URL: https://github.com/apache/airflow/pull/69371#discussion_r3552150635


##########
airflow-core/docs/administration-and-deployment/logging-monitoring/metrics.rst:
##########
@@ -181,6 +183,73 @@ to the stat name if necessary, and returns the transformed 
stat name. The functi
         return stat_name.lower()[:32]
 
 
+Custom Metrics
+--------------
+
+You can emit your own metrics from inside a task, plugin, or custom operator 
through
+the same stats client Airflow uses internally. In Airflow 3 the recommended 
import
+path is ``airflow.sdk.observability``:
+
+.. code-block:: python
+
+    from airflow.sdk.observability import stats
+
+    stats.incr("my_service.processed")
+    stats.decr("my_service.in_flight")
+    stats.gauge("my_service.queue_depth", 42)
+    stats.timing("my_service.batch_ms", 1234)
+
+    with stats.timer("my_service.batch"):
+        ...
+
+.. versionadded:: 3.3.0

Review Comment:
   check it now please



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