Class ResourceBuilder
- java.lang.Object
-
- io.opentelemetry.sdk.resources.ResourceBuilder
-
-
Constructor Summary
Constructors Constructor Description ResourceBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Resourcebuild()Create theResourcefrom this.ResourceBuilderput(io.opentelemetry.api.common.AttributeKey<Long> key, int value)Puts aAttributeKeywith associated value into this.<T> ResourceBuilderput(io.opentelemetry.api.common.AttributeKey<T> key, T value)Puts aAttributeKeywith associated value into this.ResourceBuilderput(String key, boolean value)Puts a boolean attribute into this.ResourceBuilderput(String key, boolean... values)Puts a Boolean array attribute into this.ResourceBuilderput(String key, double value)Puts a double attribute into this.ResourceBuilderput(String key, double... values)Puts a Double array attribute into this.ResourceBuilderput(String key, long value)Puts a long attribute into this.ResourceBuilderput(String key, long... values)Puts a Long array attribute into this.ResourceBuilderput(String key, String value)Puts a String attribute into this.ResourceBuilderput(String key, String... values)Puts a String array attribute into this.ResourceBuilderputAll(io.opentelemetry.api.common.Attributes attributes)Puts allAttributesinto this.ResourceBuilderputAll(Resource resource)Puts all attributes fromResourceinto this.ResourceBuildersetSchemaUrl(String schemaUrl)Assign an OpenTelemetry schema URL to the resulting Resource.
-
-
-
Method Detail
-
put
public ResourceBuilder put(String key, String value)
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
public ResourceBuilder put(String key, long value)
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
public ResourceBuilder put(String key, double value)
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
public ResourceBuilder put(String key, boolean value)
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
public ResourceBuilder put(String key, String... values)
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
public ResourceBuilder put(String key, long... values)
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
public ResourceBuilder put(String key, double... values)
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
public ResourceBuilder put(String key, boolean... values)
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
public <T> ResourceBuilder put(io.opentelemetry.api.common.AttributeKey<T> key, T value)
Puts aAttributeKeywith associated value into this.
-
put
public ResourceBuilder put(io.opentelemetry.api.common.AttributeKey<Long> key, int value)
Puts aAttributeKeywith associated value into this.
-
putAll
public ResourceBuilder putAll(io.opentelemetry.api.common.Attributes attributes)
Puts allAttributesinto this.
-
putAll
public ResourceBuilder putAll(Resource resource)
Puts all attributes fromResourceinto this.
-
setSchemaUrl
public ResourceBuilder setSchemaUrl(String schemaUrl)
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
-
-