Class InteractionCollector

java.lang.Object
com.vaadin.observability.micrometer.insights.InteractionCollector

public class InteractionCollector extends Object
Captures interesting client-to-server invocations as CapturedInteractions: failed ones (when error metrics are enabled) and ones slower than the UX budget (when request metrics are enabled).

Listens for the RPC invocation events on the service event bus, the same events RpcMetricsBinder uses for RPC spans: RpcInvocationFailedEvent delivers the exact "user action + exception" pair, timing between RpcInvocationStartedEvent and RpcInvocationEndedEvent gives the handling duration, and the events resolve the component the invocation targets. Works in production mode.

In development mode it additionally reads what is on the screen: the caption of the interacted component, and the values its view was holding, so that the replay of an insight names the button the reader is looking for and states what the failure needed to be set. Neither is collected in production, where the payload is meant to be forwarded and both would carry application text — see ComponentCaptions.

  • Field Details

    • UX_BUDGET_MS

      public static final long UX_BUDGET_MS
      Absolute per-interaction latency budget for good UX, in milliseconds. Beyond roughly one second a user loses the feeling of operating directly on the UI, so interactions over this budget are captured as interactions regardless of any historical baseline.
      See Also:
  • Constructor Details

    • InteractionCollector

      public InteractionCollector(RecentInteractions buffer, ObservabilitySettings settings, boolean developmentMode)
      Parameters:
      buffer - where captured interactions are retained
      settings - the kit's settings, for which interactions to capture and how much detail they may carry
      developmentMode - whether the application runs in development mode, which is where component captions and the state of the view are collected
  • Method Details

    • register

      public com.vaadin.flow.shared.Registration register(com.vaadin.flow.server.VaadinServiceEventBus eventBus)
      Subscribes to the RPC invocation events on the given bus.
      Parameters:
      eventBus - the service event bus to listen on
      Returns:
      a handle removing every subscription made here