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

Add data format section and a description of timestamps #111

Conversation

danielkhan
Copy link
Contributor

@danielkhan danielkhan commented Jun 12, 2019

- Added explanation of representation of times and durations
yurishkuro
yurishkuro previously approved these changes Jun 12, 2019
@yurishkuro yurishkuro dismissed their stale review June 12, 2019 16:03

wrong button

OpenTelemetry stores time values using nanosecond (ns) precision.
To overcome platform limitations, this data is represented as a tuple
[<long> seconds, <int> nanoseconds], where nanoseconds is the remainder that can
not be represented in seconds.
Copy link
Member

Choose a reason for hiding this comment

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

I am not clear which part of OpenTelemetry this paragraph refers to. The API does not "store" anything, and when it accepts timestamps from the user, e.g. as part of SpanData, the representation ideally should be idiomatic to the language. E.g. in Python the time is a float as seconds since epoch, sub-seconds are in the decimals.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@yurishkuro, I looked how the current Java Implementation does it: https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/util/Timestamps

Some platforms use the tuple representation and it's easy to convert back and forth between decimals and tuples. There has to be an API surface to set a timestamp and there we have to decide on how this can be done.

Copy link
Member

Choose a reason for hiding this comment

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

My point is that "how java does it" should not necessarily inform the cross-language spec, and storage representation does not belong in the API spec. Even in Java, I would expect people to use Instant type, not the proto definition you pointed to, which makes it irrelevant to the end user how instant is actually implemented. I would limit this PR to the language about precision only.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed the wording on tuples and I am now just mentioning that the representation is language specific. Does this work for you?

##### Examples:
* Given a Unix timestamp of `1560345793106ms`, the resulting tuple would be
`[1560345793, 106000000]`.
* Given a duration of `500,000376ms`, the resulting tuple would be `[0, 500000376]`.
Copy link
Member

Choose a reason for hiding this comment

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

these examples either not needed, or need to be prefixed with an explanation of tuple representation. I am not sure they are especially useful here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right. Given the previous change, they are obsolete now. I removed them.

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. Like the idea of making it language idiomatic as mentioned by @yurishkuro.

@SergeyKanzhelev SergeyKanzhelev merged commit 48d0771 into open-telemetry:master Jun 13, 2019
SergeyKanzhelev pushed a commit to SergeyKanzhelev/opentelemetry-specification that referenced this pull request Feb 18, 2020
…ry#111)

* Add section on data formats. Fixes open-telemetry#85
- Added explanation of representation of times and durations

* Removed wording on tuples

* Removed examples
@arminru arminru deleted the dkhan-add-timestamp-description branch August 9, 2022 09:48
carlosalberto pushed a commit to carlosalberto/opentelemetry-specification that referenced this pull request Oct 21, 2024
* Added auto resource detection proposal

* Removed resource provider concept as per review comments

* Changed the proposal back to separating resource detection from the tracer/meter providers, clarified default resource detection in more detail, and added more points to the trade-offs & mitigations section

* Wrap lines

Co-authored-by: Sergey Kanzhelev <[email protected]>
carlosalberto pushed a commit to carlosalberto/opentelemetry-specification that referenced this pull request Oct 23, 2024
* Added auto resource detection proposal

* Removed resource provider concept as per review comments

* Changed the proposal back to separating resource detection from the tracer/meter providers, clarified default resource detection in more detail, and added more points to the trade-offs & mitigations section

* Wrap lines

Co-authored-by: Sergey Kanzhelev <[email protected]>
carlosalberto pushed a commit to carlosalberto/opentelemetry-specification that referenced this pull request Oct 31, 2024
…ry#111)

* Add section on data formats. Fixes open-telemetry#85
- Added explanation of representation of times and durations

* Removed wording on tuples

* Removed examples
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.

API: explain what timestamp precision should be
4 participants