Class ViewBuilder
java.lang.Object
io.opentelemetry.sdk.metrics.view.ViewBuilder
Builder of metric
Views.-
Method Summary
Modifier and TypeMethodDescriptionAppends all key-values from baggage to all measurements.appendAttributes(io.opentelemetry.api.common.Attributes extraAttributes) Appends a static set of attributes to all measurements.appendFilteredBaggageAttributes(Predicate<String> keyFilter) Appends key-values from baggage to all measurements.appendFilteredBaggageAttributesByPattern(Pattern keyPattern) Appends key-values from baggage to all measurements.build()Returns the resultingView.filterAttributes(Predicate<String> keyFilter) Filters measurement attributes using a given filter.filterAttributes(Pattern keyPattern) Filters measurement attributes using a given regex.setAggregation(Aggregation aggregation) setsAggregation.setAttributesProcessor(io.opentelemetry.sdk.metrics.internal.view.AttributesProcessor processor) Specify the attributes processor for this view.setDescription(String description) sets the name of the resulting metric.sets the name of the resulting metric.
-
Method Details
-
setName
sets the name of the resulting metric.- Parameters:
name- metric name ornullif the underlying instrument name should be used.- Returns:
- this Builder.
-
setDescription
sets the name of the resulting metric.- Parameters:
description- metric description ornullif the underlying instrument description should be used.- Returns:
- this Builder.
-
setAggregation
setsAggregation.- Parameters:
aggregation- aggregation to use.- Returns:
- this Builder.
-
setAttributesProcessor
public ViewBuilder setAttributesProcessor(io.opentelemetry.sdk.metrics.internal.view.AttributesProcessor processor) Specify the attributes processor for this view.Note: This resets all attribute filters, baggage appending and other processing.
Visible for testing.
- Parameters:
processor- The pre-processor for measurement attributes.- Returns:
- this Builder.
-
filterAttributes
Filters measurement attributes using a given filter.Note: This runs after all other attribute processing added so far.
- Parameters:
keyFilter- filter for key names to include.- Returns:
- this Builder.
-
filterAttributes
Filters measurement attributes using a given regex.Note: This runs after all other attribute processing added so far.
- Parameters:
keyPattern- the regular expression for selecting attributes by key name.- Returns:
- this Builder.
-
appendAttributes
Appends a static set of attributes to all measurements.Note: This runs after all other attribute processing added so far.
- Parameters:
extraAttributes- The static attributes to append to measurements.- Returns:
- this Builder.
-
appendFilteredBaggageAttributes
Appends key-values from baggage to all measurements.Note: This runs after all other attribute processing added so far.
- Parameters:
keyFilter- Only baggage key values pairs where the key matches this predicate will be appended.- Returns:
- this Builder.
-
appendFilteredBaggageAttributesByPattern
Appends key-values from baggage to all measurements.Note: This runs after all other attribute processing added so far.
- Parameters:
keyPattern- Only baggage key values pairs where the key matches this regex will be appended.- Returns:
- this Builder.
-
appendAllBaggageAttributes
Appends all key-values from baggage to all measurements.Note: This runs after all other attribute processing added so far.
- Returns:
- this Builder.
-
build
Returns the resultingView.
-