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

Migrate IPA code to new metrics engine #1379

Merged
merged 3 commits into from
Oct 29, 2024

Conversation

akoshelev
Copy link
Collaborator

This is the final PR to upgrade IPA to use new metric engine. This change removes the old metric dependency and updates the code to use new metrics.

This approach was tested in #1278 and the only difference here is that we don't consume metrics yet. #1353 will take care of it

Copy link

codecov bot commented Oct 26, 2024

Codecov Report

Attention: Patch coverage is 71.97802% with 51 lines in your changes missing coverage. Please review.

Project coverage is 93.63%. Comparing base (57e2c63) to head (69a9442).
Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
ipa-core/src/bin/helper.rs 5.40% 35 Missing ⚠️
ipa-core/src/cli/metric_collector.rs 50.00% 12 Missing ⚠️
ipa-core/src/helpers/mod.rs 88.00% 3 Missing ⚠️
ipa-core/src/telemetry/step_stats.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1379      +/-   ##
==========================================
+ Coverage   93.54%   93.63%   +0.08%     
==========================================
  Files         222      223       +1     
  Lines       36986    36998      +12     
==========================================
+ Hits        34600    34644      +44     
+ Misses       2386     2354      -32     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

ipa-core/Cargo.toml Outdated Show resolved Hide resolved
@@ -33,84 +31,20 @@ pub mod metrics {
}
}

impl From<RequestProtocolVersion> for KeyName {
impl From<RequestProtocolVersion> for &'static str {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe this should be an as_str method?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

its a little less ergonomic at the callsite, but not too bad

@@ -84,6 +86,16 @@ impl<T> IndexMut<ShardIndex> for Vec<T> {
}
}

impl LabelValue for ShardIndex {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does it makes sense to implement LabelValue for T: Into<u64>? Given the restrictions on overlapping impls, that does seem like it could lead to problems down the line. On the other hand, since this isn't a published API, we can always switch back to the set of impls in this PR if the blanket impl becomes a problem.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yea, overlapping impls was the reason not to. I ran into this problem in an early implementation and it gets very annoying if you need to implement LabelValue a bit differently. Scraping out blanket implementation when you would need that change would probably be less efficient.

Maybe I can provide a macro to implement LabelValue on those types....

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not opposed to a macro, but I also don't think there's a clear justification for one here vs. just live with a little boilerplate.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yea, that is my thinking too - LabelValue does not add too much clutter, but provides explicitness

@akoshelev akoshelev merged commit 933a902 into private-attribution:main Oct 29, 2024
12 of 13 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