Class AtmosphereMetrics

java.lang.Object
org.atmosphere.metrics.AtmosphereMetrics

public final class AtmosphereMetrics extends Object
Micrometer metrics integration for Atmosphere.

Registers gauges, counters and timers on an Atmosphere framework instance. Requires io.micrometer:micrometer-core on the classpath (optional dependency).

Usage


 MeterRegistry registry = new SimpleMeterRegistry();
 AtmosphereMetrics.install(framework, registry);
 

Metrics published

  • atmosphere.connections.active — gauge of active connections
  • atmosphere.connections.total — counter of all connections ever
  • atmosphere.connections.disconnects — counter of disconnects
  • atmosphere.broadcasters.active — gauge of active broadcasters
  • atmosphere.messages.broadcast — counter of messages broadcast
  • atmosphere.messages.delivered — counter of messages delivered to resources
  • atmosphere.broadcast.timer — timer of broadcast completion latency
  • atmosphere.rooms.active — gauge of active rooms
  • atmosphere.rooms.members — gauge of room members (tagged by room)
  • atmosphere.rooms.messages — counter of room messages (tagged by room)
  • atmosphere.cache.size — gauge of total cached messages
  • atmosphere.cache.evictions — counter of cache evictions
  • atmosphere.cache.hits — counter of cache hits
  • atmosphere.cache.misses — counter of cache misses
  • atmosphere.backpressure.drops — counter of backpressure drops
  • atmosphere.backpressure.disconnects — counter of backpressure disconnects
  • Method Details

    • install

      public static AtmosphereMetrics install(AtmosphereFramework framework, io.micrometer.core.instrument.MeterRegistry registry)
      Install metrics collection on the given framework.
      Parameters:
      framework - the Atmosphere framework instance
      registry - the Micrometer meter registry
      Returns:
      the metrics instance (for testing or manual removal)
    • instrumentRoom

      public void instrumentRoom(Room room)
      Install room-level presence and message metrics on a specific room.
      Parameters:
      room - the room to instrument
    • instrumentRoomManager

      public void instrumentRoomManager(RoomManager roomManager)
      Install room-level metrics for all rooms managed by a RoomManager. Also registers a gauge for the total active room count.
      Parameters:
      roomManager - the room manager to instrument
    • instrumentCache

      public void instrumentCache(UUIDBroadcasterCache cache)
      Install cache metrics on a UUIDBroadcasterCache instance.

      Registers:

      • atmosphere.cache.size — gauge of total cached messages
      • atmosphere.cache.evictions — counter of cache evictions
      • atmosphere.cache.hits — counter of cache hits
      • atmosphere.cache.misses — counter of cache misses
      Parameters:
      cache - the cache to instrument
    • instrumentBackpressure

      public void instrumentBackpressure(BackpressureInterceptor interceptor)
      Install backpressure metrics on a BackpressureInterceptor instance.

      Registers:

      • atmosphere.backpressure.drops — counter of dropped messages
      • atmosphere.backpressure.disconnects — counter of disconnected clients
      Parameters:
      interceptor - the backpressure interceptor to instrument