Class ComponentResolver
java.lang.Object
com.vaadin.observability.micrometer.ComponentResolver
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 TypeMethodDescriptionstatic Optional<com.vaadin.flow.component.Component> resolveComponent(com.vaadin.flow.server.communication.AbstractRpcInvocationEvent event) Resolves the component the invocation targets, by looking up the targetStateNodein 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 targetStateNodein the UI's state tree and walking up to the nearest enclosing component.
-
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 targetStateNodein the UI's state tree and walking up to the nearest enclosing component. ReturnsOptional.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 targetStateNodein the UI's state tree and walking up to the nearest enclosing component. ReturnsOptional.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
-