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

how can i set precision when influx.Write()? #23

Closed
mouyong opened this issue Jun 30, 2019 · 4 comments
Closed

how can i set precision when influx.Write()? #23

mouyong opened this issue Jun 30, 2019 · 4 comments
Assignees

Comments

@mouyong
Copy link

mouyong commented Jun 30, 2019

No description provided.

@docmerlin
Copy link
Contributor

Thanks for brining this up, but I don't think it needs to be set.be set for the client. The precision field is the time units that the time is in, not some sort of unit truncation (because some clients may have time as a unix seconds epoc or ms epic or something else. Because the client accept a time.Time, we can just always use nanosecond units for the transmission. If you want to store at a lower precision the way to do it would be to Round or Truncate the time.Times in the Metric.

@docmerlin
Copy link
Contributor

If what I said is understandable, I can go ahead and close the issue. If not, I can explain further.

@mouyong
Copy link
Author

mouyong commented Jul 9, 2019

What does Round or Truncate mean? What should I do with time. Time? I don't quite understand. It means I don't need to set the accuracy. Is it okay to use time. Time directly?

@docmerlin
Copy link
Contributor

What does Round or Truncate mean?

If you want to reduce the precision of the measurement... if you want it to show seconds instead of nanoseconds, just use Time.Round or time.Truncate on whatever time.Time you use, directly.
You don't have to do this though, you don't need to set precision.

I don't quite understand. It means I don't need to set the accuracy. Is it okay to use time. Time directly?
yes.

-i'm going to go ahead and close this issue. Feel free to ask any more questions if you have them.

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

Successfully merging a pull request may close this issue.

3 participants