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

Generalize span creation #190

Merged
merged 18 commits into from
Aug 6, 2019

Conversation

c24t
Copy link
Member

@c24t c24t commented Jul 23, 2019

Updates #165.

This PR removes references to the java-specific SpanBuilder in the span creation spec, and borrows from the java documentation and OpenTelemetry spec.

@songy23, @bogdandrutu I'd like to get your feedback here before moving on to span operations.

Copy link
Member

@reyang reyang left a comment

Choose a reason for hiding this comment

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

LGTM.

latency and, optionally, one or more sub-spans for its sub-operations.
A `Span` represents a single operation within a trace.
Spans can be nested to form a trace tree.
Each trace contains a root span, which typically describes the end-to-end latency and, optionally, one or more sub-spans for its sub-operations.
Copy link
Member

Choose a reason for hiding this comment

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

we should use a limit for every line. I think the current vscode config asks for 80.

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed in a036be3 and ed16890.

We're not doing this consistently across the repo, e.g. #186 uses a single line for each paragraph.

I think there's a good argument for soft-wrapping sentences or paragraphs, especially since putting each sentence on its own line means most edits show up as line diffs instead of spilling over into other lines.

I'm pretty surprised to see a vscode config file in this repo.

Copy link
Member Author

Choose a reason for hiding this comment

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

third_way

specification/tracing-api.md Outdated Show resolved Hide resolved
specification/tracing-api.md Outdated Show resolved Hide resolved

- Name of the span.
### Span Creation
Copy link
Member

Choose a reason for hiding this comment

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

I would summarize all the configs that we want users to be able to provide, currently it is hard to find this list because every option is introduced in one paragraph.

### Span Creation
Implementations MUST provide a way to create `Span`s via a `Tracer`, which is responsible for tracking the currently active `Span` and MAY provide default options for newly created `Span`s.

The users of this API SHOULD be able to provide the following properties:
* A parent Span (using a Span, SpanContext, or no parent).
* Parent links.
* ...

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed in a4a8e38 and reworded to make it less redundant with the list above, let me know if this is what you have in mind.

Copy link
Member

@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.

LGTM

@c24t c24t mentioned this pull request Jul 23, 2019
Copy link
Member

@arminru arminru left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

specification/tracing-api.md Outdated Show resolved Hide resolved
the end-to-end latency and, optionally, one or more sub-spans for its
sub-operations.

`Span`s encapsulate:
Copy link
Member

Choose a reason for hiding this comment

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

great overview! 👍

specification/tracing-api.md Outdated Show resolved Hide resolved
specification/tracing-api.md Outdated Show resolved Hide resolved
specification/tracing-api.md Outdated Show resolved Hide resolved
- The parent span, and whether the new `Span` should be a root `Span`.
- `Attribute`s
- `Link`s
- `Event`s
Copy link
Member

Choose a reason for hiding this comment

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

Is this new?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's the items from the list above that are set by the user. I added this in response to #190 (comment).

options for newly created `Span`s.

The API MUST allow users to provide the following properties:
- The operation name
Copy link
Member

Choose a reason for hiding this comment

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

This should be marked as required, the others are optional (specify the 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.

How about this?

The API SHOULD require the caller to provide:
- The operation name
- The parent span, and whether the new `Span` should be a root `Span`.

The API MUST allow users to provide the following properties, which SHOULD be
empty by default:
- `Attribute`s
- `Link`s
- `Event`s

or null
- A start timestamp
- An end timestamp
- An ordered mapping of [`Attribute`s](#SetAttribute)
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to enforce ordering in the spec?

I understand that the actual implementation might put a limit on the maximum number of attributes, and in order to achieve this, the implementation could choose ordered mapping to implement FIFO. But is this a scenario/semantic we want to mention in the spec or it is just implementation details?

Copy link
Member

Choose a reason for hiding this comment

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

Ordering won't be reflected directly in the APIs but it still affects the overall behavior. I think it's worth mentioning in the spec so that all implementation can conform to it.

Copy link
Member

Choose a reason for hiding this comment

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

Let's say, if there is an implementation which supports unlimited number of attributes, do we still want it to maintain the order? What would the consumer do with the ordering?

If we do have ordering requirement, it might be worthy to mention implementation which puts limit on the number of key-value-pairs should follow FIFO.
Another detail that we might want to cover, if there is a duplicated key but different value, what's the intended behavior. For links/events, if the user is trying to append a value which already exists, should the library de-dupe, report error, or append?

Copy link
Member

Choose a reason for hiding this comment

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

if there is an implementation which supports unlimited number of attributes, do we still want it to maintain the order?

If we do have ordering requirement, it might be worthy to mention implementation which puts limit on the number of key-value-pairs should follow FIFO.

Agreed if there's no limit specified for attributes, rephrase it to FIFO may be clearer. However I think preserving the order for timed events makes more sense. To simplify things I would recommend we keep the same for events, links and attributes.

For links/events, if the user is trying to append a value which already exists, should the library de-dupe, report error, or append?

I would say the library would just append instead of de-dup. For events specifically, it's difficult to determine if two events are duplicated since events depend on the time when they are added.

Would like to hear others' opinions on this.

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 it makes sense to preserve ordering, especially since it may be exporters instead of the span impl that's responsible for truncating these. In that case we'd use the ordering even if there's no limit in the span.

I would say the library would just append instead of de-dup

I'd expect attributes tobe de-duped since (this version of) the spec says they're stored in a map, events and links get appended to the list.

Also "ordering" here doesn't specify anything about the order, just that it's deterministic.

Copy link
Member

Choose a reason for hiding this comment

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

Ah that's correct, for attributes we should do de-dup.

Copy link
Member

Choose a reason for hiding this comment

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

Regarding de-dupe on the order mapping, we also need to mention the ordering (the latest value of the same key would win, and the key-value pair will be treated as the newest inserted one). We could borrow idea from TraceContext spec.

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 added a note on de-duping under "Set Attributes" in d2cebe9. I'll edit the span operations section next and expand on this there.

Copy link
Member

@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.

Please rebase.

@c24t
Copy link
Member Author

c24t commented Jul 26, 2019

This should be ready to merge.

@carlosalberto
Copy link
Contributor

Merging now, as this has been approved for a few days now. We can always receive feedback later on ;)

@carlosalberto carlosalberto merged commit 25d90b1 into open-telemetry:master Aug 6, 2019
@c24t c24t mentioned this pull request Aug 9, 2019
@c24t c24t deleted the span-creation-prose branch August 15, 2019 20:30
SergeyKanzhelev pushed a commit to SergeyKanzhelev/opentelemetry-specification that referenced this pull request Feb 18, 2020
* Revise span creation, scrub references to builder

* Make it clear that root spans aren't optional

* Move attrs, reword multiple sections

* Lose StartSpan

* Update active span description for PR comments

* Note that span attrs are ordered

* Summarize span config, add details

* Apply @arminru's suggestions from code review

Co-Authored-By: Armin Ruech <[email protected]>

* Add notes on attribute, event, link ordering

* Clarify optional/required span fields

* Remove attribute ordering note
TuckTuckFloof pushed a commit to TuckTuckFloof/opentelemetry-specification that referenced this pull request Oct 15, 2020
carlosalberto pushed a commit to carlosalberto/opentelemetry-specification that referenced this pull request Oct 31, 2024
* Revise span creation, scrub references to builder

* Make it clear that root spans aren't optional

* Move attrs, reword multiple sections

* Lose StartSpan

* Update active span description for PR comments

* Note that span attrs are ordered

* Summarize span config, add details

* Apply @arminru's suggestions from code review

Co-Authored-By: Armin Ruech <[email protected]>

* Add notes on attribute, event, link ordering

* Clarify optional/required span fields

* Remove attribute ordering note
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.

8 participants