Class AttributesProcessor
- java.lang.Object
-
- io.opentelemetry.sdk.metrics.internal.view.AttributesProcessor
-
- Direct Known Subclasses:
AdviceAttributesProcessor,AttributesProcessor.AppendingAttributesProcessor,AttributesProcessor.AttributeKeyFilteringProcessor,AttributesProcessor.BaggageAppendingAttributesProcessor,AttributesProcessor.JoinedAttributesProcessor,NoopAttributesProcessor
@Immutable public abstract class AttributesProcessor extends java.lang.ObjectAn AttributesProcessor is used to define the actual set of attributes that will be used in a Metric vs. the inbound set of attributes from a measurement.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 classAttributesProcessor.AppendingAttributesProcessorProcessor which appends a static set ofAttributes.private static classAttributesProcessor.AttributeKeyFilteringProcessorProcessor which filters attributes according to aAttributeKey.getKey()Predicate.private static classAttributesProcessor.BaggageAppendingAttributesProcessorProcessor which appends entries fromBaggagewith keys that match a predicate.private static classAttributesProcessor.JoinedAttributesProcessorAAttributesProcessorthat runs a sequence of processors.private static classAttributesProcessor.SetIncludesPredicatePredicate which tests if thesetincludes the input.
-
Constructor Summary
Constructors Constructor Description AttributesProcessor()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static AttributesProcessorappend(Attributes attributes)Creates a processor which appends (exactly) the given attributes.static AttributesProcessorappendBaggageByKeyName(java.util.function.Predicate<java.lang.String> nameFilter)Creates a processor which appends values fromBaggage.static AttributesProcessorfilterByKeyName(java.util.function.Predicate<java.lang.String> nameFilter)Creates a processor which filters down attributes from a measurement.static AttributesProcessornoop()No-op version of attributes processor, returns what it gets.abstract Attributesprocess(Attributes incoming, Context context)Manipulates a set of attributes, returning the desired set.static java.util.function.Predicate<java.lang.String>setIncludes(java.util.Set<java.lang.String> set)Creates aPredicatewhich tests if thesetincludes the input.AttributesProcessorthen(AttributesProcessor other)Joins this attribute processor with another that operates after this one.abstract booleanusesContext()If true, this ensures the `Context` argument of the attributes processor is always accurate.
-
-
-
Method Detail
-
process
public abstract Attributes process(Attributes incoming, Context context)
Manipulates a set of attributes, returning the desired set.- Parameters:
incoming- Attributes associated with an incoming measurement.context- The context associated with the measurement.
-
usesContext
public abstract boolean usesContext()
If true, this ensures the `Context` argument of the attributes processor is always accurate. This will prevents bound instruments from pre-locking their metric-attributes and defer until context is available.
-
then
public AttributesProcessor then(AttributesProcessor other)
Joins this attribute processor with another that operates after this one.
-
noop
public static AttributesProcessor noop()
No-op version of attributes processor, returns what it gets.
-
filterByKeyName
public static AttributesProcessor filterByKeyName(java.util.function.Predicate<java.lang.String> nameFilter)
Creates a processor which filters down attributes from a measurement.- Parameters:
nameFilter- a filter for which attribute keys to preserve.
-
appendBaggageByKeyName
public static AttributesProcessor appendBaggageByKeyName(java.util.function.Predicate<java.lang.String> nameFilter)
Creates a processor which appends values fromBaggage.These attributes will not override those attributes provided by instrumentation.
- Parameters:
nameFilter- a filter for which baggage keys to select.
-
append
public static AttributesProcessor append(Attributes attributes)
Creates a processor which appends (exactly) the given attributes.These attributes will not override those attributes provided by instrumentation.
- Parameters:
attributes- Attributes to append to measurements.
-
setIncludes
public static java.util.function.Predicate<java.lang.String> setIncludes(java.util.Set<java.lang.String> set)
Creates aPredicatewhich tests if thesetincludes the input.
-
-