Package io.vertx.core.spi.metrics

## Interface ClientMetrics<M,​Req,​Resp>

- All Superinterfaces:
    `Metrics`

      public interface ClientMetrics<M,​Req,​Resp>
      extends Metrics

  The client metrics SPI that Vert.x will use to call when client events occur.

  Author:
    Julien Viet

- - ### Field Summary

    - ### Fields inherited from interface io.vertx.core.spi.metrics.Metrics

      `METRICS_ENABLED`

  - ### Method Summary

    All Methods Instance Methods Default Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `default M` | `requestBegin​(String uri, Req request)` | Called when a client request begins.
    `default void` | `requestEnd​(M requestMetric)` | Calls `requestEnd(Object, long)` with `-1L`
    `default void` | `requestEnd​(M requestMetric, long bytesWritten)` | Called when the client request ends.
    `default void` | `requestReset​(M requestMetric)` | Called when the client request couldn't complete successfully, for instance the connection was closed before the response was received.
    `default void` | `responseBegin​(M requestMetric, Resp response)` | Called when the client response begins.
    `default void` | `responseEnd​(M requestMetric)` | Calls `responseEnd(Object, long)` with `-1L`
    `default void` | `responseEnd​(M requestMetric, long bytesRead)` | Called when the client response has ended

    - ### Methods inherited from interface io.vertx.core.spi.metrics.Metrics

      `close`

- - ### Method Detail

    - #### requestBegin

          default M requestBegin​(String uri,
                                 Req request)

      Called when a client request begins. Vert.x will invoke `requestEnd(M)` when the request has ended or `requestReset(M)` if the request/response has failed before.

      The request uri is an arbitrary URI that depends on the client, e.g an HTTP request uri, a SQL query, etc...

      Parameters:
        `uri` - an arbitrary uri
        `request` - the request object
      Returns:
        the request metric

    - #### requestEnd

          default void requestEnd​(M requestMetric)

      Calls `requestEnd(Object, long)` with `-1L`

    - #### requestEnd

          default void requestEnd​(M requestMetric,
                                  long bytesWritten)

      Called when the client request ends.
      Parameters:
        `requestMetric` - the request metric
        `bytesWritten` - the number of bytes written or `-1` when it is not known

    - #### responseBegin

          default void responseBegin​(M requestMetric,
                                     Resp response)

      Called when the client response begins. Vert.x will invoke `responseEnd(M)` when the response has ended or `requestReset(M)` if the request/response has failed before.
      Parameters:
        `requestMetric` - the request metric
        `response` - the response object

    - #### requestReset

          default void requestReset​(M requestMetric)

      Called when the client request couldn't complete successfully, for instance the connection was closed before the response was received.
      Parameters:
        `requestMetric` - the request metric

    - #### responseEnd

          default void responseEnd​(M requestMetric)

      Calls `responseEnd(Object, long)` with `-1L`

    - #### responseEnd

          default void responseEnd​(M requestMetric,
                                   long bytesRead)

      Called when the client response has ended
      Parameters:
        `requestMetric` - the request metric
        `bytesRead` - the number of bytes read or `-1` when it is not known