Class ViewBuilder
- java.lang.Object
-
- io.opentelemetry.sdk.metrics.view.ViewBuilder
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ViewBuilderappendAllBaggageAttributes()Appends all key-values from baggage to all measurements.ViewBuilderappendAttributes(io.opentelemetry.api.common.Attributes extraAttributes)Appends a static set of attributes to all measurements.ViewBuilderappendFilteredBaggageAttributes(Predicate<String> keyFilter)Appends key-values from baggage to all measurements.ViewBuilderappendFilteredBaggageAttributesByPattern(Pattern keyPattern)Appends key-values from baggage to all measurements.Viewbuild()Returns the resultingView.ViewBuilderfilterAttributes(Predicate<String> keyFilter)Filters measurement attributes using a given filter.ViewBuilderfilterAttributes(Pattern keyPattern)Filters measurement attributes using a given regex.ViewBuildersetAggregation(Aggregation aggregation)setsAggregation.ViewBuildersetAttributesProcessor(io.opentelemetry.sdk.metrics.internal.view.AttributesProcessor processor)Specify the attributes processor for this view.ViewBuildersetDescription(String description)sets the name of the resulting metric.ViewBuildersetName(String name)sets the name of the resulting metric.
-
-
-
Method Detail
-
setName
public ViewBuilder setName(String name)
sets the name of the resulting metric.- Parameters:
name- metric name ornullif the underlying instrument name should be used.- Returns:
- this Builder.
-
setDescription
public ViewBuilder setDescription(String description)
sets the name of the resulting metric.- Parameters:
description- metric description ornullif the underlying instrument description should be used.- Returns:
- this Builder.
-
setAggregation
public ViewBuilder setAggregation(Aggregation aggregation)
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
public ViewBuilder filterAttributes(Predicate<String> keyFilter)
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
public ViewBuilder filterAttributes(Pattern keyPattern)
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
public ViewBuilder appendAttributes(io.opentelemetry.api.common.Attributes extraAttributes)
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
public ViewBuilder appendFilteredBaggageAttributes(Predicate<String> keyFilter)
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
public ViewBuilder appendFilteredBaggageAttributesByPattern(Pattern keyPattern)
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
public ViewBuilder appendAllBaggageAttributes()
Appends all key-values from baggage to all measurements.Note: This runs after all other attribute processing added so far.
- Returns:
- this Builder.
-
-