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

Fluent::EventTime is serialized as String for JSON #897

Closed
tagomoris opened this issue Apr 13, 2016 · 3 comments
Closed

Fluent::EventTime is serialized as String for JSON #897

tagomoris opened this issue Apr 13, 2016 · 3 comments
Labels
bug Something isn't working v0.14

Comments

@tagomoris
Copy link
Member

["tag", Fluent::EventTime.now, {"key" => "value"}].to_json #=> '["tag","1460544188",{"key":"value"}]'

This may cause some problems in output plugins.

@tagomoris tagomoris added bug Something isn't working v0.14 labels Apr 13, 2016
@kawanet
Copy link
Contributor

kawanet commented Apr 13, 2016

I guess there are a reason that the nano precision second needs to be serialized as a string to keep its accuracy. It looks, however, it even looses the micro precision, by the way. I mean the bug of "1460544188" is the number of digits after the missing decimal point.

@tagomoris
Copy link
Member Author

Getting as much accuracy as possible is optional API for EventTime. It behaves as integer for many operations, and provides sub-second value if requested.
I think we should keep this dogma in JSON serialization too.

@kawanet
Copy link
Contributor

kawanet commented Apr 14, 2016

You mean it should be an Integer but not a Float nor String. I see.


By the way, just as a digression, I found that JSON spec does not define the specific precision for its number representation. It could deliver Quadruple (128bit) or other extended precision (such as 80bit). Most of JSON parsers would crop it as Double (64bit), however.

JSON

tagomoris added a commit that referenced this issue Apr 21, 2016
Serialize Fluent::EventTime as Integer in JSON. fixes #897
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v0.14
Projects
None yet
Development

No branches or pull requests

2 participants