code: func (a *HistoricalApi) processAggregationRequest(key core.HistoricalKey, request *restful.Request, response *restful.Response) {
  	start, end, err := getStartEndTimeHistorical(request)
  	if err != nil {
  		response.WriteError(http.StatusBadRequest, err)
  		return
  	}
  	bucketSize, err := getBucketSize(request)
  	if err != nil {
  		response.WriteError(http.StatusBadRequest, err)
  		return
  	}
  	aggregations, err := getAggregations(request)
  	if err != nil {
  		response.WriteError(http.StatusBadRequest, err)
  		return
  	}
  	labels, err := getLabels(request)
  	if err != nil {
  		response.WriteError(http.StatusBadRequest, err)
  		return
  	}
  
  	metricName := request.PathParameter("metric-name")
  	convertedMetricName := convertMetricName(metricName)
  	var metrics map[core.HistoricalKey][]core.TimestampedAggregationValue
  	if labels != nil {
  		metrics, err = a.historicalSource.GetLabeledAggregation(convertedMetricName, labels, aggregations, []core.HistoricalKey{key}, start, end, bucketSize)
  	} else {
  		metrics, err = a.historicalSource.GetAggregation(convertedMetricName, aggregations, []core.HistoricalKey{key}, start, end, bucketSize)
  	}
  	if err != nil {
  		response.WriteError(http.StatusInternalServerError, err)
  		return
  	}
  
  	converted := exportTimestampedAggregationValue(metrics[key])
  	response.WriteEntity(converted)
  }
docs: // processAggregationRequest retrieves one or more aggregations (across time) of a metric for the object specified at the given key.