Explicitly aggregate counts within a context in MetricRecorder#34
Open
kcnolan7 wants to merge 1 commit intoawslabs:masterfrom
Open
Explicitly aggregate counts within a context in MetricRecorder#34kcnolan7 wants to merge 1 commit intoawslabs:masterfrom
kcnolan7 wants to merge 1 commit intoawslabs:masterfrom
Conversation
While the javadocs previously indicated that Counts were to be explicitly aggregated values (where only the total at the end of a context had any meaning), it was left up to MetricRecorder implementations to get this right. This change enforces the contract from the javadoc by handling the aggregation of counts in the abstract MetricRecorder class.
dainstber
suggested changes
Sep 19, 2018
| * @param context the context the value belongs in. | ||
| */ | ||
| protected abstract void count(Metric label, long delta, R context); | ||
| protected abstract void count(Metric label, long value, R context); |
Contributor
There was a problem hiding this comment.
Is this api needed anymore?
This is just convenience method to call record without a timestamp and unit. If you want to keep this, we should update the javadoc to reflect that. I am not convinced it is necessary though.
|
|
||
| @Override | ||
| public void close() { | ||
| counts.forEach((key, value) -> MetricRecorder.this.count(key, value, context)); |
Contributor
There was a problem hiding this comment.
Shouldn't these metrics have the same timestamp?
If so we should also assert that in the tests.
| * Changes to the count are not timestamped as only the total value of all | ||
| * counts for a metric have any meaning. If the individual change needs to | ||
| * be tracked, it should be recorded as a gauged event. | ||
| * Changes to the count are timestamped with the time of context closure, |
Contributor
There was a problem hiding this comment.
I think this comment is a little confusing. Only the final value for the count is recorded. So the changes are not timestamped at all.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While the javadocs previously indicated that Counts were to be explicitly aggregated values (where only the total at the end of a context had any meaning), it was left up to MetricRecorder implementations to get this right. This change enforces the contract from the javadoc by handling the aggregation of counts in the abstract MetricRecorder class.