Package io.micrometer.context
Interface ContextSnapshotFactory.Builder
- Enclosing interface:
ContextSnapshotFactory
public static interface ContextSnapshotFactory.Builder
Builder for
ContextSnapshotFactory instances.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Creates a new instance ofContextSnapshotFactory.captureKeyPredicate(Predicate<Object> captureKeyPredicate) Instructs the factory to use the given predicate to select matching keys when capturingThreadLocalvaluesclearMissing(boolean shouldClear) Determines whether to clear existingThreadLocalvalues at the start of a scope, if there are no corresponding values in the sourceContextSnapshotor context object.contextRegistry(ContextRegistry contextRegistry) Configures theContextRegistryto use by the created factory.
-
Method Details
-
build
ContextSnapshotFactory build()Creates a new instance ofContextSnapshotFactory.- Returns:
- an instance configured by the values set on the builder
-
clearMissing
Determines whether to clear existingThreadLocalvalues at the start of a scope, if there are no corresponding values in the sourceContextSnapshotor context object.- Parameters:
shouldClear- iftrue, values not present in the context object or snapshot will be cleared at the start of a scope and later restored- Returns:
- this builder instance
-
contextRegistry
Configures theContextRegistryto use by the created factory.- Parameters:
contextRegistry- the registry to use- Returns:
- this builder instance
-
captureKeyPredicate
Instructs the factory to use the given predicate to select matching keys when capturingThreadLocalvalues- Parameters:
captureKeyPredicate- predicate used to select matching keys- Returns:
- this builder instance
-