Skip to content

Explicitly aggregate counts within a context in MetricRecorder#34

Open
kcnolan7 wants to merge 1 commit intoawslabs:masterfrom
kcnolan7:master
Open

Explicitly aggregate counts within a context in MetricRecorder#34
kcnolan7 wants to merge 1 commit intoawslabs:masterfrom
kcnolan7:master

Conversation

@kcnolan7
Copy link
Copy Markdown

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.

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.
* @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);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants