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

StatsCollector, Aggregators, MetricsConfiguration move #6

Merged
merged 5 commits into from
May 15, 2023

Conversation

Tjofil
Copy link
Contributor

@Tjofil Tjofil commented May 12, 2023

#2

This PR focuses on extracting three major components/component groups:

  • MetricsConfiguration is a wrapper class around map that serves as configuration registry for all the collectors, both ones stored in PA and ones stored in PA-RCA repo. We don't do any initialization of the map entries from commons as that would require the class to know about collectors, which introduces dependencies from the two repos. Instead, we already have an initialization of this map from PA side which is done upon plugin class load, and the current initialization from inside class is going to be replaced with a symmetrical one that happens on PerformanceAnalyzerApp class load.

  • SampleAggregators used to live as PerformanceAnalyzerApp's static fields and Writer has to reach for this class in order to write to aggregators. We extract them in this PR, alongside StatsReporter by whom they are consumed, to a class called CommonStats which is visible to both PA and PA-RCA repo and thus eliminating PA's need to know about the PA app class. They're still going to be initialized from PA-RCA code but used by both repos.

  • StatsCollector and everything necessary for it's functioning has also been moved to the repo, no changes were done to these classes. Note that PA and PA-RCA have their own tests for different use cases of StatsCollector and these tests will remain inside their respective repos.

Besides these extractions there is also a fix for Lychee link checker and tests for classes that had them inside their original repos.

There's also been a change to packages, generally small moves and flattening of the hierarchy and removal of rca subpackage as it was misleading in most of the cases.

After this I'll publish two branches, one for PA and second for PA-RCA and make the changes to account for moving of the MetricsConfiguration, aggregators and StatsCollector so we can incrementally change the repos and make sure everything keeps working from their point of view.

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Tjofil added 4 commits May 11, 2023 22:15
- Moved in SampleAggregator singletons and their dependencies
- Moved in StatReporter and its dependencies.
- Created CommonsStats class to host aggregators and reporter for all repos.
- Moved in MetricsConfiguration to be used by all repos.

Fixed Lychee linker error with empty excludes file

Signed-off-by: Filip Drobnjakovic <drobnjakovicfilip@gmail.com>
Signed-off-by: Filip Drobnjakovic <drobnjakovicfilip@gmail.com>
…liary classes.

Signed-off-by: Filip Drobnjakovic <drobnjakovicfilip@gmail.com>
Signed-off-by: Filip Drobnjakovic <drobnjakovicfilip@gmail.com>
Comment on lines 8 to 9
/* Catalogue class that is to be populated upon PerformanceAnalyzerApp class load
and to be used by both PA and PA-RCA as well as commons repo.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we update the comment as :

" Catalog Operational Metrics class that is to be populated upon PerformanceAnalyzerApp class load and to be used by both PA and PA-RCA. "

One other question, is this class used at runtime by the commons repo ?

Copy link
Contributor Author

@Tjofil Tjofil May 15, 2023

Choose a reason for hiding this comment

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

There is commons code that is accessing the class, yes, for example StatsCollector code. In terms of runtime and chronological access those references are going to happen from both PA and PA-RCA side. Let me know if there are any concerns.

@khushbr
Copy link
Collaborator

khushbr commented May 15, 2023

Thank you for making the changes @Tjofil. One high level comment I have is around naming of the sub-directories:

Would it make sense to:

  1. Rename collectors -> statcollector as it logically is a single piece for collecting operations stats.
  2. format -> formatter
  3. Move src/main/java/org/opensearch/performanceanalyzer/commons/stats/impl/vals/AggregateValue.java to 1 level up -> src/main/java/org/opensearch/performanceanalyzer/commons/stats/vals/AggregateValue.java

@Tjofil
Copy link
Contributor Author

Tjofil commented May 15, 2023

@khushbr
With 2nd and 3rd I completely agree.
Besides StatsCollector we also have PerformanceAnalyzerMetricsCollector and Version classes inside collectors that are to be used by all collectors, we can only move the StatsCollector out if that's what we want but to me this current setup seems fine as other collectors will also live in the collectors package.

Signed-off-by: Filip Drobnjakovic <drobnjakovicfilip@gmail.com>
@khushbr
Copy link
Collaborator

khushbr commented May 15, 2023

@khushbr With 2nd and 3rd I completely agree. Besides StatsCollector we also have PerformanceAnalyzerMetricsCollector and Version classes inside collectors that are to be used by all collectors, we can only move the StatsCollector out if that's what we want but to me this current setup seems fine as other collectors will also live in the collectors package.

This sounds good to me, let us retain the name of repo as collectors

Copy link
Collaborator

@khushbr khushbr left a comment

Choose a reason for hiding this comment

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

LGTM! Ship it!

@khushbr khushbr merged commit c684ece into opensearch-project:main May 15, 2023
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.

3 participants