Class ClientStats

java.lang.Object
org.mqtt4j.hato.ClientStats

public final class ClientStats extends Object

What a client holds and has counted, as only the client can know it, collected at one point after MqttClient.stats() was called. The values of one snapshot agree with each other: each unfinished QoS 1 or QoS 2 exchange counts in exactly one of its stages, and the registrations add up to their total. The stages move when the client processes an event, such as the completion of a write. Values that other threads change are read right after: those of the send queue, of the operation capacity, and of deliveries and delivery lanes. They can already show a completed write, a handler that has returned, or an MqttDelivery.ack() that has been called before the client has processed it.

Counts described as lifetime counts cover the client's whole life and only grow. Durations are measured with the client's TimerScheduler. Maps contain every key of their enum, in its order, with zero for what never happened. A limit shown with a value is the one in force when the snapshot was taken; the client may change the internal ones in later versions.

  • Method Details

    • connection

      public ClientStats.Connection connection()
      Returns the connection's state and attempt numbers.
      Returns:
      the connection's state and attempt numbers
    • receiving

      public ClientStats.Receiving receiving()
      Returns the values of incoming publications, their deliveries, and their acknowledgement exchanges.
      Returns:
      the values of incoming publications, their deliveries, and their acknowledgement exchanges
    • sending

      public ClientStats.Sending sending()
      Returns the values of outgoing writes and publication exchanges.
      Returns:
      the values of outgoing writes and publication exchanges
    • subscribing

      public ClientStats.Subscribing subscribing()
      Returns the values of the subscription registrations and delivery lanes, in total.
      Returns:
      the values of the subscription registrations and delivery lanes, in total
    • subscriptions

      public List<ClientStats.SubscriptionStats> subscriptions()
      Returns the values of each subscription that the client holds, in no particular order. A subscription joins the list when its handle is returned, before the client processes its registration, and leaves it once its removal completes or it is closed; a handler that still runs then keeps its lane counted in ClientStats.Subscribing.lanes(). Every snapshot collects these values, so MqttClient.stats() takes time in proportion to the subscriptions held.
      Returns:
      the values of each subscription that the client holds, in no particular order
    • refusals

      public Map<CapacityLimit, Long> refusals()
      Returns lifetime counts of operations that the client refused for capacity, by the limit that refused them. The refused operations failed with MqttCapacityException.
      Returns:
      lifetime counts of operations that the client refused for capacity, by the limit that refused them
    • overloads

      public Map<ClientStats.OverloadCause, Long> overloads()
      Returns lifetime counts of connections that the client ended because it was overloaded, by cause. The ending of each such connection carries a MqttCapacityException.
      Returns:
      lifetime counts of connections that the client ended because it was overloaded, by cause
    • droppedMetricEvents

      public long droppedMetricEvents()
      Returns a lifetime count of MetricsListener events dropped because the listener fell behind.
      Returns:
      a lifetime count of MetricsListener events dropped because the listener fell behind
    • equals

      public boolean equals(@Nullable Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object