A (wrapped) werkzeug handler for serving numerics alert report.

    Accepts GET requests and responds with an array of JSON-ified
    NumericsAlertReportRow.

    Each JSON-ified NumericsAlertReportRow object has the following format:
    {
        'device_name': string,
        'tensor_name': string,
        'first_timestamp': float,
        'nan_event_count': int,
        'neg_inf_event_count': int,
        'pos_inf_event_count': int
    }

    These objects are sorted by ascending order of first_timestamp in the
    response array.

    Args:
      request: The request, currently assumed to be empty.

    Returns:
      A werkzeug BaseResponse object.

def _serve_numerics_alert_report_handler(self, request):
    """A (wrapped) werkzeug handler for serving numerics alert report.

    Accepts GET requests and responds with an array of JSON-ified
    NumericsAlertReportRow.

    Each JSON-ified NumericsAlertReportRow object has the following format:
    {
        'device_name': string,
        'tensor_name': string,
        'first_timestamp': float,
        'nan_event_count': int,
        'neg_inf_event_count': int,
        'pos_inf_event_count': int
    }

    These objects are sorted by ascending order of first_timestamp in the
    response array.

    Args:
      request: The request, currently assumed to be empty.

    Returns:
      A werkzeug BaseResponse object.
    """
    if request.method != 'GET':
      logger.error(
          '%s requests are forbidden by the debugger plugin.', request.method)
      return wrappers.Response(status=405)

    report = self._debugger_data_server.numerics_alert_report()

    # Convert the named tuples to dictionaries so we JSON them into objects.
    response = [r._asdict() for r in report]  # pylint: disable=protected-access
    return http_util.Respond(request, response, 'application/json')