Skip to content
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

feat: Improve the metric set implementation. #77

Merged
merged 3 commits into from
Jan 13, 2024
Merged

feat: Improve the metric set implementation. #77

merged 3 commits into from
Jan 13, 2024

Conversation

jetuk
Copy link
Member

@jetuk jetuk commented Dec 11, 2023

This now includes nested aggregation, hooking up the metric sets to the model and use by the CSV recorder.

There's still some WIP but a general review would be good at this point.

This now includes nested aggregation, hooking up the metric
sets to the model and use by the CSV recorder.

There's still some WIP but a general review would be good
at this point.
@jetuk jetuk requested a review from Batch21 December 11, 2023 16:32
Copy link
Contributor

@Batch21 Batch21 left a comment

Choose a reason for hiding this comment

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

Given this a good read through. I like the aggregation approach and it looks like it works correctly.

mut states,
mut parameter_internal_states,
mut metric_set_internal_states,
mut recorder_internal_states,
Copy link
Contributor

Choose a reason for hiding this comment

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

Might simplify things to combine the states into a single object, if this is feasible?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, this is something that needs doing. I was planning to tidy it up after this PR

@@ -42,14 +42,10 @@ impl AggregationPeriod {
while current_date < end_date {
// This should be safe to unwrap as it will always create a valid date unless
// we are at the limit of dates that are representable.
Copy link
Contributor

Choose a reason for hiding this comment

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

by the time crate?

Copy link
Member Author

@jetuk jetuk Jan 3, 2024

Choose a reason for hiding this comment

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

This comment is old and should be moved to the start_of_next_period function.

/// Compute the final aggregation value from the current state.
///
/// This will also compute the final aggregation value from the child aggregators if any exists.
/// This includes aggregation calculations over partial or unfinished periods.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be a user setting?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it could be.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll add this as a new issue for the sake of getting this PR done.

///
/// A metric set can optionally have an aggregator, which will apply an aggregation function
/// over metrics set. If the aggregator has a defined frequency then the aggregation will result
/// in multiple values (i.e. per each period implied by the frequency).
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be good to have a doc text model here that shows how the nest aggregation works

Copy link
Member Author

Choose a reason for hiding this comment

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

I wonder if this would be better as an extended section in the proposed book? I am tempted to leave it for now, but then also need to ensure we write that documentation.

@jetuk
Copy link
Member Author

jetuk commented Jan 13, 2024

I've fixed the out-of-date comment. This could be merged now, or we can address wider documentation issue first (at the expense of delaying the merge).

@jetuk jetuk merged commit e343806 into main Jan 13, 2024
2 checks passed
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