docs: def register_endpoint(self, path, app=None):
          """
          Register the metrics endpoint on the Flask application.
  
          :param path: the path of the endpoint
          :param app: the Flask application to register the endpoint on
              (by default it is the application registered with this class)
          """
  
          if is_running_from_reloader() and not os.environ.get('DEBUG_METRICS'):
              return
  
          if app is None:
              app = self.app or current_app
  
          @app.route(path)
          @self.do_not_track()
          def prometheus_metrics():
              # import these here so they don't clash with our own multiprocess module
              from prometheus_client import multiprocess, CollectorRegistry
  
              if 'prometheus_multiproc_dir' in os.environ:
                  registry = CollectorRegistry()
              else:
                  registry = self.registry
  
              if 'name[]' in request.args:
                  registry = registry.restricted_registry(request.args.getlist('name[]'))
  
              if 'prometheus_multiproc_dir' in os.environ:
                  multiprocess.MultiProcessCollector(registry)
  
              headers = {'Content-Type': CONTENT_TYPE_LATEST}
              return generate_latest(registry), 200, headers