Package io.jmix.flowui.observation
Class UiObservationSupport
java.lang.Object
io.jmix.flowui.observation.UiObservationSupport
Support class for observing UI events such as view lifecycle events and action executions.
This class uses an ObservationRegistry if observation functionality
is enabled in the application configuration.
Observation functionality can be turned on or off using the jmix.ui.ui-observation-enabled
property in the application's configuration.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringHuman-readable contextual name passed to theObservationof action executions.static final StringLow-cardinality tag key carrying the action's id on action-execution observations.static final Stringstatic final StringHuman-readable contextual name passed to theObservationof data loader lifecycle phases.static final Stringstatic final StringLow-cardinality tag key carrying the FQN of the fragment's class.static final StringHuman-readable contextual name passed to theObservationof fragment lifecycle phases.static final StringLow-cardinality tag key carrying the enclosing fragment's id.static final Stringstatic final StringHigh-cardinality span attribute key preserving the original loader id whenLOADER_ID_TAGcollapses to the sentinel.protected static final StringSentinel for the low-cardinalityloader.idtag when the loader carries an auto-generated id (prefixgenerated_).protected LegacyUiTimerSupportstatic final StringTag key carrying the modern-schema lifecycle phase name on view / fragment / data-loader observations.static final StringLow-cardinality tag key carrying the data loader's id (orGENERATED_LOADER_ID_SENTINEL).static final StringSentinel value placed into low-cardinality tags (VIEW_ID_TAG,FRAGMENT_ID_TAG,TARGET_ID_TAG) when the underlying id cannot be resolved (view/fragment/target absent or without an explicit id).static final StringShared prefix of everyjmix.ui.*observation/metric name produced by this support class.protected booleanprotected io.micrometer.observation.ObservationRegistrystatic final StringLow-cardinality tag key carrying the target component's id on action-execution observations.static final StringLow-cardinality tag key carrying the FQN of the view's class.static final StringHuman-readable contextual name passed to theObservationof view lifecycle phases.static final StringLow-cardinality tag key carrying the enclosing view's id.static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected io.micrometer.observation.ObservationbuildDataLoaderObservation(DataLoader loader, DataLoaderLifeCycle lifecycle) Builds the data loader Observation lazily — observation availability is checked before invokingDataLoader.getObservationInfoProvider(), since that provider can walk the UI tree to resolve fragment/view context (see R8) and should not run when observation is disabled.protected io.micrometer.observation.ObservationbuildFragmentLifecycleObservation(FragmentObservationInfo info, FragmentLifecycle lifecycle) protected io.micrometer.observation.ObservationbuildViewLifecycleObservation(View<?> view, ViewLifecycle lifecycle) io.micrometer.observation.ObservationcreateActionExecutionObservation(Action action, @Nullable com.vaadin.flow.component.Component invocationSource) protected booleanvoidobserveDataLoader(DataLoader loader, DataLoaderLifeCycle phase, Runnable action) Records monitoring data for a voidDataLoaderlifecycle phase.<T> TobserveDataLoader(DataLoader loader, DataLoaderLifeCycle phase, Supplier<T> action) voidobserveFragmentLifecycle(Fragment<?> fragment, FragmentLifecycle phase, Runnable action) Records monitoring data for a voidFragmentlifecycle phase.<T> TobserveFragmentLifecycle(Fragment<?> fragment, FragmentLifecycle phase, Supplier<T> action) Records monitoring data for a value-returningFragmentlifecycle phase.<T> TobserveFragmentLifecycle(FragmentObservationInfo info, FragmentLifecycle phase, Supplier<T> action) voidobserveViewLifecycle(View<?> view, ViewLifecycle phase, Runnable action) Records monitoring data for a voidViewlifecycle phase.<T> TobserveViewLifecycle(View<?> view, ViewLifecycle phase, Supplier<T> action)
-
Field Details
-
OBSERVATION_NAME_PREFIX
Shared prefix of everyjmix.ui.*observation/metric name produced by this support class.- See Also:
-
VIEW_OBSERVATION_NAME
- See Also:
-
FRAGMENT_OBSERVATION_NAME
- See Also:
-
ACTION_OBSERVATION_NAME
- See Also:
-
DATA_LOADER_OBSERVATION_NAME
- See Also:
-
VIEW_CONTEXTUAL_NAME
Human-readable contextual name passed to theObservationof view lifecycle phases.- See Also:
-
FRAGMENT_CONTEXTUAL_NAME
Human-readable contextual name passed to theObservationof fragment lifecycle phases.- See Also:
-
DATA_LOADER_CONTEXTUAL_NAME
Human-readable contextual name passed to theObservationof data loader lifecycle phases.- See Also:
-
ACTION_CONTEXTUAL_NAME
Human-readable contextual name passed to theObservationof action executions.- See Also:
-
LIFECYCLE_NAME_TAG
Tag key carrying the modern-schema lifecycle phase name on view / fragment / data-loader observations. Acts as the marker that distinguishes modern Observation meters from the legacyTimer-based schema; the legacy stack uses it to suppress modern Timer registrations under the samejmix.ui.*names (seeLegacyUiTimerSupport).- See Also:
-
VIEW_ID_TAG
Low-cardinality tag key carrying the enclosing view's id.- See Also:
-
VIEW_CLASS_TAG
Low-cardinality tag key carrying the FQN of the view's class.- See Also:
-
FRAGMENT_ID_TAG
Low-cardinality tag key carrying the enclosing fragment's id.- See Also:
-
FRAGMENT_CLASS_TAG
Low-cardinality tag key carrying the FQN of the fragment's class.- See Also:
-
LOADER_ID_TAG
Low-cardinality tag key carrying the data loader's id (orGENERATED_LOADER_ID_SENTINEL).- See Also:
-
FULL_LOADER_ID_TAG
High-cardinality span attribute key preserving the original loader id whenLOADER_ID_TAGcollapses to the sentinel.- See Also:
-
ACTION_ID_TAG
Low-cardinality tag key carrying the action's id on action-execution observations.- See Also:
-
TARGET_ID_TAG
Low-cardinality tag key carrying the target component's id on action-execution observations.- See Also:
-
NOT_AVAILABLE
Sentinel value placed into low-cardinality tags (VIEW_ID_TAG,FRAGMENT_ID_TAG,TARGET_ID_TAG) when the underlying id cannot be resolved (view/fragment/target absent or without an explicit id). The tag is added unconditionally so the Prometheus meter for a given metric name always carries the same set of tag keys — otherwise conditionally-added tags makePrometheusMeterRegistryreject one of the registrations and silently drop a slice of the data.- See Also:
-
GENERATED_LOADER_ID_SENTINEL
Sentinel for the low-cardinalityloader.idtag when the loader carries an auto-generated id (prefixgenerated_). Aggregates all anonymous loaders into a single time-series; the original id is preserved as a high-cardinalityfull_loader_idattribute on the span.- See Also:
-
observationRegistry
@Autowired(required=false) protected io.micrometer.observation.ObservationRegistry observationRegistry -
legacyUiTimerSupport
-
observationEnabled
protected boolean observationEnabled
-
-
Constructor Details
-
UiObservationSupport
-
-
Method Details
-
observeDataLoader
Records monitoring data for a voidDataLoaderlifecycle phase. -
observeDataLoader
- See Also:
-
buildDataLoaderObservation
protected io.micrometer.observation.Observation buildDataLoaderObservation(DataLoader loader, DataLoaderLifeCycle lifecycle) Builds the data loader Observation lazily — observation availability is checked before invokingDataLoader.getObservationInfoProvider(), since that provider can walk the UI tree to resolve fragment/view context (see R8) and should not run when observation is disabled. -
observeViewLifecycle
Records monitoring data for a voidViewlifecycle phase. -
observeViewLifecycle
- See Also:
-
buildViewLifecycleObservation
protected io.micrometer.observation.Observation buildViewLifecycleObservation(View<?> view, ViewLifecycle lifecycle) -
observeFragmentLifecycle
public void observeFragmentLifecycle(Fragment<?> fragment, FragmentLifecycle phase, Runnable action) Records monitoring data for a voidFragmentlifecycle phase. -
observeFragmentLifecycle
public <T> T observeFragmentLifecycle(Fragment<?> fragment, FragmentLifecycle phase, Supplier<T> action) Records monitoring data for a value-returningFragmentlifecycle phase.- See Also:
-
observeFragmentLifecycle
public <T> T observeFragmentLifecycle(FragmentObservationInfo info, FragmentLifecycle phase, Supplier<T> action) - See Also:
-
buildFragmentLifecycleObservation
protected io.micrometer.observation.Observation buildFragmentLifecycleObservation(FragmentObservationInfo info, FragmentLifecycle lifecycle) -
createActionExecutionObservation
public io.micrometer.observation.Observation createActionExecutionObservation(Action action, @Nullable com.vaadin.flow.component.Component invocationSource) -
isObservationAvailable
protected boolean isObservationAvailable()
-