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 class
Processor which appends a static set ofAttributes
.private static class
Processor which filters attributes according to aAttributeKey.getKey()
Predicate
.private static final class
Processor which appends entries fromBaggage
with keys that match a predicate.private static final class
AAttributesProcessor
that runs a sequence of processors.private static class
Predicate which tests if theset
includes the input. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AttributesProcessor
append
(Attributes attributes) Creates a processor which appends (exactly) the given attributes.static AttributesProcessor
appendBaggageByKeyName
(Predicate<String> nameFilter) Creates a processor which appends values fromBaggage
.static AttributesProcessor
filterByKeyName
(Predicate<String> nameFilter) Creates a processor which filters down attributes from a measurement.static AttributesProcessor
noop()
No-op version of attributes processor, returns what it gets.abstract Attributes
process
(Attributes incoming, Context context) Manipulates a set of attributes, returning the desired set.setIncludes
(Set<String> set) Creates aPredicate
which tests if theset
includes the input.then
(AttributesProcessor other) Joins this attribute processor with another that operates after this one.abstract boolean
If 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 aPredicate
which tests if theset
includes the input.
-