diff --git a/sdk/include/opentelemetry/sdk/resource/resource.h b/sdk/include/opentelemetry/sdk/resource/resource.h index eee339e237..c69b971b04 100644 --- a/sdk/include/opentelemetry/sdk/resource/resource.h +++ b/sdk/include/opentelemetry/sdk/resource/resource.h @@ -40,7 +40,7 @@ class Resource * @returns the newly merged Resource. */ - Resource Merge(const Resource &other) noexcept; + Resource Merge(const Resource &other) const noexcept; /** * Returns a newly created Resource with the specified attributes. diff --git a/sdk/src/resource/resource.cc b/sdk/src/resource/resource.cc index 410e7318b1..a07f4d3a3c 100644 --- a/sdk/src/resource/resource.cc +++ b/sdk/src/resource/resource.cc @@ -17,7 +17,7 @@ Resource::Resource(const ResourceAttributes &attributes, const std::string &sche : attributes_(attributes), schema_url_(schema_url) {} -Resource Resource::Merge(const Resource &other) noexcept +Resource Resource::Merge(const Resource &other) const noexcept { ResourceAttributes merged_resource_attributes(other.attributes_); merged_resource_attributes.insert(attributes_.begin(), attributes_.end());