Skip to content

log: increase precision in log's timestamp to nanoseconds #9985

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lecaros
Copy link
Contributor

@lecaros lecaros commented Feb 21, 2025

Adds nanoseconds precision to the logs Fluent Bit writes.

It's possible in some cases that the underlying implementation of the time functions won't provide nanoseconds precision. In those cases, the precision will be to microseconds, which is still better than to the second. (see here)

Addresses #9983


Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

@lecaros
Copy link
Contributor Author

lecaros commented Feb 28, 2025

ping @edsiper

@lecaros
Copy link
Contributor Author

lecaros commented Mar 17, 2025

ping @edsiper @pwhelan
This could be considered a breaking change. We're on time to add it to 4.0

@pwhelan
Copy link
Contributor

pwhelan commented Mar 26, 2025

I feel v4.0 is a reasonable time to make it the default, the risk should be minor. @edsiper How do you feel about it?

@edsiper
Copy link
Member

edsiper commented Mar 26, 2025

@lecaros @pwhelan wondering if this implies a higher CPU usage, is there a way you can provide some perf changes ?

@lecaros
Copy link
Contributor Author

lecaros commented May 15, 2025

Thanks @edsiper. Done.
And thanks @leonardo-albertovich for the reviews

@leonardo-albertovich
Copy link
Collaborator

Just one more comment because this popped in my notifications. Are we going to fix the inconsistency in flb_time_get or not?

I think it should be done in this PR in order to ensure that we have the same behavior in all platforms, otherwise the format string which prints seconds.nanoseconds (which might already be misleading) will show seconds.microseconds in macos but the user wouldn't be aware of it.

If you need help with the patch let me know @lecaros.

@edsiper edsiper added this to the Fluent bit v4.0.3 milestone May 20, 2025
@edsiper
Copy link
Member

edsiper commented May 20, 2025

@leonardo-albertovich I recommend triaging that potential issue in a separate PR (so both can make the cut for 4.0.3)

@leonardo-albertovich
Copy link
Collaborator

I think that'd be quite cumbersome because it means this PR which depends on that would have to wait and get rebased.

Is there a specific reason to do so?

@edsiper
Copy link
Member

edsiper commented May 29, 2025

moving to next milestone due to code conflict and resolution

@lecaros
Copy link
Contributor Author

lecaros commented May 29, 2025

code conflict resolved. @edsiper

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

Successfully merging this pull request may close these issues.

4 participants