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

Clarify event timestamp origin and range #839

Merged

Conversation

arminru
Copy link
Member

@arminru arminru commented Aug 20, 2020

Resolves #798

@arminru arminru requested a review from a team as a code owner August 20, 2020 11:23
@arminru arminru requested a review from a team August 20, 2020 11:23
@arminru arminru requested a review from a team as a code owner August 20, 2020 11:23
Copy link
Member

@Oberon00 Oberon00 left a comment

Choose a reason for hiding this comment

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

I think we should also add a recommendation for API users to not use custom timestamps unless required.

CHANGELOG.md Outdated Show resolved Hide resolved
specification/trace/api.md Outdated Show resolved Hide resolved
Co-authored-by: Christian Neumüller <christian.neumueller@dynatrace.com>
@arminru
Copy link
Member Author

arminru commented Aug 20, 2020

@Oberon00

I think we should also add a recommendation for API users to not use custom timestamps unless required.

I would've expected this to be added as part of #796/#824 but apparently this was overlooked so I'll add it here.

@arminru arminru changed the title Document that event timestamps might be out of range Clarify event timestamp origin and range Aug 20, 2020
@arminru arminru requested a review from anuraaga August 20, 2020 11:55
@carlosalberto carlosalberto added spec:trace Related to the specification/trace directory area:api Cross language API specification issue labels Aug 20, 2020
specification/trace/api.md Outdated Show resolved Hide resolved
specification/trace/api.md Outdated Show resolved Hide resolved
specification/trace/api.md Outdated Show resolved Hide resolved
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.
Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member

@tigrannajaryan tigrannajaryan left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@bogdandrutu bogdandrutu left a comment

Choose a reason for hiding this comment

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

This PR makes timestamp required which should not be

@@ -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
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

@bogdandrutu bogdandrutu Aug 20, 2020

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.

Copy link
Member

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

Copy link
Member

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.

Copy link
Member

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.

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

Copy link
Member Author

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 🙂

@bogdandrutu bogdandrutu self-assigned this Aug 20, 2020
Copy link
Member

@Oberon00 Oberon00 left a comment

Choose a reason for hiding this comment

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

LGTM! I think these changes will also be helpful as preparation for resolving #814.

Comment on lines +430 to +433
- Name of the event.
- A timestamp for the event. Either the time at which the event was
added or a custom timestamp provided by the user.
- [`Attributes`](../common/common.md#attributes) further describing the event.
Copy link
Member

Choose a reason for hiding this comment

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

As mentioned before, I think this is an unrelated change and should be made across the entire file if we want.

Copy link
Member Author

Choose a reason for hiding this comment

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

Keeping the wording that the timestamp is an optional property of an event is wrong, however, so dropping the misleading part and opening #850 for consolidating it across the file was the best compromise to move forward IMHO.

This section describes the event itself with its non-optional timestamp and the API definition for adding events below explicitly states the timestamp is optional as a parameter to this API and that it will use the current time as a default if not provided.

We only have these (Required)/(Optional) prefixes for the Events and Links sections here and now only Links are left with it. All the other API definitions don't use this notion anyway so it's not aligned already and this change is not making anything worse. I also don't think the change is unrelated to this PR which is intended to clarify the timestamps origin and range.

Copy link
Member Author

Choose a reason for hiding this comment

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

@bogdandrutu ^^^
I think we should be able to move forward with this PR and sort out the rest on #850.

Copy link
Member Author

Choose a reason for hiding this comment

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

@bogdandrutu ^^^
I think we should be able to move forward with this PR and sort out the rest on #850.

@Oberon00
Copy link
Member

Oberon00 commented Sep 15, 2020

It seems to me that TC members are 2:1 for this PR (plus @arminru is a TC member himself). But maybe this is not important enough to make a vote? @open-telemetry/technical-committee @bogdandrutu either vote whether we should include this PR or decide that @bogdandrutu's opposition is accepted and the PR should be closed.

@bogdandrutu
Copy link
Member

@Oberon00 We are not a democracy :)) so far we decided to respect "no" from any TC members, so we never use votes like that.

I am happy to approve this if @arminru or @Oberon00 promise to go and fix the content for links and TraceProvider to be consistent with this.

@Oberon00
Copy link
Member

Oberon00 commented Sep 17, 2020

So maybe it would be better to fix the consistency (i.e,. do #850) before this PR?

@arminru
Copy link
Member Author

arminru commented Sep 17, 2020

@bogdandrutu I think @Oberon00's comment was primarily intended to indicate this PR is stuck after changes were suggested but despite these comments being addressed in August, no reply was given for more than three weeks and thus blocking the PR.

Sure, that's what I created #850 for and I just assigned it to me.

@bogdandrutu
Copy link
Member

@arminru you have the power, you can merge this :)

@arminru arminru merged commit 708d5df into open-telemetry:master Sep 17, 2020
@arminru arminru deleted the define-timestamp-range branch September 17, 2020 15:12
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:api Cross language API specification issue spec:trace Related to the specification/trace directory
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Define if user-defined timestamp for events must be between span start and end or not
7 participants