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 capturingThreadLocal
valuesclearMissing
(boolean shouldClear) Determines whether to clear existingThreadLocal
values at the start of a scope, if there are no corresponding values in the sourceContextSnapshot
or context object.contextRegistry
(ContextRegistry contextRegistry) Configures theContextRegistry
to 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 existingThreadLocal
values at the start of a scope, if there are no corresponding values in the sourceContextSnapshot
or 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 theContextRegistry
to 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 capturingThreadLocal
values- Parameters:
captureKeyPredicate
- predicate used to select matching keys- Returns:
- this builder instance
-