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.Object
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 Classes Modifier and Type Class Description private static class
AttributesProcessor.AppendingAttributesProcessor
Processor which appends a static set ofAttributes
.private static class
AttributesProcessor.AttributeKeyFilteringProcessor
Processor which filters attributes according to aAttributeKey.getKey()
Predicate
.private static class
AttributesProcessor.BaggageAppendingAttributesProcessor
Processor which appends entries fromBaggage
with keys that match a predicate.private static class
AttributesProcessor.JoinedAttributesProcessor
AAttributesProcessor
that runs a sequence of processors.private static class
AttributesProcessor.SetIncludesPredicate
Predicate which tests if theset
includes 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 AttributesProcessor
append(Attributes attributes)
Creates a processor which appends (exactly) the given attributes.static AttributesProcessor
appendBaggageByKeyName(java.util.function.Predicate<java.lang.String> nameFilter)
Creates a processor which appends values fromBaggage
.static AttributesProcessor
filterByKeyName(java.util.function.Predicate<java.lang.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.static java.util.function.Predicate<java.lang.String>
setIncludes(java.util.Set<java.lang.String> set)
Creates aPredicate
which tests if theset
includes the input.AttributesProcessor
then(AttributesProcessor other)
Joins this attribute processor with another that operates after this one.abstract boolean
usesContext()
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 aPredicate
which tests if theset
includes the input.
-
-