Skip to content

Commit 5dd0321

Browse files
authored
Merge pull request #77 from slashmo/feature/span-attributes-init
Expose public dictionary init for SpanAttributes
2 parents 87791a4 + 8e9833c commit 5dd0321

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Sources/Instrumentation/Tracing/Span.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ extension SpanAttribute: ExpressibleByArrayLiteral {
165165
public struct SpanAttributes {
166166
private var _attributes = [String: SpanAttribute]()
167167

168+
/// Create a set of attributes by wrapping the given dictionary.
169+
/// - Parameter attributes: The attributes dictionary to wrap.
170+
public init(_ attributes: [String: SpanAttribute]) {
171+
self._attributes = attributes
172+
}
173+
168174
/// Accesses the `SpanAttribute` with the given name for reading and writing.
169175
/// - Parameter name: The name of the attribute used to identify the attribute.
170176
/// - Returns: The `SpanAttribute` identified by the given name, or `nil` if it's not present.

0 commit comments

Comments
 (0)