-
Notifications
You must be signed in to change notification settings - Fork 37
Split a metric when there're more than 100 data points #74
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
Conversation
} | ||
|
||
@Test | ||
public void testSerializeMetricsWith101DataPoints() throws JsonProcessingException { |
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.
The main purpose of this test is just to verify that splitting doesn't impact other metric data points added to the context?
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.
Yes. It also tests that the other metrics should also be included in the first event if there're less than 100 metrics for the first event.
metrics.put(metric.getName(), metric); | ||
count++; | ||
Queue<MetricDefinition> metricDefinitions = | ||
new LinkedList<>(rootNode.metrics().values()); |
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.
- My personal preference here is to not use the abstract interface for your local variable. The concrete type (LinkedList) won't be changing and there's not much of a need to limit yourself to only the interface. This is just a style comment not a perf comment (dynamic dispatch won't be necessary in this context) so YMMV.
- This constructor forces enumeration of the set and allocation of a new list. Is this really necessary? It shouldn't be a significant issue, just something to think about.
Queue<MetricDefinition> metricDefinitions = | ||
new LinkedList<>(rootNode.metrics().values()); | ||
while (metricDefinitions.size() > 0) { | ||
MetricDefinition metric = metricDefinitions.peek(); |
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.
Do we need peek()
if we're going to poll()
regardless? Can we just poll()
here?
Build was throttled by DockerHub rate limit (still need to migrate images over to ECR). Build succeeded on retry. |
Issue #, if available:
Metric Value List can go above MetricDefinition limits, causing CW missing metrics
Description of changes:
Split a metric into multiple log events if the metric has more than 100 data points
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.