code: private void handleGetMetricHistory(final HttpServletRequest req,
        final Map<String, Object> ret) throws ServletException {
      if (MetricReportManager.isAvailable()) {
        final MetricReportManager metricManager = MetricReportManager.getInstance();
        final InMemoryMetricEmitter memoryEmitter =
            extractInMemoryMetricEmitter(metricManager);
  
        // if we have a memory emitter
        if (memoryEmitter != null) {
          try {
            final List<InMemoryHistoryNode> result =
                memoryEmitter.getMetrics(
                    getParam(req, STATS_MAP_METRICNAMEPARAM),
                    parseDate(getParam(req, STATS_MAP_STARTDATE)),
                    parseDate(getParam(req, STATS_MAP_ENDDATE)),
                    getBooleanParam(req, STATS_MAP_METRICRETRIEVALMODE));
  
            if (result != null && result.size() > 0) {
              ret.put("data", result);
            } else {
              ret.put(RESPONSE_ERROR, "No metric stats available");
            }
  
          } catch (final ParseException ex) {
            ret.put(RESPONSE_ERROR, "Invalid Date filter");
          }
        } else {
          ret.put(RESPONSE_ERROR, "InMemoryMetricEmitter not instantiated");
        }
      } else {
        ret.put(RESPONSE_ERROR, "MetricReportManager is not available");
      }
    }
docs: Get metric snapshots for a metric and date specification