Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions opentelemetry-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## vNext

### Added
- Added `Resource::get_ref(&self, key: &Key) -> Option<&Value>` to allow retrieving a reference to a resource value without cloning.

## 0.31.0

Released 2025-Sep-25
Expand Down
5 changes: 5 additions & 0 deletions opentelemetry-sdk/src/resource/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ impl Resource {
pub fn get(&self, key: &Key) -> Option<Value> {
self.inner.attrs.get(key).cloned()
}

/// Returns a reference to the value for the resource associated with the given key without cloning.
pub fn get_ref(&self, key: &Key) -> Option<&Value> {
self.inner.attrs.get(key)
}
}

/// An iterator over the entries of a `Resource`.
Expand Down