@POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/metrics") @Description("Submits externally collected metric data.") public Map<String,Object> submitMetrics(@Context HttpServletRequest req,final List<MetricDto> metricDtos){
  PrincipalUser remoteUser=getRemoteUser(req);
  SystemAssert.requireArgument(metricDtos != null,"Cannot submit null timeseries metrics list.");
  List<Metric> legalMetrics=new ArrayList<>();
  List<MetricDto> illegalMetrics=new ArrayList<>();
  List<String> errorMessages=new ArrayList<>();
  for (  MetricDto metricDto : metricDtos) {
    try {
      Metric metric=new Metric(metricDto.getScope(),metricDto.getMetric());
      copyProperties(metric,metricDto);
      legalMetrics.add(metric);
    }
 catch (    Exception e) {
      illegalMetrics.add(metricDto);
      errorMessages.add(e.getMessage());
    }
  }
  _collectionService.submitMetrics(remoteUser,legalMetrics);
  Map<String,Object> result=new HashMap<>();
  result.put("Success",legalMetrics.size() + " metrics");
  result.put("Error",illegalMetrics.size() + " metrics");
  result.put("Error Messages",errorMessages);
  return result;
}

@ POST @ Consumes ( MediaType . APPLICATION_JSON ) @ Produces ( MediaType . APPLICATION_JSON ) @ Path ( "/metrics" ) @ Description ( "Submits externally collected metric data." ) public Map < String , Object > submitMetrics ( @ Context HttpServletRequest req , final List < MetricDto > metricDtos ) { PrincipalUser remoteUser = getRemoteUser ( req ) ; SystemAssert . requireArgument ( metricDtos != null , "Cannot submit null timeseries metrics list." ) ; List < Metric > legalMetrics = new ArrayList < > ( ) ; List < MetricDto > illegalMetrics = new ArrayList < > ( ) ; List < String > errorMessages = new ArrayList < > ( ) ; for ( MetricDto metricDto : metricDtos ) { try { Metric metric = new Metric ( metricDto . getScope ( ) , metricDto . getMetric ( ) ) ; copyProperties ( metric , metricDto ) ; legalMetrics . add ( metric ) ; } catch ( Exception e ) { illegalMetrics . add ( metricDto ) ; errorMessages . add ( e . getMessage ( ) ) ; } } _collectionService . submitMetrics ( remoteUser , legalMetrics ) ; Map < String , Object > result = new HashMap < > ( ) ; result . put ( "Success" , legalMetrics . size ( ) + " metrics" ) ; result . put ( "Error" , illegalMetrics . size ( ) + " metrics" ) ; result . put ( "Error Messages" , errorMessages ) ; return result ; }
submits externally collected metric data .
