-
Notifications
You must be signed in to change notification settings - Fork 888
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
Clarify event timestamp origin and range #839
Merged
arminru
merged 19 commits into
open-telemetry:master
from
dynatrace-oss-contrib:define-timestamp-range
Sep 17, 2020
Merged
Changes from 6 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
bb1e233
Document that event timestamps might be out of range
arminru fcbc5fe
Add to changelog
arminru 8ded9fa
Update specification/trace/api.md
arminru c5ff2f3
Clarify that custom timestamps should only be used when necessary
arminru 8f17b7f
Generalize occasions when timestamps might be out of range
arminru d5ba3bb
Point out that a timestamp is always there but can be overriden by th…
arminru d0f6e62
Remove inconsistent required/optional from property list
arminru 4b44694
Merge branch 'master' into define-timestamp-range
arminru a3122b2
Merge branch 'master' into define-timestamp-range
arminru e3db762
Merge branch 'master' into define-timestamp-range
arminru fbaf199
Merge branch 'master' into define-timestamp-range
arminru bcc1b72
Merge branch 'master' into define-timestamp-range
arminru e329bbe
Merge branch 'master' into define-timestamp-range
arminru 5d779f7
Merge branch 'master' into define-timestamp-range
arminru 62b2dcc
Merge branch 'master' into define-timestamp-range
arminru 9b684c9
Merge branch 'master' into define-timestamp-range
arminru 3461fa2
Merge branch 'master' into define-timestamp-range
arminru 548b655
Merge branch 'master' into define-timestamp-range
arminru 2c45fef
Merge branch 'master' into define-timestamp-range
arminru File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -428,15 +428,20 @@ with the moment when they are added to the `Span`. | |
An `Event` is defined by the following properties: | ||
|
||
- (Required) Name of the event. | ||
- (Required) A timestamp for the event. Either the time at which the event was | ||
added or a custom timestamp provided by the user. | ||
- (Optional) [`Attributes`](../common/common.md#attributes). | ||
- (Optional) Timestamp for the event. If not provided, the current time when the event is added MUST be used. | ||
|
||
The `Event` SHOULD be an immutable type. | ||
|
||
The Span interface MUST provide: | ||
|
||
- An API to record a single `Event` where the `Event` properties are passed as | ||
arguments. This MAY be called `AddEvent`. | ||
This API takes the name of the event, optional `Attributes` and an optional | ||
`Timestamp` which can be used to specify the time at which the event occurred. | ||
If no custom timestamp is provided by the user, the implementation automatically | ||
sets the time at which this API is called on the event. | ||
- An API to record a single `Event` whose attributes or attribute values are | ||
lazily constructed, with the intention of avoiding unnecessary work if an event | ||
is unused. If the language supports overloads then this SHOULD be called | ||
|
@@ -445,8 +450,15 @@ The Span interface MUST provide: | |
wrapping class or function that returns an `Event` or formatted attributes. When | ||
providing a wrapping class or function it SHOULD be named `EventFormatter`. | ||
|
||
Events SHOULD preserve the order in which they're set. This will typically match | ||
the ordering of the events' timestamps. | ||
Events SHOULD preserve the order in which they are recorded. | ||
This will typically match the ordering of the events' timestamps, | ||
but events may be recorded out-of-order using custom timestamps. | ||
|
||
Consumers should be aware that an event's timestamp might be before the start or | ||
after the end of the span if custom timestamps were provided by the user for the | ||
event or when starting or ending the span. | ||
The specification does not require any normalization if provided timestamps are | ||
out of range. | ||
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. 👍 |
||
|
||
Note that the OpenTelemetry project documents certain ["standard event names and | ||
keys"](semantic_conventions/README.md) which have prescribed semantic meanings. | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
What? This is not required.
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.
See #839 (comment).
A timestamp is always there from an exporter's and subsequent consumer's POV. An event is defined by these properties and since it's always there it can be seen as a required part of an event.
I clarified further below that the timestamp passed to
AddEvent
is optional and used to override the timestamp which would otherwise be automatically set by the implementation. There is, however, no case in which there would be no timestamp for an event and therefore it's not optional.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.
The first consumer of the API is not the exporter/vendor is the dev that instruments an app, so I think the specs should be written with that in mind.
Having an optional component with a default value is equivalent for the exporter to be "required".
My concern of calling this required stands, so will not approve this change.
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.
@arminru I agree. This a mandatory property of the Event object. It is an optional parameter of the API call.
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.
@tigrannajaryan sure, but the main consumer of the API is the instrumentation dev, which should not read that it is required to pass a
Timestamp
and as I suggested having an optional field with a default value is equivalent to always present on the consume side.And I am less worried about some vendors not understanding this, than instrumentation dev understanding that timestamp is required.
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.
For end it is clearly stated as optional, for span creation it uses a different wording, and it says required only for the 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.
@arminru please feel free to either align the wording to match the rest of the spec or propose a future PR which possibly goes over all places where we use "optional"/"required" qualifiers and make sure it is uniform.
Perhaps to make it easier to merge this PR you can just drop this particular change, since I believe your other clarifications later in the document regarding timestamp orders, ranges, etc are important and we can merge them.
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.
Strongly encourage to revert that change, and if anyone feels the need to change everywhere the wording then we should do that in a separate PR.
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 removed the (Required)/(Optional) prefix here since both would be confusing because the timestamp is not an optional property of an event but optional as an argument to the API call defined below. I filed #850 for having the notation unified across the whole file.
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 take another look @bogdandrutu 🙂