Package io.vertx.core.spi.metrics

## Interface TCPMetrics<S>

- All Superinterfaces:
    `Metrics`, `NetworkMetrics<S>`
  All Known Subinterfaces:
    `HttpClientMetrics<R,​W,​S>`, `HttpServerMetrics<R,​W,​S>`

      public interface TCPMetrics<S>
      extends NetworkMetrics<S>

  An SPI used internally by Vert.x to gather metrics on a net socket which serves as a base class for things like HttpServer and HttpClient, all of which serve TCP connections.

  The thread model for the tcp metrics depends on the actual context thats created the client/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 client/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 io.vertx.core.spi.metrics.Metrics

      `METRICS_ENABLED`

  - ### Method Summary

    All Methods Instance Methods Default Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `default S` | `connected​(SocketAddress remoteAddress, String remoteName)` | Called when a client has connected, which is applicable for TCP connections.
    `default void` | `disconnected​(S socketMetric, SocketAddress remoteAddress)` | Called when a client has disconnected, which is applicable for TCP connections.

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

      `close`

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

      `bytesRead, bytesWritten, exceptionOccurred`

- - ### Method Detail

    - #### connected

          default S connected​(SocketAddress remoteAddress,
                              String remoteName)

      Called when a client has connected, which is applicable for TCP connections.

      The remote name of the client is a best effort to provide the name of the remote host, i.e if the name is specified at creation time, this name will be used otherwise it will be the remote address.
      Parameters:
        `remoteAddress` - the remote address of the client
        `remoteName` - the remote name of the client
      Returns:
        the socket metric

    - #### disconnected

          default void disconnected​(S socketMetric,
                                    SocketAddress remoteAddress)

      Called when a client has disconnected, which is applicable for TCP connections.
      Parameters:
        `socketMetric` - the socket metric
        `remoteAddress` - the remote address of the client