Class RecentInteractions

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

public class RecentInteractions extends Object
Bounded in-memory ring buffer of captured interactions. Oldest entries are evicted first; memory use is hard-capped by capacity.
  • Field Details

    • DEFAULT_CAPACITY

      public static final int DEFAULT_CAPACITY
      Default hard cap on retained interactions.
      See Also:
  • Constructor Details

    • RecentInteractions

      public RecentInteractions(int capacity)
  • Method Details

    • add

      public void add(CapturedInteraction interaction)
    • snapshot

      public List<CapturedInteraction> snapshot()
      Returns a snapshot, newest first.
    • recordLatest

      public void recordLatest(int requestId, LatestInteraction interaction, boolean propertySync)
      Records the invocation that just ended as the latest interaction.

      One user action is often several invocations in one request - a text field's value sync ahead of the button click that submits it - so an invocation from the same request as the previous one is folded into it: the server time adds up, and a property sync does not replace the event the user actually triggered as the headline.

      Parameters:
      requestId - identifies the request the invocation arrived in
      interaction - the invocation, as a latest interaction of its own
      propertySync - whether the invocation was a property sync
    • latest

      public LatestInteraction latest()
      The latest interaction, or null when none has been recorded.
      Returns:
      the latest interaction, or null