-
Notifications
You must be signed in to change notification settings - Fork 965
Description
While discussing with some of the community members (e.g. @jmacd) there were some issues about implementing a functionality in a specific way (e.g. this object MUST be an interface).
Here is an example of how the AddLink can be re-written:
See Links description. Linked Span can be from the same or different trace.
A Link is defined by:
- (Required) SpanContext of the Span to link to
- (Optional) Map of attributes associated with this link. Attributes are key:value pairs where hey is a string and value is one of string, boolean and numeric.
The Span interface:
- Provide an API to record links where the link properties are passed as arguments. This SHOULD be called
AddLink. - Provide an API to record lazy initialized links. This can be implemented by having a Link interface or by providing a concrete Link definition and a LazyLinkFormatter. If languages supports overloads then this SHOULD be called
AddLinkotherwiseAddLazyLinkmay be consider.
Similar suggestion can be made for SpanBuilder. I think we should not enforce that every language uses a Builder pattern. We should rephrase the Tracer capability to be: "Allow span creation with the following options configured: required a name, allow to set an explicit parent, etc.". So language can for example have an API Span Tracer::StartSpan(SpanStartOptions);
Disclaimer: What I suggested may not be the right way to re-write specifications but I tried to show a possible way to do this.
I would like to know if TC members and others agree with:
- Every language should use the language specific patterns to achieve the functionality define in the specification.
Why?
- I think this way every language API and SDK can be more language idiomatic and allow languages like golang to not pay unnecessary performance overhead when working with interfaces (extra heap allocations).