@Immutable public abstract class Resource extends Object
Resource
represents a resource, which capture identifying information about the entities
for which signals (stats or traces) are reported.Modifier and Type | Method and Description |
---|---|
static Resource |
create(io.opentelemetry.common.Attributes attributes)
Returns a
Resource . |
abstract io.opentelemetry.common.ReadableAttributes |
getAttributes()
Returns a map of attributes that describe the resource.
|
static Resource |
getDefault()
Returns a
Resource . |
static Resource |
getEmpty()
Returns an empty
Resource . |
static Resource |
getTelemetrySdk()
Returns the telemetry sdk
Resource . |
abstract int |
hashCode() |
Resource |
merge(Resource other)
|
public static Resource getEmpty()
Resource
.Resource
.public static Resource getTelemetrySdk()
Resource
.Resource
with telemetry sdk attributes.public abstract io.opentelemetry.common.ReadableAttributes getAttributes()
public static Resource create(io.opentelemetry.common.Attributes attributes)
Resource
.attributes
- a map of attributes that describe the resource.Resource
.NullPointerException
- if attributes
is null.IllegalArgumentException
- if attribute key or attribute value is not a valid printable
ASCII string or exceed MAX_LENGTH
characters.public static Resource getDefault()
Resource
. This resource information is loaded from the
OTEL_RESOURCE_ATTRIBUTES environment variable or otel.resource.attributes system properties.Resource
.public Resource merge(@Nullable Resource other)
Resource
by merging the current Resource
with the other
Resource
. In case of a collision, current Resource
takes precedence.other
- the Resource
that will be merged with this
.Resource
.