Class ResourceBuilder
Resource that allows to add key-value pairs and copy attributes from other
Attributes or Resource.- Since:
- 1.1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Create theResourcefrom this.Puts aAttributeKeywith associated value into this.<T> ResourceBuilderput(io.opentelemetry.api.common.AttributeKey<T> key, T value) Puts aAttributeKeywith associated value into this.Puts a boolean attribute into this.Puts a Boolean array attribute into this.Puts a double attribute into this.Puts a Double array attribute into this.Puts a long attribute into this.Puts a Long array attribute into this.Puts a String attribute into this.Puts a String array attribute into this.putAll(io.opentelemetry.api.common.Attributes attributes) Puts allAttributesinto this.Puts all attributes fromResourceinto this.setSchemaUrl(String schemaUrl) Assign an OpenTelemetry schema URL to the resulting Resource.
-
Constructor Details
-
ResourceBuilder
public ResourceBuilder()
-
-
Method Details
-
put
Puts a String attribute into this.Note: It is strongly recommended to use
put(AttributeKey, Object), and pre-allocate your keys, if possible.- Returns:
- this Builder
-
put
Puts a long attribute into this.Note: It is strongly recommended to use
put(AttributeKey, Object), and pre-allocate your keys, if possible.- Returns:
- this Builder
-
put
Puts a double attribute into this.Note: It is strongly recommended to use
put(AttributeKey, Object), and pre-allocate your keys, if possible.- Returns:
- this Builder
-
put
Puts a boolean attribute into this.Note: It is strongly recommended to use
put(AttributeKey, Object), and pre-allocate your keys, if possible.- Returns:
- this Builder
-
put
Puts a String array attribute into this.Note: It is strongly recommended to use
put(AttributeKey, Object), and pre-allocate your keys, if possible.- Returns:
- this Builder
-
put
Puts a Long array attribute into this.Note: It is strongly recommended to use
put(AttributeKey, Object), and pre-allocate your keys, if possible.- Returns:
- this Builder
-
put
Puts a Double array attribute into this.Note: It is strongly recommended to use
put(AttributeKey, Object), and pre-allocate your keys, if possible.- Returns:
- this Builder
-
put
Puts a Boolean array attribute into this.Note: It is strongly recommended to use
put(AttributeKey, Object), and pre-allocate your keys, if possible.- Returns:
- this Builder
-
put
Puts aAttributeKeywith associated value into this. -
put
Puts aAttributeKeywith associated value into this. -
putAll
Puts allAttributesinto this. -
putAll
Puts all attributes fromResourceinto this. -
setSchemaUrl
Assign an OpenTelemetry schema URL to the resulting Resource.- Parameters:
schemaUrl- The URL of the OpenTelemetry schema being used to create this Resource.- Returns:
- this
- Since:
- 1.4.0
-
build
Create theResourcefrom this.
-