-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Stackdriver sort order #5385
Stackdriver sort order #5385
Conversation
@Legogris This isn't a full fix for the issue, but I think it should help. Do you think you could try it out and see if you run into any major problem? Here are some packages: |
Awesome @danielnelson, will try it out :) |
@danielnelson Been running it for a bit, no issues so far. Once this is included in a release we will be able to roll it out to production and see how it behaves there. Really appreciate the quick patch, thanks! We do have an interval of 30s so if we see issues after this we will look into increasing it to 60s or using |
for i := len(metrics) - 1; i >= 0; i-- { | ||
batch = append(batch, metrics[i]) | ||
} | ||
sort.Slice(batch, func(i, j int) bool { |
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.
Why not just sort.Slice(metrics, ...
, instead of duplicating it into batch
?
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.
That's a good question, the reason is that outputs are not allowed to modify the batch because if an error occurs the metrics will not be restored to the metric buffer correctly. This is an unfortunate aspect of the output interface, it does save a copy of the buffer but it might be worth the copy to prevent misuse.
(cherry picked from commit 7f54ae1)
This change attempts to mitigate #5364 by sorting the batch, but doesn't solve the issue. Remaining issues are documented in the README and some errors are ignored, resulting in some points being dropped, but attempting to keep the output from becoming stuck.
related #5364
Required for all PRs: