Skip to content

Proposal: Focus on functionality/capabilities rather than how #165

@bogdandrutu

Description

@bogdandrutu

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 AddLink otherwise AddLazyLink may 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:

  1. Every language should use the language specific patterns to achieve the functionality define in the specification.

Why?

  1. 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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions