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 theResource
from this.put
(AttributeKey<Long> key, int value) Puts aAttributeKey
with associated value into this.<T> ResourceBuilder
put
(AttributeKey<T> key, T value) Puts aAttributeKey
with 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 allAttributes
into this.Puts all attributes fromResource
into 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 aAttributeKey
with associated value into this. -
put
Puts aAttributeKey
with associated value into this. -
putAll
Puts allAttributes
into this. -
putAll
Puts all attributes fromResource
into 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 theResource
from this.
-