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

Refactored metrics to make them more generic #1675

Merged
merged 6 commits into from
Jun 6, 2024
Merged

Conversation

chernser
Copy link
Contributor

@chernser chernser commented Jun 6, 2024

Summary

Previously there was server stats as primitive field. It was done to reduce memory footprint. But as any early optimization it cause need to make some changes. So metrics became a map of different values and anyone may read them all from operation in a simple over-map-entries loop.

@chernser chernser requested a review from mzitnik June 6, 2024 05:38
System.out.println("Server read rows: " + metrics.getMetric(ServerMetrics.NUM_ROWS_READ).getLong());
System.out.println("Client stats: " + metrics.getMetric(ClientMetrics.OP_DURATION).getLong());

Assert.assertEquals(metrics.getMetric(ServerMetrics.NUM_ROWS_READ).getLong(), rowsToInsert); // 10 rows in the table
Copy link
Contributor

Choose a reason for hiding this comment

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

We discuss to have getter methods (explicit) in this case, i need metrics.getMetric(ServerMetrics.NUM_ROWS_READ).getLong()) why not just metric.getNumRowsRead() return long

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are going to be many metrics over time. Getting only few of them is not a major usecase.
I think users will have list of metrics what they want to publish to some metrics storage - so such getter is more useful than getter for each metric.

@chernser chernser merged commit 21af845 into main Jun 6, 2024
58 checks passed
@chernser chernser deleted the feat_generic_metrics branch June 6, 2024 20:17
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