-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Marshal heartbeat duration as int64,string to prevent int64 -> float conversion #34280
Marshal heartbeat duration as int64,string to prevent int64 -> float conversion #34280
Conversation
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
1b36644
to
8acb07a
Compare
@@ -60,7 +60,7 @@ type State struct { | |||
ID string `json:"id"` | |||
// StartedAt is the start time of the state, should be the same for a given state ID | |||
StartedAt time.Time `json:"started_at"` | |||
DurationMs int64 `json:"duration_ms"` | |||
DurationMs int64 `json:"duration_ms,string"` |
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.
Adding this modifier seems easier than changing the struct to a map representation
Pinging @elastic/uptime (Team:Uptime) |
What does ES return as the number gets larger here? A number in scientific notation, or just the full number? I know we don't test ES itself in our tests here. Have you manually tested this with ES yet? I was certain I fixed and tested this in my last PR, but perhaps I missed something when testing it myself. |
@andrewvc, I tested with ES and event source is being sent with duration in scientific notation when it gets large enough. This is an additional step forward, where the field is indexed correctly, but |
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.
LGTM, pending changelog addition
This pull request is now in conflicts. Could you fix it? 🙏
|
3704dbc
to
98ab15d
Compare
…conversion (#34280) * Add test initial state and build tag * Keep int64 precision on marshal * Add changelog
What does this PR do?
Changes marshalling of states duration to string-encoded int64, per recommendation. Fixes #34218.
Why is it important?
When
duration_ms
gets long enough, it starts being marshalled in float format, which is incompatible with int64 type. It then prevents states from being recovered from ES, generating a new one every ~20min.Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.How to test this PR locally