Class NetworkMetrics

  • All Implemented Interfaces:
    io.vertx.core.spi.metrics.Metrics, io.vertx.core.spi.metrics.NetworkMetrics<io.micrometer.core.instrument.LongTaskTimer.Sample>, io.vertx.core.spi.metrics.TCPMetrics<io.micrometer.core.instrument.LongTaskTimer.Sample>
    Direct Known Subclasses:
    VertxTcpClientMetrics, VertxTcpServerMetrics

    public class NetworkMetrics
    extends Object
    implements io.vertx.core.spi.metrics.TCPMetrics<io.micrometer.core.instrument.LongTaskTimer.Sample>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) String exception  
      (package private) io.micrometer.core.instrument.DistributionSummary received  
      (package private) io.micrometer.core.instrument.MeterRegistry registry  
      (package private) io.micrometer.core.instrument.DistributionSummary sent  
      (package private) io.micrometer.core.instrument.Tags tags  
      • Fields inherited from interface io.vertx.core.spi.metrics.Metrics

        DISABLE_METRICS_PROPERTY_NAME, METRICS_ENABLED
    • Constructor Summary

      Constructors 
      Constructor Description
      NetworkMetrics​(io.micrometer.core.instrument.MeterRegistry registry, io.micrometer.core.instrument.Tags tags, String prefix, String receivedDesc, String sentDesc, String connDurationDesc)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void bytesRead​(io.micrometer.core.instrument.LongTaskTimer.Sample sample, io.vertx.core.net.SocketAddress remoteAddress, long numberOfBytes)
      Called when bytes have been read
      void bytesWritten​(io.micrometer.core.instrument.LongTaskTimer.Sample sample, io.vertx.core.net.SocketAddress remoteAddress, long numberOfBytes)
      Called when bytes have been written
      io.micrometer.core.instrument.LongTaskTimer.Sample connected​(io.vertx.core.net.SocketAddress remoteAddress, String remoteName)
      Called when a client has connected, which is applicable for TCP connections.
      void disconnected​(io.micrometer.core.instrument.LongTaskTimer.Sample sample, io.vertx.core.net.SocketAddress remoteAddress)
      Called when a client has disconnected, which is applicable for TCP connections.
      void exceptionOccurred​(io.micrometer.core.instrument.LongTaskTimer.Sample sample, io.vertx.core.net.SocketAddress remoteAddress, Throwable t)
      Called when exceptions occur for a specific connection.
      static String toString​(io.vertx.core.net.SocketAddress remoteAddress)  
      • Methods inherited from interface io.vertx.core.spi.metrics.Metrics

        close
    • Field Detail

      • registry

        final io.micrometer.core.instrument.MeterRegistry registry
      • received

        final io.micrometer.core.instrument.DistributionSummary received
      • sent

        final io.micrometer.core.instrument.DistributionSummary sent
      • exception

        final String exception
      • tags

        final io.micrometer.core.instrument.Tags tags
    • Constructor Detail

      • NetworkMetrics

        public NetworkMetrics​(io.micrometer.core.instrument.MeterRegistry registry,
                              io.micrometer.core.instrument.Tags tags,
                              String prefix,
                              String receivedDesc,
                              String sentDesc,
                              String connDurationDesc)
    • Method Detail

      • connected

        public io.micrometer.core.instrument.LongTaskTimer.Sample connected​(io.vertx.core.net.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.

        Specified by:
        connected in interface io.vertx.core.spi.metrics.TCPMetrics<io.micrometer.core.instrument.LongTaskTimer.Sample>
        Parameters:
        remoteAddress - the remote address of the client
        remoteName - the remote name of the client
        Returns:
        the sample
      • disconnected

        public void disconnected​(io.micrometer.core.instrument.LongTaskTimer.Sample sample,
                                 io.vertx.core.net.SocketAddress remoteAddress)
        Called when a client has disconnected, which is applicable for TCP connections.
        Specified by:
        disconnected in interface io.vertx.core.spi.metrics.TCPMetrics<io.micrometer.core.instrument.LongTaskTimer.Sample>
        Parameters:
        sample - the sample
        remoteAddress - the remote address of the client
      • bytesRead

        public void bytesRead​(io.micrometer.core.instrument.LongTaskTimer.Sample sample,
                              io.vertx.core.net.SocketAddress remoteAddress,
                              long numberOfBytes)
        Called when bytes have been read
        Specified by:
        bytesRead in interface io.vertx.core.spi.metrics.NetworkMetrics<io.micrometer.core.instrument.LongTaskTimer.Sample>
        Parameters:
        sample - the sample, null for UDP
        remoteAddress - the remote address which this socket received bytes from
        numberOfBytes - the number of bytes read
      • bytesWritten

        public void bytesWritten​(io.micrometer.core.instrument.LongTaskTimer.Sample sample,
                                 io.vertx.core.net.SocketAddress remoteAddress,
                                 long numberOfBytes)
        Called when bytes have been written
        Specified by:
        bytesWritten in interface io.vertx.core.spi.metrics.NetworkMetrics<io.micrometer.core.instrument.LongTaskTimer.Sample>
        Parameters:
        sample - the sample
        remoteAddress - the remote address which bytes are being written to
        numberOfBytes - the number of bytes written
      • exceptionOccurred

        public void exceptionOccurred​(io.micrometer.core.instrument.LongTaskTimer.Sample sample,
                                      io.vertx.core.net.SocketAddress remoteAddress,
                                      Throwable t)
        Called when exceptions occur for a specific connection.
        Specified by:
        exceptionOccurred in interface io.vertx.core.spi.metrics.NetworkMetrics<io.micrometer.core.instrument.LongTaskTimer.Sample>
        Parameters:
        sample - the sample
        remoteAddress - the remote address of the connection or null if it's datagram/udp
        t - the exception that occurred
      • toString

        public static String toString​(io.vertx.core.net.SocketAddress remoteAddress)