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
An 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 ClassesModifier and TypeClassDescriptionprivate static classProcessor which appends a static set ofAttributes.private static classProcessor which filters attributes according to aAttributeKey.getKey()Predicate.private static final classProcessor which appends entries fromBaggagewith keys that match a predicate.private static final classAAttributesProcessorthat runs a sequence of processors.private static classPredicate which tests if thesetincludes the input. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AttributesProcessorappend(Attributes attributes) Creates a processor which appends (exactly) the given attributes.static AttributesProcessorappendBaggageByKeyName(Predicate<String> nameFilter) Creates a processor which appends values fromBaggage.static AttributesProcessorfilterByKeyName(Predicate<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.setIncludes(Set<String> set) Creates aPredicatewhich tests if thesetincludes the input.then(AttributesProcessor other) Joins this attribute processor with another that operates after this one.abstract booleanIf true, this ensures the `Context` argument of the attributes processor is always accurate.
-
Constructor Details
-
AttributesProcessor
AttributesProcessor()
-
-
Method Details
-
process
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
Joins this attribute processor with another that operates after this one. -
noop
No-op version of attributes processor, returns what it gets. -
filterByKeyName
Creates a processor which filters down attributes from a measurement.- Parameters:
nameFilter- a filter for which attribute keys to preserve.
-
appendBaggageByKeyName
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
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
Creates aPredicatewhich tests if thesetincludes the input.
-