apple / apple/swift-distributed-tracing

Add guidance in README on how to set span attributes

Open
#123 4 comments 0 reactions 0 assignees View on GitHub
area/documentation
Dominant language
Swift
Stars
320
Forks
57
Avg merge
4d 5h
Merged PRs (30d)
1

Description

Accessing span attributes is most likely accessed behind a lock. To avoid locking and unlocking continuously it is preferable span attributes are built up separate from the span and then set once on the span.

Eg replace
```swift
span.attributes["attr1"] = value1
span.attributes["attr2"] = value2
...
```

with

```swift
var attributes = span.attributes
attributes["attr1"] = value1
attributes["attr2"] = value2
...
span.attributes = attributes
```

Contributor guide

Open the contributing guide

Research direction

Start in the README and review the existing guidance around span attributes. Add the issue's example showing attributes being built separately and assigned once to avoid repeated locking, then verify the README clearly explains when to use this pattern.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.