Skip to content
This repository has been archived by the owner on Apr 23, 2021. It is now read-only.

SpanAttributes as a type #68

Closed
ktoso opened this issue Jul 14, 2020 · 0 comments · Fixed by #62
Closed

SpanAttributes as a type #68

ktoso opened this issue Jul 14, 2020 · 0 comments · Fixed by #62
Assignees
Projects

Comments

@ktoso
Copy link
Collaborator

ktoso commented Jul 14, 2020

Since the spec suggests those should keep order, just a plain old dict is not going serve this well:

Attributes SHOULD preserve the order in which they're set. Setting an attribute with the same key as an existing attribute SHOULD overwrite the existing attribute's value.

This basically means a SortedDict which we don't have;

It's a SHOULD so we can move forward without it for now but we want to be in a place where we can swap the impl without breaking anyone to conform to this requirement.

So, let's:

struct SpanAttributes { 
    subscript(_ name: String) -> SpanAttribute? 
    func forEachAttribute(_ callback: (String, SpanAttribute) -> ())
}

and for now back it with a private [String:SpanAttribute] which we can easily replace eventually

@ktoso ktoso changed the title SpanAttribute as a type SpanAttributes as a type Jul 14, 2020
This was referenced Jul 14, 2020
@slashmo slashmo self-assigned this Jul 14, 2020
@slashmo slashmo added this to To do in Development via automation Jul 14, 2020
@slashmo slashmo moved this from To do to In progress in Development Jul 14, 2020
Development automation moved this from In progress to Done Jul 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Development
  
Done
Development

Successfully merging a pull request may close this issue.

2 participants