Skip to content

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

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

stevanbz
Copy link

@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.

stevanbz added 4 commits June 6, 2023 21:24
Signed-off-by: Stevan Buzejic <[email protected]>
Signed-off-by: Stevan Buzejic <[email protected]>
Signed-off-by: Stevan Buzejic <[email protected]>
Signed-off-by: Stevan Buzejic <[email protected]>
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