Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add specs on Span creation. #124

Merged
merged 6 commits into from
Jun 17, 2019

Conversation

songy23
Copy link
Member

@songy23 songy23 commented Jun 14, 2019

Fixes #37.

@songy23
Copy link
Member Author

songy23 commented Jun 14, 2019

On a second thought I found it's easier to describe span creation in a more language-agnostic way, so I removed Builder specific statements and mentioned each language should follow its own convention.

- The option to become a root `Span` for a new trace.
If not set, the value of [Tracer.getCurrentSpan](#getcurrentspan) at `StartSpan`
time will be used as parent.
- `Sampler` to the newly created `Span`. If not set, the implementation should provide a default.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If not set, the implementation should provide a default.

hm... it feels like we missed to add a sampler getter to the tracer. I think Tracer's sampler will be used as a default.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think default sampler is a SDK issue rather than API? (#33)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Access to sampler is needed if you plan to record spans using recordSpanData. I'll file an issue

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here I'd suggest replace "default" with "default sampler used by Tracer" or simply "Tracer-defined sampler".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SG, updated.

If not set, the value of [Tracer.getCurrentSpan](#getcurrentspan) at `StartSpan`
time will be used as parent.
- `Sampler` to the newly created `Span`. If not set, the implementation should provide a default.
- `Link` to the newly created `Span`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like a copy/paste issue. You may say "collection of Links that will be associated with the newly created Span"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, this is copied from the Javadoc of addLink (while addLink can be called multiple times). Updated.


Starts a new `Span`.

This MUST not be called multiple times with `Builder` pattern.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what will it return? Should we say that the same Span will be returned on every call to this method?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds a better statement for Builder pattern - updated. (Note in languages that uses Options, each call will create a new Span.)

Copy link
Member Author

@songy23 songy23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when manual Context propagation is used OR when creating a root `Span` with
a parent with an invalid `SpanContext`.
- Parent `SpanContext`. If not set, the value of [Tracer.getCurrentSpan](#getcurrentspan)
at `StartSpan` time will be used as parent. MUST be used to create a `Span`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can only use Span or SpanContext but not both. If both is used then should it return an error, or one takes precedence over the other.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, at least for the non-builder pattern (as for the builder pattern it simply overrides any previous value).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in #131.

- Parent `SpanContext`. If not set, the value of [Tracer.getCurrentSpan](#getcurrentspan)
at `StartSpan` time will be used as parent. MUST be used to create a `Span`
when the parent is in a different process.
- The option to become a root `Span` for a new trace.
Copy link
Contributor

@rghetia rghetia Jun 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is an option to make it a root Span then in the previous option (Span and SpanContext) it should not be 'MUST' in "MUST be used to create a Span when creating a root Span with a parent with an invalid SpanContext.

I think if an option is provided to make it a root span then parent span/span context should be ignored. There should not be an option to pass Invalid Span or Invalid SpanContext to create a root span. Just provide one way.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed as well, also for the non-builder pattern ;)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if an option is provided to make it a root span then parent span/span context should be ignored.

Good catch, and that's consistent with current Java APIs. Created #131 to clarify.

@SergeyKanzhelev
Copy link
Member

I'm merging. Please address extra feedback as a separate PR with improvements

@SergeyKanzhelev SergeyKanzhelev merged commit 681c0f0 into open-telemetry:master Jun 17, 2019
SergeyKanzhelev pushed a commit to SergeyKanzhelev/opentelemetry-specification that referenced this pull request Feb 18, 2020
* Add specs on Span creation.

Fixes open-telemetry#37.

* Put back Tracer.SpanBuilder

* s/called/set

Co-Authored-By: Sergey Kanzhelev <[email protected]>

* Fix spaces. Add a note about span creation from Tracer.

* Update recordEvents and StartSpan.

* Update default samplers, links and StartSpan.
TuckTuckFloof pushed a commit to TuckTuckFloof/opentelemetry-specification that referenced this pull request Oct 15, 2020
* Add compare operators to nostd::string_view

* Added tests
rockb1017 pushed a commit to rockb1017/opentelemetry-specification that referenced this pull request Nov 18, 2021
carlosalberto pushed a commit to carlosalberto/opentelemetry-specification that referenced this pull request Oct 31, 2024
* Add specs on Span creation.

Fixes open-telemetry#37.

* Put back Tracer.SpanBuilder

* s/called/set

Co-Authored-By: Sergey Kanzhelev <[email protected]>

* Fix spaces. Add a note about span creation from Tracer.

* Update recordEvents and StartSpan.

* Update default samplers, links and StartSpan.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document Java API: SpanBuilder API
4 participants