Class ResourceBuilder
Resource that allows to add key-value pairs and copy attributes from other
Attributes or Resource.- Since:
- 1.1.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Create theResourcefrom this.put(AttributeKey<Long> key, int value) Puts aAttributeKeywith associated value into this.<T> ResourceBuilderput(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(Attributes attributes) Puts allAttributesinto this.Puts all attributes fromResourceinto this.removeIf(Predicate<AttributeKey<?>> filter) Remove all attributes that satisfy the given predicate fromResource.setSchemaUrl(String schemaUrl) Assign an OpenTelemetry schema URL to the resulting Resource.
-
Field Details
-
attributesBuilder
-
schemaUrl
-
-
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. -
removeIf
Remove all attributes that satisfy the given predicate fromResource. -
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.
-