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

OTel style Spans: Links #69

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

OTel style Spans: Links #69

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

Comments

@ktoso
Copy link
Collaborator

ktoso commented Jul 14, 2020

Some notes about how links can be done:

The Java impl does:

    Builder addLink(SpanContext spanContext);
    Builder addLink(SpanContext spanContext, Attributes attributes);
//    * <p>Links are used to link {@link Span}s in different traces. Used (for example) in batching operations, where a single batch handler processes multiple requests from different traces or the same trace.
    Builder addLink(Link link);

We can basically look the same here:

    mutating func addLink(context: BaggageContext, attributes: SpanAttributes = .none)
    mutating func addLink(_ link: Link)

Same as with any other add things we can add adding... ones if we want via extensions later on.

as for the comment on the spec:

  • An API to record a single Link where the Link properties are passed as arguments. This MAY be called AddLink.
  • An API to record a single Link whose attributes or attribute values are lazily constructed, with the intention of avoiding unnecessary work if a link is unused. If the language supports overloads then this SHOULD be called AddLink otherwise AddLazyLink MAY be considered.

I think we can handle the lazy case inside the SpanAttributes #68

To be honest this starts to lead us into that these context things should become Copy-on-Write types, so we can share them -- and this is a perfect example since we'll never mutate the span attributes here 🤔

As step 0 we can just be eager for now, but let's then make a ticket about the lazy part -- I think we should solve it by copy-on-write style things rather than some () -> SpanAttributes which would have been the other option.

@ktoso ktoso mentioned this issue Jul 14, 2020
4 tasks
@slashmo slashmo self-assigned this Jul 14, 2020
@ktoso ktoso closed this as completed in #73 Jul 17, 2020
@ktoso ktoso changed the title OT style Spans: Links OTel style Spans: Links Jul 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants