-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Change all time formatting to UTC and off of time.RFC3339Nano #617
Conversation
c6502d1
to
8ede7d0
Compare
As discussed this would be fixed on the server side so that clients in other languages don't hit the same problem. |
I think using unixtime makes more sense, and greatly reduces the chances we'll hit issues compared to a more human readable format. We're trying to kill off model, so please avoid increasing usage of it. |
I understand the want to reduce model usage bit this clients API is already based on it, so at this point removal of common from this specific client is a significantly larger project. |
I'm not saying to remove existing uses right now, I'm saying let's not add more. |
That change seems entirely pointless to me. At this point there are already 88 occurances of |
Do I understand this correctly that you are in general in favor of this change? @jacksontj: return strconv.FormatFloat(float64(t.UnixNano())/1e9, 'f', -1, 64) There is really no reason to involve any logic from any other Prometheus packages. |
Yes. |
OK, cool. I'd say, let's just use the line I suggested above instead of the |
8ede7d0
to
55954d9
Compare
Prometheus has issues parsing RFC3339Nano timestamps if the year has more than 4 digits, in addition it is the second-pass parse attempt. Since this is a client library and the interface is a `time.Time` it makes sense that we pick the clearest simplest format-- so I propose we use the `model.Time` representation of time in our communications to prometheus. This (1) removes the issues with timezones in those queries going downstream and (2) completely works around this prometheus#614 issue as the parsing mechanism in prometheus can handle those times in this format. Related to prometheus#614 Signed-off-by: Thomas Jackson <[email protected]>
Signed-off-by: Thomas Jackson <[email protected]>
55954d9
to
9b5568b
Compare
@beorn7 PR updated with comments, should be ready for merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jacksontj many thanks.
@krasi-georgiev does this work for you, too?
yep all good. |
Thanks everyone! |
@beorn7 seems that the formatTime function you have me doesn't quite work Doing some local testing this is the output of:
|
Here's the same on go playground: https://play.golang.org/p/qMLQcs_WG2J It seems that going to this unix format has similar formatting issues where it won't go negative properly :/ |
…ingle int64 Signed-off-by: Thomas Jackson <[email protected]> Fixup for prometheus#617
#619 has the fix :) |
Ooof, yeah, of course, because UnixNano is rather limited in its time range. |
Prometheus has issues parsing RFC3339Nano timestamps if the year has more than 4 digits, in addition it is the second-pass parse attempt. Since this is a client library and the interface is a
time.Time
it makes sense that we pick the clearest simplest format-- so I propose we use themodel.Time
representation of time in our communications to prometheus. This (1) removes the issues with timezones in those queries going downstream and (2) completely works around this #614 issue as the parsing mechanism in prometheus can handle those times in this format.Related to #614