code: def timeit(
      event: str,
      report_time=False,
      report_in_progress=True,
      report_completed=True,
  ):
      def decorator(f):
          @functools.wraps(f)
          def wrapped_f(*args, **kwargs):
              progress_tracker = ray.get_actor(
                  constants.PROGRESS_TRACKER_ACTOR
              )
              progress_tracker.inc.remote(
                  f"{event}_in_progress", echo=report_in_progress
              )
              try:
                  start = time.time()
                  ret = f(*args, **kwargs)
                  end = time.time()
                  duration = end - start
                  progress_tracker.observe.remote(
                      f"{event}_time",
                      duration,
                      echo=report_time,
                  )
                  progress_tracker.inc.remote(
                      f"{event}_completed", echo=report_completed
                  )
                  return ret
              finally:
                  progress_tracker.dec.remote(f"{event}_in_progress")
  
          return wrapped_f
  
      return decorator
  
file_path: ray/python/ray/experimental/raysort/tracing_utils.py
imports: import datetime
  import functools
  import logging
  import time
  from typing import List, Tuple
  import ray
  from ray.experimental.raysort import constants, logging_utils
  from ray.util.metrics import Gauge, Histogram
label_desc: Use image node_id 1 for calling a global function with example usage: timeit(event, report_time, report_in_progress, report_completed) and returns: decorator, wrapped_f, ret