/** * Returns message's qualifier. * * @return qualifier string */ public String qualifier() { return header(HEADER_QUALIFIER); }
/** * Returns data format of the message data. * * @return data format of the data */ public String dataFormat() { return header(HEADER_DATA_FORMAT); }
private void enrichResponse(HttpServerResponse httpResponse, ServiceMessage response) { Optional.ofNullable(response.header(CLIENT_SEND_TIME)) .ifPresent(value -> httpResponse.header(CLIENT_SEND_TIME, value)); Optional.ofNullable(response.header(CLIENT_RECV_TIME)) .ifPresent(value -> httpResponse.header(CLIENT_RECV_TIME, value)); Optional.ofNullable(response.header(SERVICE_RECV_TIME)) .ifPresent(value -> httpResponse.header(SERVICE_RECV_TIME, value)); Optional.ofNullable(response.header(SERVICE_SEND_TIME)) .ifPresent(value -> httpResponse.header(SERVICE_SEND_TIME, value)); } }
private void enrichResponse(HttpServerResponse httpResponse, ServiceMessage response) { Optional.ofNullable(response.header(CLIENT_SEND_TIME)) .ifPresent(value -> httpResponse.header(CLIENT_SEND_TIME, value)); Optional.ofNullable(response.header(CLIENT_RECV_TIME)) .ifPresent(value -> httpResponse.header(CLIENT_RECV_TIME, value)); Optional.ofNullable(response.header(SERVICE_RECV_TIME)) .ifPresent(value -> httpResponse.header(SERVICE_RECV_TIME, value)); Optional.ofNullable(response.header(SERVICE_SEND_TIME)) .ifPresent(value -> httpResponse.header(SERVICE_SEND_TIME, value)); } }
/** * Calculates latencies by the headers into received message. * * @param message client message */ public void calculate(ServiceMessage message) { // client to service eval( message.header(SERVICE_RECV_TIME), message.header(CLIENT_SEND_TIME), (v1, v2) -> clientToServiceTimer.update(v1 - v2, TimeUnit.MILLISECONDS)); // service to client eval( message.header(CLIENT_RECV_TIME), message.header(SERVICE_SEND_TIME), (v1, v2) -> serviceToClientTimer.update(v1 - v2, TimeUnit.MILLISECONDS)); }