Source:
<code>public void handle(ChannelHandlerContext ctx, FullHttpRequest request) { Tracker.getInstance().track(request); final Timer.Context timerContext = handlerTimer.time(); final String body = request.content().toString(Constants.DEFAULT_CHARSET); try { requestCount.inc(); MetricsCollection collection = new MetricsCollection(); AggregatedPayload payload = createPayload( body ); <START> long ingestTime = System.currentTimeMillis(); <END> if (payload.hasDelayedMetrics(ingestTime)) { Tracker.getInstance().trackDelayedAggregatedMetricsTenant(payload.getTenantId(), payload.getTimestamp(), payload.getDelayTime(ingestTime), payload.getAllMetricNames()); } List<String> errors = payload.getValidationErrors(); if ( errors.isEmpty() ) { collection.add( PreaggregateConversions.buildMetricsCollection( payload ) ); ListenableFuture<List<Boolean>> futures = processor.apply( collection ); List<Boolean> persisteds = futures.get( timeout.getValue(), timeout.getUnit() ); for ( Boolean persisted : persisteds ) { if ( !persisted ) { DefaultHandler.sendResponse( ctx, request, null, HttpResponseStatus.INTERNAL_SERVER_ERROR ); return; } } DefaultHandler.sendResponse( ctx, request, null, HttpResponseStatus.OK ); } else { DefaultHandler.sendResponse( ctx, request, HttpMetricsIngestionHandler.getResponseBody( errors ), HttpResponseStatus.BAD_REQUEST ); } } catch (JsonParseException ex) { log.debug(String.format("BAD JSON: %s", body)); log.error(ex.getMessage(), ex); DefaultHandler.sendResponse(ctx, request, ex.getMessage(), HttpResponseStatus.BAD_REQUEST); } catch (TimeoutException ex) { DefaultHandler.sendResponse(ctx, request, "Timed out persisting metrics", HttpResponseStatus.ACCEPTED); } catch (Exception ex) { log.debug(String.format("JSON request payload: %s", body)); log.error("Error saving data", ex); DefaultHandler.sendResponse(ctx, request, "Internal error saving data", HttpResponseStatus.INTERNAL_SERVER_ERROR); } finally { requestCount.dec(); timerContext.stop(); } }</code><technical_language>Do u Clock get current time</technical_language>

Target:
public void handle(ChannelHandlerContext ctx, FullHttpRequest request) { Tracker.getInstance().track(request); final Timer.Context timerContext = handlerTimer.time(); final String body = request.content().toString(Constants.DEFAULT_CHARSET); try { requestCount.inc(); MetricsCollection collection = new MetricsCollection(); AggregatedPayload payload = AggregatedPayload.create( body ); long ingestTime = clock.now().getMillis(); if (payload.hasDelayedMetrics(ingestTime)) { Tracker.getInstance().trackDelayedAggregatedMetricsTenant(payload.getTenantId(), payload.getTimestamp(), payload.getDelayTime(ingestTime), payload.getAllMetricNames()); payload.markDelayMetricsReceived(ingestTime); } List<String> errors = payload.getValidationErrors(); if ( errors.isEmpty() ) { collection.add( PreaggregateConversions.buildMetricsCollection( payload ) ); ListenableFuture<List<Boolean>> futures = processor.apply( collection ); List<Boolean> persisteds = futures.get( timeout.getValue(), timeout.getUnit() ); for ( Boolean persisted : persisteds ) { if ( !persisted ) { DefaultHandler.sendResponse( ctx, request, null, HttpResponseStatus.INTERNAL_SERVER_ERROR ); return; } } DefaultHandler.sendResponse( ctx, request, null, HttpResponseStatus.OK ); } else { DefaultHandler.sendResponse( ctx, request, HttpMetricsIngestionHandler.getResponseBody( errors ), HttpResponseStatus.BAD_REQUEST ); } } catch (JsonParseException ex) { log.debug(String.format("BAD JSON: %s", body)); log.error(ex.getMessage(), ex); DefaultHandler.sendResponse(ctx, request, ex.getMessage(), HttpResponseStatus.BAD_REQUEST); } catch (TimeoutException ex) { DefaultHandler.sendResponse(ctx, request, "Timed out persisting metrics", HttpResponseStatus.ACCEPTED); } catch (Exception ex) { log.debug(String.format("JSON request payload: %s", body)); log.error("Error saving data", ex); DefaultHandler.sendResponse(ctx, request, "Internal error saving data", HttpResponseStatus.INTERNAL_SERVER_ERROR); } finally { requestCount.dec(); timerContext.stop(); } }