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

[Profiling] Adding normalize by time and scale factor on Diff TopN functions page #159394

Merged

Conversation

cauemarcondes
Copy link
Contributor

@cauemarcondes cauemarcondes commented Jun 9, 2023

Relevant changes:

  • Adding Normalize by field on the Diff TopN functions page.
  • Refactoring functions route/pages.
Screenshot 2023-06-09 at 2 34 48 PM Screenshot 2023-06-09 at 2 34 58 PM

@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

Comment on lines +215 to +220
exclusiveCPU:
exclusiveCPU -
(comparisonRow.CountExclusive / comparisonTopNFunctions.TotalCount) * 100,
inclusiveCPU:
inclusiveCPU -
(comparisonRow.CountInclusive / comparisonTopNFunctions.TotalCount) * 100,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Question: I'm not sure if I should scale the CPU values too! @elastic/profiling-ui does anybody know it?

Copy link
Contributor

Choose a reason for hiding this comment

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

My understanding is that scaling the CPU values would require scaling both the numerator and denominator, which would cancel out the scaling factor when dividing. So I don't believe it's necessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

To show my work and prove it to myself also, here's my reasoning:

  • All definitions apply equally to the inclusive and exclusive CPU values.
  • We'll assume inclusive without loss of generality for any CPUn and Totaln.
  • CPU1 is the baseline CPU
  • CPU2 is the comparison CPU
  • Total1 is the baseline total count
  • Total2 is the comparison total count
  • SF1 is the baseline scaling factor
  • SF2 is the comparison scaling factor

Without scaling

CPUdiff = 100 * (CPU1 / Total1) - 100 * (CPU2 / Total2)

or

CPUdiff = 100 * [(CPU1 / Total1) - (CPU2 / Total2)]

With scaling

CPUdiff = 100 * [(SF1* CPU1) / (SF1 * Total1)] - 100 * [(SF2 * CPU2) / (SF2 * Total2)]

or this after cancellation:

CPUdiff = 100 * (CPU1 / Total1) - 100 * (CPU2 / Total2)

which is the same as without scaling.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TIL
wow, great explanation! thank you! 🤓

@cauemarcondes cauemarcondes changed the title [Profiling] Adding normalisation by time and scale factor on Diff TopN functions page [Profiling] Adding normalize by time and scale factor on Diff TopN functions page Jun 12, 2023
@cauemarcondes
Copy link
Contributor Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
profiling 152 154 +2

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
profiling 288.6KB 290.4KB +1.8KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
profiling 14.7KB 14.4KB -292.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
securitySolution 410 414 +4
total +6

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
securitySolution 491 495 +4
total +6

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@jbcrail jbcrail left a comment

Choose a reason for hiding this comment

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

Looks good to me.

I answered your question about whether we need to scale the CPU values.

Comment on lines +215 to +220
exclusiveCPU:
exclusiveCPU -
(comparisonRow.CountExclusive / comparisonTopNFunctions.TotalCount) * 100,
inclusiveCPU:
inclusiveCPU -
(comparisonRow.CountInclusive / comparisonTopNFunctions.TotalCount) * 100,
Copy link
Contributor

Choose a reason for hiding this comment

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

My understanding is that scaling the CPU values would require scaling both the numerator and denominator, which would cancel out the scaling factor when dividing. So I don't believe it's necessary.

Comment on lines +215 to +220
exclusiveCPU:
exclusiveCPU -
(comparisonRow.CountExclusive / comparisonTopNFunctions.TotalCount) * 100,
inclusiveCPU:
inclusiveCPU -
(comparisonRow.CountInclusive / comparisonTopNFunctions.TotalCount) * 100,
Copy link
Contributor

Choose a reason for hiding this comment

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

To show my work and prove it to myself also, here's my reasoning:

  • All definitions apply equally to the inclusive and exclusive CPU values.
  • We'll assume inclusive without loss of generality for any CPUn and Totaln.
  • CPU1 is the baseline CPU
  • CPU2 is the comparison CPU
  • Total1 is the baseline total count
  • Total2 is the comparison total count
  • SF1 is the baseline scaling factor
  • SF2 is the comparison scaling factor

Without scaling

CPUdiff = 100 * (CPU1 / Total1) - 100 * (CPU2 / Total2)

or

CPUdiff = 100 * [(CPU1 / Total1) - (CPU2 / Total2)]

With scaling

CPUdiff = 100 * [(SF1* CPU1) / (SF1 * Total1)] - 100 * [(SF2 * CPU2) / (SF2 * Total2)]

or this after cancellation:

CPUdiff = 100 * (CPU1 / Total1) - 100 * (CPU2 / Total2)

which is the same as without scaling.

@cauemarcondes cauemarcondes merged commit c6bca36 into elastic:main Jun 14, 2023
17 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jun 14, 2023
@cauemarcondes cauemarcondes deleted the profiling-functions-normalize-by branch June 14, 2023 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:enhancement v8.9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants