Class ConnectionStatistics

java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.io.ConnectionStatistics
All Implemented Interfaces:
EventListener, Connection.Listener, Dumpable, LifeCycle
Direct Known Subclasses:
IncludeExcludeConnectionStatistics

@ManagedObject("Tracks statistics on connections") public class ConnectionStatistics extends AbstractLifeCycle implements Connection.Listener, Dumpable

A Connection.Listener that tracks connection statistics.

Adding an instance of this class as a bean to a ServerConnector or ConnectionFactory (for the server) or to HttpClient (for the client) will trigger the tracking of the connection statistics for all connections managed by the server or by the client.

The statistics for a connection are gathered when the connection is closed.

ConnectionStatistics instances must be started to collect statistics, either as part of starting the whole component tree, or explicitly if the component tree has already been started.

  • Constructor Details Link icon

    • ConnectionStatistics Link icon

      public ConnectionStatistics()
  • Method Details Link icon

    • reset Link icon

      @ManagedOperation(value="Resets the statistics", impact="ACTION") public void reset()
    • doStart Link icon

      protected void doStart() throws Exception
      Description copied from class: AbstractLifeCycle
      Method to override to start the lifecycle
      Overrides:
      doStart in class AbstractLifeCycle
      Throws:
      Exception - If there was a problem starting. Will cause a transition to FAILED state
    • onOpened Link icon

      public void onOpened(Connection connection)
      Specified by:
      onOpened in interface Connection.Listener
    • onTotalOpened Link icon

      protected void onTotalOpened(Connection connection)
    • onConnectionOpened Link icon

      protected void onConnectionOpened(Connection connection)
    • onClosed Link icon

      public void onClosed(Connection connection)
      Specified by:
      onClosed in interface Connection.Listener
    • onTotalClosed Link icon

      protected void onTotalClosed(Connection connection)
    • onConnectionClosed Link icon

      protected void onConnectionClosed(Connection connection)
    • getReceivedBytes Link icon

      @ManagedAttribute("Total number of bytes received by tracked connections") public long getReceivedBytes()
    • getReceivedBytesRate Link icon

      @ManagedAttribute("Total number of bytes received per second since the last invocation of this method") public long getReceivedBytesRate()
    • getSentBytes Link icon

      @ManagedAttribute("Total number of bytes sent by tracked connections") public long getSentBytes()
    • getSentBytesRate Link icon

      @ManagedAttribute("Total number of bytes sent per second since the last invocation of this method") public long getSentBytesRate()
    • getConnectionDurationMax Link icon

      @ManagedAttribute("The max duration of a connection in ms") public long getConnectionDurationMax()
    • getConnectionDurationMean Link icon

      @ManagedAttribute("The mean duration of a connection in ms") public double getConnectionDurationMean()
    • getConnectionDurationStdDev Link icon

      @ManagedAttribute("The standard deviation of the duration of a connection") public double getConnectionDurationStdDev()
    • getConnectionsTotal Link icon

      @ManagedAttribute("The total number of connections opened") public long getConnectionsTotal()
    • getConnections Link icon

      @ManagedAttribute("The current number of open connections") public long getConnections()
    • getConnectionsMax Link icon

      @ManagedAttribute("The max number of open connections") public long getConnectionsMax()
    • getReceivedMessages Link icon

      @ManagedAttribute("The total number of messages received") public long getReceivedMessages()
    • getReceivedMessagesRate Link icon

      @ManagedAttribute("Total number of messages received per second since the last invocation of this method") public long getReceivedMessagesRate()
    • getSentMessages Link icon

      @ManagedAttribute("The total number of messages sent") public long getSentMessages()
    • getSentMessagesRate Link icon

      @ManagedAttribute("Total number of messages sent per second since the last invocation of this method") public long getSentMessagesRate()
    • getConnectionStatisticsGroups Link icon

      public Map<String,ConnectionStatistics.Stats> getConnectionStatisticsGroups()
    • dump Link icon

      public void dump(Appendable out, String indent) throws IOException
      Description copied from interface: Dumpable
      Dump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.
      Specified by:
      dump in interface Dumpable
      Parameters:
      out - The appendable to dump to
      indent - The indent to apply after any new lines.
      Throws:
      IOException - if unable to write to Appendable
    • toString Link icon

      public String toString()
      Overrides:
      toString in class AbstractLifeCycle