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

text_serializer is still not 100% locale indenpendent. PFA patch with the fix #509

Closed
ashish-250 opened this issue Aug 17, 2021 · 1 comment · Fixed by #517
Closed

text_serializer is still not 100% locale indenpendent. PFA patch with the fix #509

ashish-250 opened this issue Aug 17, 2021 · 1 comment · Fixed by #517

Comments

@ashish-250
Copy link
Contributor

text_serializer.cc-> Serialize api is still not fully locale independent even after temporarily switching the locale config of the ostream. The double values still react to the global locale settings as the library is using std::snprintf to convert double to char array before writing it to the ostream. this method call is not affected by what locale is set to be used by ostream. I have attached a diff which achieves same formatting of double as snprintf's "%.*g", std::numeric_limits::max_digits10 - 1
Please find the attached patch that we used for this fix: locale-0.12.3.patch.zip

@gjasny
Copy link
Collaborator

gjasny commented Sep 9, 2021

Thank you for the fix!

ns-codereview pushed a commit to couchbase/tlm that referenced this issue Aug 1, 2023
- Prints integer counter values without trailing '.000000', saving
  ~10% network bandwidth for integer counter metrics
  (jupp0r/prometheus-cpp#509).

Change-Id: I76465d12fe4cac5a1ade528925665805fe7a916b
Reviewed-on: https://review.couchbase.org/c/tlm/+/191668
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Chris Hillery <ceej@couchbase.com>
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 a pull request may close this issue.

2 participants