-
Notifications
You must be signed in to change notification settings - Fork 891
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
Generalize span creation #190
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
specification/tracing-api.md
Outdated
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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
specification/tracing-api.md
Outdated
|
||
- Name of the span. | ||
### Span Creation |
There was a problem hiding this comment.
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.
* ...
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this 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
the end-to-end latency and, optionally, one or more sub-spans for its | ||
sub-operations. | ||
|
||
`Span`s encapsulate: |
There was a problem hiding this comment.
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
- The parent span, and whether the new `Span` should be a root `Span`. | ||
- `Attribute`s | ||
- `Link`s | ||
- `Event`s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this new?
There was a problem hiding this comment.
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).
specification/tracing-api.md
Outdated
options for newly created `Span`s. | ||
|
||
The API MUST allow users to provide the following properties: | ||
- The operation name |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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
specification/tracing-api.md
Outdated
or null | ||
- A start timestamp | ||
- An end timestamp | ||
- An ordered mapping of [`Attribute`s](#SetAttribute) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rebase.
Co-Authored-By: Armin Ruech <[email protected]>
This should be ready to merge. |
Merging now, as this has been approved for a few days now. We can always receive feedback later on ;) |
* 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
* 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
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.