code: public void send(final List<MetricAggregate> aggregates) throws IOException, HttpException {
  		
  		HttpClient httpClient = new HttpClient(apiConfig);
  		
  		// retransmit any metrics on the resend queue
  		
  		resendQueue.drain(httpClient, "/Metrics/SubmitMetricsByID");
  		
  		// build the json objects
  		
  		List<JsonMetric> metrics = new ArrayList<JsonMetric>(aggregates.size());
  		
  		for (MetricAggregate aggregate : aggregates) {
  			
  			Integer monitorId = monitorService.getMonitorId(aggregate.getIdentity());
  			
  			if (monitorId != null) {
  				JsonMetric.Builder builder = JsonMetric.newBuilder();
  				builder.monitorId(monitorId);
  				builder.value(Double.valueOf(aggregate.getValue()));
  				builder.count(Integer.valueOf(aggregate.getCount()));
  				builder.occurredUtc(new Date(aggregate.getOccurredMillis()));
  				builder.monitorTypeId(Integer.valueOf(aggregate.getIdentity().getType().getId()));
  				builder.clientDeviceId(monitorService.getDeviceId());
  				
  				metrics.add(builder.build());
  			} else {
  				LOGGER.info("Unable to determine monitor id for aggregate metric {}", aggregate);
  			}
  		}
  		
  		if (metrics.isEmpty()) {
  			return;
  		}
  		
  		// post metrics to stackify
  		
  		byte[] jsonBytes = objectMapper.writer().writeValueAsBytes(metrics);
  		
  		try {
  			httpClient.post("/Metrics/SubmitMetricsByID", jsonBytes);
  		} catch (IOException t) {
  			LOGGER.info("Queueing metrics for retransmission due to IOException");
  			resendQueue.offer(jsonBytes, t);
  			throw t;			
  		} catch (HttpException t) {
  			LOGGER.info("Queueing metrics for retransmission due to HttpException");
  			resendQueue.offer(jsonBytes, t);
  			throw t;
  		}
  	}
docs: Sends aggregate metrics to Stackify
  @param aggregates The aggregate metrics
  @throws IOException
  @throws HttpException