Interface HttpServerMetrics<R,W>

All Superinterfaces:
Metrics, WebSocketMetrics<W>

public interface HttpServerMetrics<R,W> extends WebSocketMetrics<W>
The http server metrics SPI that Vert.x will use to call when each http server event occurs.

The thread model for the http server metrics depends on the actual context thats started the server.

Event loop context

Unless specified otherwise, all the methods on this object including the methods inherited from the super interfaces are invoked with the thread of the http server and therefore are the same than the VertxMetrics createMetrics method that created and returned this metrics object.

Worker context

Unless specified otherwise, all the methods on this object including the methods inherited from the super interfaces are invoked with a worker thread.
Author:
Nick Scavelli
  • Field Summary

    Fields inherited from interface Metrics

    METRICS_ENABLED
  • Method Summary

    Modifier and Type
    Method
    Description
    default W
    Called when a server web socket connects.
    default void
    disconnected(W webSocketMetric)
    Called when the server web socket has disconnected.
    default R
    requestBegin(SocketAddress remoteAddress, HttpRequest request)
    Called when an http server request begins.
    default void
    requestEnd(R requestMetric, HttpRequest request, long bytesRead)
    Called when an http server request has ended.
    default void
    requestReset(R requestMetric)
    Called when the http server request couldn't complete successfully, for instance the connection was closed before the response was sent.
    default void
    requestRouted(R requestMetric, String route)
    Called when a routing layer indicates a request has been routed.
    default void
    requestUpgraded(R requestMetrics)
    Called when an http server request is upgraded, e.g. a WebSocket
    default void
    responseBegin(R requestMetric, HttpResponse response)
    Called when an http server response begins.
    default void
    responseEnd(R requestMetric, HttpResponse response, long bytesWritten)
    Called when an http server response has ended.
    default R
    responsePushed(SocketAddress remoteAddress, HttpMethod method, String uri, HttpResponse response)
    Called when an http server response is pushed.

    Methods inherited from interface Metrics

    close
  • Method Details

    • requestBegin

      default R requestBegin(SocketAddress remoteAddress, HttpRequest request)
      Called when an http server request begins. Vert.x will invoke responseEnd(R, HttpResponse, long) when the response has ended or requestReset(R) if the request/response has failed before.
      Parameters:
      remoteAddress - the client remote address
      request - the http server request
      Returns:
      the request metric
    • requestEnd

      default void requestEnd(R requestMetric, HttpRequest request, long bytesRead)
      Called when an http server request has ended.
      Parameters:
      requestMetric - the request metric
      request - the same HttpRequest provided in the initial response callback
      bytesRead - the total number of bytes read
    • requestReset

      default void requestReset(R requestMetric)
      Called when the http server request couldn't complete successfully, for instance the connection was closed before the response was sent.
      Parameters:
      requestMetric - the request metric
    • requestUpgraded

      default void requestUpgraded(R requestMetrics)
      Called when an http server request is upgraded, e.g. a WebSocket
      Parameters:
      requestMetrics - the request metric
    • responseBegin

      default void responseBegin(R requestMetric, HttpResponse response)
      Called when an http server response begins.
      Parameters:
      requestMetric - the request metric
      response - the http server request
    • responsePushed

      default R responsePushed(SocketAddress remoteAddress, HttpMethod method, String uri, HttpResponse response)
      Called when an http server response is pushed.
      Parameters:
      remoteAddress - the client remote address
      method - the pushed response method
      uri - the pushed response uri
      response - the http server response @return the request metric
    • responseEnd

      default void responseEnd(R requestMetric, HttpResponse response, long bytesWritten)
      Called when an http server response has ended.
      Parameters:
      requestMetric - the request metric
      response - the same HttpResponse provided in the initial response callback
      bytesWritten - the total number of bytes written
    • connected

      default W connected(HttpRequest request)
      Called when a server web socket connects.
      Specified by:
      connected in interface WebSocketMetrics<R>
      Parameters:
      request - the observable request
      Returns:
      the server web socket metric
    • disconnected

      default void disconnected(W webSocketMetric)
      Called when the server web socket has disconnected.
      Specified by:
      disconnected in interface WebSocketMetrics<R>
      Parameters:
      webSocketMetric - the server web socket metric
    • requestRouted

      default void requestRouted(R requestMetric, String route)
      Called when a routing layer indicates a request has been routed.
      Parameters:
      requestMetric - the request metric
      route - the route the request has been routed to