Package io.opentelemetry.sdk.resources
Class Resource
- java.lang.Object
-
- io.opentelemetry.sdk.resources.Resource
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static Resource
create(io.opentelemetry.api.common.Attributes attributes)
Returns aResource
.abstract io.opentelemetry.api.common.ReadableAttributes
getAttributes()
Returns a map of attributes that describe the resource.static Resource
getDefault()
Returns aResource
.static Resource
getEmpty()
Returns an emptyResource
.static Resource
getTelemetrySdk()
Returns the telemetry sdkResource
.abstract int
hashCode()
Resource
merge(Resource other)
-
-
-
Method Detail
-
getTelemetrySdk
public static Resource getTelemetrySdk()
Returns the telemetry sdkResource
.- Returns:
- a
Resource
with telemetry sdk attributes.
-
getAttributes
public abstract io.opentelemetry.api.common.ReadableAttributes getAttributes()
Returns a map of attributes that describe the resource.- Returns:
- a map of attributes.
-
create
public static Resource create(io.opentelemetry.api.common.Attributes attributes)
Returns aResource
.- Parameters:
attributes
- a map of attributes that describe the resource.- Returns:
- a
Resource
. - Throws:
NullPointerException
- ifattributes
is null.IllegalArgumentException
- if attribute key or attribute value is not a valid printable ASCII string or exceedMAX_LENGTH
characters.
-
getDefault
public static Resource getDefault()
Returns aResource
. This resource information is loaded from the OTEL_RESOURCE_ATTRIBUTES environment variable or otel.resource.attributes system properties.- Returns:
- a
Resource
.
-
merge
public Resource merge(@Nullable Resource other)
Returns a new, mergedResource
by merging the currentResource
with theother
Resource
. In case of a collision, currentResource
takes precedence.- Parameters:
other
- theResource
that will be merged withthis
.- Returns:
- the newly merged
Resource
.
-
-