Class ComponentResolver

java.lang.Object
com.vaadin.observability.micrometer.ComponentResolver

public final class ComponentResolver extends Object
Resolves the Component an RPC invocation targets. Shared by the instrumentation that enriches spans and the insights collector that records interactions.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Optional<com.vaadin.flow.component.Component>
    resolveComponent(com.vaadin.flow.server.communication.AbstractRpcInvocationEvent event)
    Resolves the component the invocation targets, by looking up the target StateNode in the UI's state tree and walking up to the nearest enclosing component.
    resolveComponentType(com.vaadin.flow.server.communication.AbstractRpcInvocationEvent event)
    Resolves the class name of the component the invocation targets, by looking up the target StateNode in the UI's state tree and walking up to the nearest enclosing component.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • resolveComponentType

      public static Optional<String> resolveComponentType(com.vaadin.flow.server.communication.AbstractRpcInvocationEvent event)
      Resolves the class name of the component the invocation targets, by looking up the target StateNode in the UI's state tree and walking up to the nearest enclosing component. Returns Optional.empty() if the invocation does not target a node, the node is no longer attached, or no component can be resolved. Resolution is best-effort enrichment and never throws.
      Parameters:
      event - the RPC invocation to resolve the target component for
      Returns:
      the fully-qualified component class name, or empty
    • resolveComponent

      public static Optional<com.vaadin.flow.component.Component> resolveComponent(com.vaadin.flow.server.communication.AbstractRpcInvocationEvent event)
      Resolves the component the invocation targets, by looking up the target StateNode in the UI's state tree and walking up to the nearest enclosing component. Returns Optional.empty() if the invocation does not target a node, the node is no longer attached, or no component can be resolved. Resolution is best-effort enrichment and never throws.

      Callers that keep the returned instance must not keep it beyond the invocation being handled: it is a live component of a live UI, and holding it would pin the whole UI.

      Parameters:
      event - the RPC invocation to resolve the target component for
      Returns:
      the component, or empty