Package org.opensaml.profile.action.impl
Class PopulateMetricContext
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
org.opensaml.profile.action.AbstractProfileAction
org.opensaml.profile.action.impl.PopulateMetricContext
- All Implemented Interfaces:
Component,DestructableComponent,InitializableComponent,ProfileAction
An action that populates a
MetricContext child of the ProfileRequestContext with
a set of rules for activating timer measurements and counters on associated objects during the execution
of a profile request.
Unlike a more typical "lookup strategy" design used in most other places, the strategy function supplied is free, and indeed expected, to directly manipulate the created child context directly rather than returning the data to use. The function may return false to indicate a lack of success, but this is merely logged.
A side effect of this action is the incrementing of a counter corresponding to the profile running.
- Event:
EventIds.PROCEED_EVENT_ID
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classDefault function to remove the context from the tree when no metrics are installed. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringCounter to increment on execution.private final org.slf4j.LoggerClass logger.private Function<ProfileRequestContext,Boolean> Strategy function for establishing metric mappings to apply. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoExecute(ProfileRequestContext profileRequestContext) Performs this action.protected voidvoidsetCounterName(String name) Set a counter name to increment.voidsetMetricStrategy(Function<ProfileRequestContext, Boolean> strategy) Set strategy to establish the metric mappings to use.Methods inherited from class org.opensaml.profile.action.AbstractProfileAction
doPostExecute, doPostExecute, doPreExecute, ensureHttpServletRequest, ensureHttpServletResponse, execute, getHttpServletRequest, getHttpServletRequestSupplier, getHttpServletResponse, getHttpServletResponseSupplier, getLogPrefix, isPreExecuteCalled, setHttpServletRequestSupplier, setHttpServletResponseSupplierMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.shared.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
counterName
Counter to increment on execution. -
metricStrategy
Strategy function for establishing metric mappings to apply.
-
-
Constructor Details
-
PopulateMetricContext
public PopulateMetricContext()
-
-
Method Details
-
setCounterName
Set a counter name to increment.- Parameters:
name- counter name- Since:
- 5.0.0
-
setMetricStrategy
Set strategy to establish the metric mappings to use.- Parameters:
strategy- timer mapping strategy
-
doInitialize
- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
doExecute
Performs this action. Actions must override this method to perform their work.- Overrides:
doExecutein classAbstractProfileAction- Parameters:
profileRequestContext- the current IdP profile request context
-