Class Resource
java.lang.Object
io.opencensus.resource.Resource
Resource represents a resource, which capture identifying information about the entities
for which signals (stats or traces) are reported. It further provides a framework for detection
of resource information from the environment and progressive population as signals propagate from
the core instrumentation library to a backend's exporter.- Since:
- 0.18
-
Method Summary
Modifier and TypeMethodDescriptionstatic ResourceReturns aResource.static ResourceReturns aResource.Returns a map of labels that describe the resource.abstract StringgetType()Returns the type identifier for the resource.static ResourcemergeResources(List<Resource> resources) Returns aResourcethat runs all input resources sequentially and merges their results.
-
Method Details
-
getType
-
getLabels
-
createFromEnvironmentVariables
-
create
Returns aResource.- Parameters:
type- the type identifier for the resource.labels- a map of labels that describe the resource.- Returns:
- a
Resource. - Throws:
NullPointerException- iflabelsis null.IllegalArgumentException- if type or label key or label value is not a valid printable ASCII string or exceedMAX_LENGTHcharacters.- Since:
- 0.18
-
mergeResources
Returns aResourcethat runs all input resources sequentially and merges their results. In case a type of label key is already set, the first set value takes precedence.- Parameters:
resources- a list of resources.- Returns:
- a
Resource. - Since:
- 0.18
-