-
Notifications
You must be signed in to change notification settings - Fork 907
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
Changes from 1 commit
ef2480e
6bd22e6
cae98f6
e8d1dea
391857d
a036be3
ed16890
7e9984f
2742bc7
a4a8e38
203a691
3e6444a
d2cebe9
2e1af8e
9271e1b
0dc27c4
90e8366
d397b38
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -233,13 +233,15 @@ sub-operations. | |
`Span`s encapsulate: | ||
|
||
- The operation name | ||
- A [`SpanContext`](#SpanContext) | ||
- A parent [`Span`](#Span) or [`SpanContext`](#SpanContext) | ||
- An immutable [`SpanContext`](#SpanContext) that uniquely identifies the | ||
`Span` | ||
- A parent span in the form of a [`Span`](#Span), [`SpanContext`](#SpanContext), | ||
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 commentThe 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 commentThe 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 commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
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.
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 commentThe 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'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 commentThe 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 commentThe 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 commentThe 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. |
||
- A list of [`Link`s](#AddLink) | ||
- A list of [`Event`s](#AddEvent) | ||
- A list of [`Link`s](#AddLink) to other `Span`s | ||
- A list of timestamped [`Event`s](#AddEvent) | ||
|
||
The `Span`'s start and end timestamps reflect the elapsed real time of the | ||
operation. A `Span`'s start time SHOULD be set to the current time on [span | ||
|
@@ -261,6 +263,13 @@ 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 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 commentThe 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 commentThe 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 |
||
- 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 commentThe 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 commentThe 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). |
||
|
||
The `Tracer` MUST allow the caller to specify the new `Span`'s parent in the | ||
form of a `Span` or `SpanContext`. The `Tracer` SHOULD create each new `Span` as | ||
a child of its active `Span` unless an explicit parent is provided. | ||
c24t marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
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! 👍