Skip to content

Commit 7129c02

Browse files
author
Ignacio Bonafonte
committed
Fix Resource merging attributes, as per the spec the new values should precede the existing ones
1 parent 19a2d0e commit 7129c02

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/OpenTelemetrySdk/Resources/Resource.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ public struct Resource: Equatable, Hashable {
5353
/// In case of a collision, current Resource takes precedence.
5454
/// - Parameter other: the Resource that will be merged with this
5555
public mutating func merge(other: Resource) {
56-
attributes.merge(other.attributes) { current, _ in current }
56+
attributes.merge(other.attributes) { _, other in other }
5757
}
5858

5959
/// Returns a new, merged Resource by merging the current Resource with the other Resource.
6060
/// In case of a collision, current Resource takes precedence.
6161
/// - Parameter other: the Resource that will be merged with this
6262
public func merging(other: Resource) -> Resource {
63-
let labelsCopy = attributes.merging(other.attributes) { current, _ in current }
63+
let labelsCopy = attributes.merging(other.attributes) { _, other in other }
6464
return Resource(attributes: labelsCopy)
6565
}
6666

0 commit comments

Comments
 (0)