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

Add dynamic labels to the wall profiler #73

Merged
merged 2 commits into from
May 29, 2024

Conversation

simonswine
Copy link
Collaborator

@simonswine simonswine commented May 23, 2024

This PR add dynamic labels to the wall profiler. This includes a wrapper for ensuring labels are set while a function executed.

I have also extended the test to measure how this feature works on a real profile.

@simonswine simonswine force-pushed the 20240522_use-tag-wrapper-for-wall branch from 8000fed to 335d3f4 Compare May 23, 2024 12:57
@simonswine simonswine changed the title WIP: Work on dynamic tags Add dynamic labels to the wall profiler May 23, 2024
@simonswine simonswine force-pushed the 20240522_use-tag-wrapper-for-wall branch from 335d3f4 to c44b155 Compare May 23, 2024 12:59
@simonswine simonswine marked this pull request as ready for review May 23, 2024 13:00
This adds dyanmic labels for wall profiling.
@simonswine simonswine force-pushed the 20240522_use-tag-wrapper-for-wall branch from c44b155 to ee134da Compare May 24, 2024 17:43
@simonswine simonswine requested a review from a team as a code owner May 24, 2024 17:43
Copy link
Contributor

@bryanhuhta bryanhuhta left a comment

Choose a reason for hiding this comment

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

LGTM

...oldLabels,
...lbls,
})
;(fn as AnyWrappedCallback)(...args)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this semicolon necessary?

Suggested change
;(fn as AnyWrappedCallback)(...args)
(fn as AnyWrappedCallback)(...args)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think so, don't ask me why though

image

Copy link
Collaborator

@grafakus grafakus May 29, 2024

Choose a reason for hiding this comment

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

Yes it is; it separates the statements.

If not, the JS engine tries to use the return value of setLabels as a function that will receive the fn parameter.

Adding or not semicolons at the end of each line of JS code can be debated.
But for sure, not having them can create this confusion. Maybe we should configure Prettier to format the code automatically (in a future PR).

test/profiler.test.ts Outdated Show resolved Hide resolved
@simonswine simonswine merged commit fb58341 into grafana:main May 29, 2024
5 checks passed
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