Skip to content

Introduced ResourceObservers when sampling the threads. Extracted metrics calculation#31

Open
stevanbz wants to merge 5 commits into
opensearch-project:mainfrom
stevanbz:feature/observer-intro
Open

Introduced ResourceObservers when sampling the threads. Extracted metrics calculation#31
stevanbz wants to merge 5 commits into
opensearch-project:mainfrom
stevanbz:feature/observer-intro

Conversation

@stevanbz
Copy link
Copy Markdown

@stevanbz stevanbz commented Jun 1, 2023

Is your feature request related to a problem? Please provide an existing Issue # , or describe.
Extracted logic for taking the threads sample.

Describe the solution you are proposing
Observer is newly introduced component that is responsible for getting the thread metrics details. The component can be used to get:

  • specific category metrics for all threads
  • specific category metrics per thread
  • specific category metric for the given thread id

Also, metric calculation logic is extracted in static method that are grouped in a different classes depending the metric category:

  • CPUMetricsCalculator
  • DiskIOMetricsCalculator
  • SchedMetricsCalculator

The idea behind this change is to create a re-usable units of the code that will have single responsibility - just to calculate the metrics value based on the provided params.Now, ThreadCPU, ThreadDiskIO and ThreadSched classes are only responsible for:

  • getting the thread resources data by calling the adequate observer
  • calculating the derived metrics by calling the adequate calculator

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

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.

…rics calculation.

Signed-off-by: Stevan Buzejic <buzejic.stevan@gmail.com>
stevanbz added 4 commits June 6, 2023 21:24
Signed-off-by: Stevan Buzejic <buzejic.stevan@gmail.com>
Signed-off-by: Stevan Buzejic <buzejic.stevan@gmail.com>
Signed-off-by: Stevan Buzejic <buzejic.stevan@gmail.com>
Signed-off-by: Stevan Buzejic <buzejic.stevan@gmail.com>
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.

1 participant