class_docstr: WSGI middleware to instrument Superset.
  
  To see the instrumentation for a given page, set `PROFILING=True`
  in the config, and append `?_instrument=1` to the page.
class_docstr_tok: ["WSGI","middleware","to","instrument","Superset",".","To","see","the","instrumentation","for","a","given","page",",","set","`","PROFILING=True","`","in","the","config",",","and","append","`","?","_instrument=1","`","to","the","page","."]
code: def __call__(self, request: Request) -> Response:
      if request.args.get("_instrument") != "1":
          return Response.from_app(self.app, request.environ)
  
      if Profiler is None:
          raise Exception(  # pylint: disable=broad-exception-raised
              "The module pyinstrument is not installed."
          )
  
      profiler = Profiler(interval=self.interval)
  
      # call original request
      fake_start_response = mock.MagicMock()
      with profiler:
          self.app(request.environ, fake_start_response)
  
      # return HTML profiling information
      return Response(profiler.output_html(), mimetype="text/html")
  
imports: from typing import Any, Callable
  from unittest import mock
  from werkzeug.wrappers import Request, Response
label_desc: Use image node_id 2 for calling the SupersetProfiler obj's underlying member method code with example usage: obj.__call__(request) and returns: Response, Response