code: def statsd_gauge(
      metric_prefix: str | None = None,
  ) -> Callable[..., Any]:
      def decorate(f: Callable[..., Any]) -> Callable[..., Any]:
          """
          Handle sending statsd gauge metric from any method or function
          """
  
          def wrapped(*args: Any, **kwargs: Any) -> Any:
              metric_prefix_ = metric_prefix or f.__name__
              try:
                  result = f(*args, **kwargs)
                  current_app.config["STATS_LOGGER"].gauge(
                      f"{metric_prefix_}.ok", 1
                  )
                  return result
              except Exception as ex:
                  if (
                      hasattr(ex, "status")
                      and ex.status < 500  # pylint: disable=no-member
                  ):
                      current_app.config["STATS_LOGGER"].gauge(
                          f"{metric_prefix_}.warning", 1
                      )
                  else:
                      current_app.config["STATS_LOGGER"].gauge(
                          f"{metric_prefix_}.error", 1
                      )
                  raise ex
  
          return wrapped
  
      return decorate
  
file_path: superset/superset/utils/decorators.py
imports: from __future__ import annotations
  import logging
  import time
  from collections.abc import Iterator
  from contextlib import contextmanager
  from typing import Any, Callable, TYPE_CHECKING
  from uuid import UUID
  from flask import current_app, g, Response
  from superset.utils import core
  from superset.utils.dates import now_as_float
label_desc: Use image node_id 1 for calling a global function with example usage: statsd_gauge(metric_prefix) and returns: decorate, wrapped, result