Skip to content

Observability

Atmosphere provides built-in support for Micrometer metrics, OpenTelemetry tracing, backpressure management, and cache configuration.

MeterRegistry registry = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);
AtmosphereMetrics metrics = AtmosphereMetrics.install(framework, registry);
metrics.instrumentRoomManager(roomManager);
MetricTypeDescription
atmosphere.connections.activeGaugeActive connections
atmosphere.broadcasters.activeGaugeActive broadcasters
atmosphere.connections.totalCounterTotal connections opened
atmosphere.messages.broadcastCounterMessages broadcast
atmosphere.broadcast.timerTimerBroadcast latency
atmosphere.rooms.activeGaugeActive rooms
atmosphere.rooms.membersGaugeMembers per room (tagged)

With the Spring Boot starter, metrics are auto-configured when micrometer-core and MeterRegistry are on the classpath.

framework.interceptor(new AtmosphereTracing(GlobalOpenTelemetry.get()));

Creates spans for every request with the following attributes:

AttributeDescription
atmosphere.resource.uuidResource UUID
atmosphere.transportTransport type (WEBSOCKET, SSE, LONG_POLLING)
atmosphere.actionAction result (CONTINUE, SUSPEND, RESUME)
atmosphere.broadcasterBroadcaster ID
atmosphere.roomRoom name (if applicable)

With the Spring Boot starter, tracing is auto-configured when an OpenTelemetry bean is present. Disable with atmosphere.tracing.enabled=false.

When atmosphere-mcp is on the classpath, McpTracing adds spans for tool, resource, and prompt invocations:

AttributeDescription
mcp.tool.nameTool/resource/prompt name
mcp.tool.type"tool", "resource", or "prompt"
mcp.tool.arg_countNumber of arguments
mcp.tool.errortrue if invocation failed
framework.interceptor(new BackpressureInterceptor());
ParameterDefaultDescription
org.atmosphere.backpressure.highWaterMark1000Max pending messages per client
org.atmosphere.backpressure.policydrop-oldestdrop-oldest, drop-newest, or disconnect
ParameterDefaultDescription
org.atmosphere.cache.UUIDBroadcasterCache.maxPerClient1000Max cached messages per client
org.atmosphere.cache.UUIDBroadcasterCache.messageTTL300Per-message TTL in seconds
org.atmosphere.cache.UUIDBroadcasterCache.maxTotal100000Global cache size limit