Package io.opentelemetry.sdk.metrics
Class ViewBuilder
java.lang.Object
io.opentelemetry.sdk.metrics.ViewBuilder
A builder for
View
.- Since:
- 1.14.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Aggregation
private int
private String
private String
private AttributesProcessor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) ViewBuilder
addAttributesProcessor
(AttributesProcessor attributesProcessor) Add an attribute processor.build()
Returns aView
with the configuration of this builder.setAggregation
(Aggregation aggregation) SetsAggregation
.setAttributeFilter
(Predicate<String> keyFilter) Sets a filter for attributes keys.setAttributeFilter
(Set<String> keysToRetain) Sets a filter which retains attribute keys included inkeysToRetain
.setCardinalityLimit
(int cardinalityLimit) Set the cardinality limit.setDescription
(String description) Sets the description of the resulting metric.Sets the name of the resulting metric.
-
Field Details
-
name
-
description
-
aggregation
-
processor
-
cardinalityLimit
private int cardinalityLimit
-
-
Constructor Details
-
ViewBuilder
ViewBuilder()
-
-
Method Details
-
setName
Sets the name of the resulting metric.- Parameters:
name
- metric name ornull
if the matched instrument name should be used.
-
setDescription
Sets the description of the resulting metric.- Parameters:
description
- metric description ornull
if the matched instrument description should be used.
-
setAggregation
SetsAggregation
.- Parameters:
aggregation
- aggregation to use.
-
setAttributeFilter
Sets a filter which retains attribute keys included inkeysToRetain
.- Since:
- 1.30.0
-
setAttributeFilter
Sets a filter for attributes keys.Only attribute keys that pass the supplied
Predicate
will be included in the output.- Parameters:
keyFilter
- filter for attribute keys to include.
-
addAttributesProcessor
Add an attribute processor.This method is experimental so not public. You may reflectively call it using
SdkMeterProviderUtil.appendFilteredBaggageAttributes(ViewBuilder, Predicate)
,SdkMeterProviderUtil.appendAllBaggageAttributes(ViewBuilder)
.Note: not currently stable but additional attribute processors can be configured via
SdkMeterProviderUtil.appendAllBaggageAttributes(ViewBuilder)
. -
setCardinalityLimit
Set the cardinality limit.Read
MemoryMode
to understand the memory usage behavior of reaching cardinality limit.- Parameters:
cardinalityLimit
- the maximum number of series for a metric- Since:
- 1.44.0
-
build
Returns aView
with the configuration of this builder.
-