Package io.opentelemetry.sdk.internal
Class ScopeConfiguratorBuilder<T>
- java.lang.Object
-
- io.opentelemetry.sdk.internal.ScopeConfiguratorBuilder<T>
-
- Type Parameters:
T- The scope configuration object, e.g.TracerConfig,LoggerConfig,MeterConfig.
public final class ScopeConfiguratorBuilder<T> extends java.lang.ObjectBuilder forScopeConfigurator.This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classScopeConfiguratorBuilder.Condition<T>
-
Field Summary
Fields Modifier and Type Field Description private ScopeConfigurator<T>baseScopeConfiguratorprivate java.util.List<ScopeConfiguratorBuilder.Condition<T>>conditionsprivate TdefaultScopeConfig
-
Constructor Summary
Constructors Constructor Description ScopeConfiguratorBuilder(ScopeConfigurator<T> baseScopeConfigurator)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ScopeConfiguratorBuilder<T>addCondition(java.util.function.Predicate<InstrumentationScopeInfo> scopePredicate, T scopeConfig)Add a condition.ScopeConfigurator<T>build()Build aScopeConfiguratorwith the configuration of this builder.static java.util.function.Predicate<InstrumentationScopeInfo>nameEquals(java.lang.String scopeName)Helper function for exact matchingInstrumentationScopeInfo.getName()against thescopeName.static java.util.function.Predicate<InstrumentationScopeInfo>nameMatchesGlob(java.lang.String globPattern)Helper function for pattern matchingInstrumentationScopeInfo.getName()against theglobPattern.ScopeConfiguratorBuilder<T>setDefault(T defaultScopeConfig)Set the default scope config, which is returned byFunction.apply(Object)if aInstrumentationScopeInfodoes not match anyconditions.
-
-
-
Field Detail
-
baseScopeConfigurator
private final ScopeConfigurator<T> baseScopeConfigurator
-
defaultScopeConfig
@Nullable private T defaultScopeConfig
-
conditions
private final java.util.List<ScopeConfiguratorBuilder.Condition<T>> conditions
-
-
Constructor Detail
-
ScopeConfiguratorBuilder
ScopeConfiguratorBuilder(ScopeConfigurator<T> baseScopeConfigurator)
-
-
Method Detail
-
setDefault
public ScopeConfiguratorBuilder<T> setDefault(T defaultScopeConfig)
Set the default scope config, which is returned byFunction.apply(Object)if aInstrumentationScopeInfodoes not match anyconditions. If a default is not set, an SDK defined default is used.
-
addCondition
public ScopeConfiguratorBuilder<T> addCondition(java.util.function.Predicate<InstrumentationScopeInfo> scopePredicate, T scopeConfig)
Add a condition. Conditions are evaluated in order. ThescopeConfigfor the first match is returned byFunction.apply(Object).- Parameters:
scopePredicate- predicate thatInstrumentationScopeInfos are evaluated againstscopeConfig- the scope config to use when this condition is the first matchingscopePredicate- See Also:
nameMatchesGlob(String),nameEquals(String)
-
nameMatchesGlob
public static java.util.function.Predicate<InstrumentationScopeInfo> nameMatchesGlob(java.lang.String globPattern)
Helper function for pattern matchingInstrumentationScopeInfo.getName()against theglobPattern.globPatternmay contain the wildcard characters*and?with the following matching criteria:*matches 0 or more instances of any character?matches exactly one instance of any character
- See Also:
addCondition(Predicate, Object)
-
nameEquals
public static java.util.function.Predicate<InstrumentationScopeInfo> nameEquals(java.lang.String scopeName)
Helper function for exact matchingInstrumentationScopeInfo.getName()against thescopeName.- See Also:
addCondition(Predicate, Object)
-
build
public ScopeConfigurator<T> build()
Build aScopeConfiguratorwith the configuration of this builder.
-
-