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

fix: Improve timestamp parsing #16806

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

chaudum
Copy link
Contributor

@chaudum chaudum commented Mar 18, 2025

What this PR does / why we need it:

The timestamp parsing is now able to handle scientific notation of floating point string representations correctly.

While integers with more than 10 digits were already handled correctly as nanoseconds, floating point numbers were not.

The timestamp parsing is now able to handle scientific notation of
floating point string representations correctly.

While integers with more than 10 digits were already handled correctly
as nanoseconds, floating point numbers were not.

Signed-off-by: Christian Haudum <[email protected]>
@chaudum chaudum requested a review from a team as a code owner March 18, 2025 11:28
@slim-bean
Copy link
Collaborator

I'm still thinking about this, but I'm really reluctant to accept a floating point number as a timestamp because I believe it's impossible to accurately represent a nanosecond timestamp floating point number as a double precision float.

I believe this would could lead a really difficult to troubleshoot scenario where folks are expecting log lines to be returned in a result but they are missing (or more lines are returned) because the floating point representation lacks enough precision to be accurate to the nanosecond level.

@chaudum
Copy link
Contributor Author

chaudum commented Mar 18, 2025

I'm still thinking about this, but I'm really reluctant to accept a floating point number as a timestamp because I believe it's impossible to accurately represent a nanosecond timestamp floating point number as a double precision float.

I believe this would could lead a really difficult to troubleshoot scenario where folks are expecting log lines to be returned in a result but they are missing (or more lines are returned) because the floating point representation lacks enough precision to be accurate to the nanosecond level.

Do you mean we should only allow second precision timestamp as floats or not floats at all?

I find the way that floats work differently than integers really confusing.

I'm totally up for disallowing floats completely.

@trevorwhitney
Copy link
Collaborator

I would vote we either

  • disallow all floats
  • only allow floats for second precision timestamps

I think we historically have the latter for prometehus compatibility, so it will be a breaking change to disallow allow all floats.

I don't think it's a good idea to allow nansecond precision using floats.

@trevorwhitney
Copy link
Collaborator

Follow up, what tooling is wanting to send floats with nanosecond precision? It seems like this is very niche?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants