@Override
    public void postCall(HttpRequest request, HttpResponseStatus status, HandlerInfo handlerInfo) {
      HTTPMonitoringEvent httpMonitoringEvent =
          (HTTPMonitoringEvent) handlerInfo.getAttribute(MONITORING_EVENT);
      httpMonitoringEvent.setResponseTime(
          TimeUnit.NANOSECONDS.toMillis(
              System.nanoTime() - httpMonitoringEvent.getStartNanoTime()));
      httpMonitoringEvent.setResponseHttpStatusCode(status.code());

      Object[] meta =
          new Object[] {
            httpMonitoringEvent.getTimestamp(), SERVER_HOST_ADDRESS, SERVER_HOSTNAME, MICROSERVICE
          };
      Object[] payload = new Object[11];
      payload[0] = httpMonitoringEvent.getServiceClass();
      payload[1] = httpMonitoringEvent.getServiceName();
      payload[2] = httpMonitoringEvent.getServiceMethod();
      payload[3] = httpMonitoringEvent.getRequestUri();
      payload[4] = httpMonitoringEvent.getServiceContext();
      payload[5] = httpMonitoringEvent.getHttpMethod();
      payload[6] = httpMonitoringEvent.getContentType();
      payload[7] = httpMonitoringEvent.getRequestSizeBytes();
      payload[8] = httpMonitoringEvent.getReferrer();
      payload[9] = httpMonitoringEvent.getResponseHttpStatusCode();
      payload[10] = httpMonitoringEvent.getResponseTime();
      Event event =
          new Event(
              HTTP_MONITORING_STREAM_ID, httpMonitoringEvent.getTimestamp(), meta, null, payload);
      dataPublisher.publish(event);
    }
 @Override
 public void postCall(HttpRequest request, HttpResponseStatus status, HandlerInfo handlerInfo) {
   Method method = handlerInfo.getMethod();
   Interceptor interceptor = map.get(method);
   if (interceptor != null) {
     interceptor.postCall(request, status, handlerInfo);
   }
 }
    @Override
    public boolean preCall(HttpRequest request, HttpResponder responder, HandlerInfo handlerInfo) {
      HTTPMonitoringEvent httpMonitoringEvent = new HTTPMonitoringEvent();
      httpMonitoringEvent.setTimestamp(System.currentTimeMillis());
      httpMonitoringEvent.setStartNanoTime(System.nanoTime());
      if (serviceClass == null) {
        Method method = handlerInfo.getMethod();
        Class<?> serviceClass = method.getDeclaringClass();
        this.serviceClass = serviceClass.getName();
        serviceName = serviceClass.getSimpleName();
        serviceMethod = method.getName();
        if (serviceClass.isAnnotationPresent(Path.class)) {
          Path path = serviceClass.getAnnotation(Path.class);
          servicePath = path.value();
        }
      }
      httpMonitoringEvent.setServiceClass(serviceClass);
      httpMonitoringEvent.setServiceName(serviceName);
      httpMonitoringEvent.setServiceMethod(serviceMethod);
      httpMonitoringEvent.setRequestUri(request.getUri());
      httpMonitoringEvent.setServiceContext(servicePath);

      HttpHeaders httpHeaders = request.headers();

      httpMonitoringEvent.setHttpMethod(request.getMethod().name());
      httpMonitoringEvent.setContentType(httpHeaders.get(HttpHeaders.Names.CONTENT_TYPE));
      String contentLength = httpHeaders.get(HttpHeaders.Names.CONTENT_LENGTH);
      if (contentLength != null) {
        httpMonitoringEvent.setRequestSizeBytes(Long.parseLong(contentLength));
      }
      httpMonitoringEvent.setReferrer(httpHeaders.get(HttpHeaders.Names.REFERER));

      handlerInfo.setAttribute(MONITORING_EVENT, httpMonitoringEvent);

      return true;
    }
  @Override
  public boolean preCall(HttpRequest request, HttpResponder responder, HandlerInfo handlerInfo) {
    Method method = handlerInfo.getMethod();
    Interceptor interceptor = map.get(method);
    if (interceptor == null) {
      if (method.isAnnotationPresent(HTTPMonitoring.class)
          || method.getDeclaringClass().isAnnotationPresent(HTTPMonitoring.class)) {
        interceptor = new HTTPInterceptor();
        map.put(method, interceptor);
      }
    }

    if (interceptor != null) {
      interceptor.preCall(request, responder, handlerInfo);
    }

    return true;
  }