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

Document the HrTime format #2578

Closed
1 of 2 tasks
qaas opened this issue Nov 1, 2021 · 4 comments · Fixed by #2604
Closed
1 of 2 tasks

Document the HrTime format #2578

qaas opened this issue Nov 1, 2021 · 4 comments · Fixed by #2604
Assignees
Labels
document Documentation-related good first issue Good for newcomers

Comments

@qaas
Copy link

qaas commented Nov 1, 2021

  • This only affects the JavaScript OpenTelemetry library
  • This may affect other libraries, but I would like to get opinions here first

Hi,

I am implementing openteletry for both python and JS. I would like that the docs are expanded on the HrTime format. For example:

export declare type HrTime = [number, number];

What do the first and the 2nd element of the list represent? I can deduct that the first will be Unix epoch time, but what would the 2nd one be representing?

Thank you!

@dyladan
Copy link
Member

dyladan commented Nov 1, 2021

Sorry for this oversight on the docs. I'll make sure it gets corrected.

You are correct that the first number is unix epoch seconds. The second number represents the partial second elapsed since that second in nanoseconds.

For example, the date new Date('2021-12-01T15:40:20.050Z') is represented in unix ms as 1638373220050. This is 163837322 seconds and 050 ms. It would be represented in HrTime format as [1638373220, 50000000] which corresponds to 1638373220 seconds and 50000000 nanoseconds since the epoch.

The reason to use this format instead of the simpler ms since epoch format is to get extremely high resolution times for very short spans.

@qaas
Copy link
Author

qaas commented Nov 2, 2021

Thank you Daniel for your quick reply!
I thought the 2nd param will be time-related too :) but nanoseconds are like quantum physics time resolution :)

Do you want me to close this, as your reply is more than sufficient?

Best regards,
Dragos

@dyladan
Copy link
Member

dyladan commented Nov 2, 2021

No it should be documented so others don't have the same question in the future.

@dyladan dyladan added document Documentation-related up-for-grabs Good for taking. Extra help will be provided by maintainers good first issue Good for newcomers labels Nov 2, 2021
@dyladan dyladan changed the title HrTime documentation Document the HrTime format Nov 2, 2021
@JamesJHPark
Copy link
Contributor

Hi, I would like to work on this issue. Can you please assign me this issue?

@vmarchaud vmarchaud removed the up-for-grabs Good for taking. Extra help will be provided by maintainers label Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
document Documentation-related good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants