Class Resource
Defined in File resource.h
Class Documentation
-
class Resource
Public Functions
-
const ResourceAttributes &GetAttributes() const noexcept
-
const std::string &GetSchemaURL() const noexcept
-
Resource Merge(const Resource &other) const noexcept
Returns a new, merged Resource by merging the current Resource with the other Resource. In case of a collision, the other Resource takes precedence.
The specification notes that if schema urls collide, the resulting schema url is implementation-defined. In the C++ implementation, the schema url of
- Parameters:
other – is picked.
other – the Resource that will be merged with this.
- Returns:
the newly merged Resource.
Public Static Functions
-
static Resource Create(const ResourceAttributes &attributes, const std::string &schema_url = std::string{})
Returns a newly created Resource with the specified attributes. It adds (merge) SDK attributes and OTEL attributes before returning.
- Parameters:
attributes – for this resource
- Returns:
the newly created Resource.
Protected Functions
-
Resource(const ResourceAttributes &attributes = ResourceAttributes(), const std::string &schema_url = std::string{}) noexcept
The constructor is protected and only for use internally by the class and inside ResourceDetector class. Users should use the Create factory method to obtain a Resource instance.
-
const ResourceAttributes &GetAttributes() const noexcept