mjpieters commented on a change in pull request #12308:
URL: https://github.com/apache/airflow/pull/12308#discussion_r522855476



##########
File path: airflow/plugins_manager.py
##########
@@ -262,6 +263,8 @@ def ensure_plugins_loaded():
 
     log.debug("Loading plugins")
 
+    start = time.monotonic()

Review comment:
       Might there be a usecase for a general timing context manager here?
   
   ```python
   with timer() as t:
       # ...
   
   log.info("Frobbing the foonars took %.2f seconds", t.elapsed.total_seconds())
   ```
   
   Encapsulation makes it easier to make sure everyone gets this right (using 
`time.monotonic()`!), and might make it easier to automatically export metrics 
to statd / prometheus if desired (`with timer(metric="metric_name") as t:`).
   




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to