Expect metric only as a generic argument in logical meter formulas#31
Open
shsms wants to merge 4 commits intofrequenz-floss:v0.x.xfrom
Open
Expect metric only as a generic argument in logical meter formulas#31shsms wants to merge 4 commits intofrequenz-floss:v0.x.xfrom
shsms wants to merge 4 commits intofrequenz-floss:v0.x.xfrom
Conversation
Collaborator
Author
|
Based on #30 |
3452bcf to
5cb4143
Compare
a0ef4ad to
66250da
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the logical meter API to treat the selected metric purely as a type-level choice (generic parameter) rather than a runtime value, and refactors formula plumbing accordingly.
Changes:
- Updated
LogicalMeterHandleformula streaming methods to take the metric via a generic type argument (removing the metric value parameter). - Refactored formula construction to stop carrying metric instances (using
PhantomDataand associated constants instead). - Updated tests, examples, and release notes to match the new call syntax.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/metric.rs |
Adjusts the Metric trait and metric definitions to support type-only usage (adds str_name(), removes Display impls). |
src/logical_meter/logical_meter_handle.rs |
Changes public handle methods to use metric as a generic argument and updates call sites in tests. |
src/logical_meter/formula/graph_formula_provider.rs |
Removes runtime metric parameters from graph formula provider APIs; updates error message formatting. |
src/logical_meter/formula/coalesce_formula.rs |
Removes stored metric value from formula structs and uses PhantomData. |
src/logical_meter/formula/aggregation_formula.rs |
Removes stored metric value from formula structs and uses PhantomData. |
src/logical_meter/formula.rs |
Updates FormulaParams to no longer store a metric value (uses PhantomData). |
RELEASE_NOTES.md |
Documents the new LogicalMeterHandle call syntax (needs wording + additional breaking-change notes). |
examples/logical_meter.rs |
Updates example usage to the new turbofish syntax. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
66250da to
875ecff
Compare
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
And no-longer as a function parameter. Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
875ecff to
14ee1a9
Compare
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
There is no reason for them to be mutable anymore. Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
de1b3cb to
1404c90
Compare
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.
No description provided.