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

Support visualizing tags as nodes #558

Closed
nolanmar511 opened this issue Sep 25, 2020 · 1 comment · Fixed by #649
Closed

Support visualizing tags as nodes #558

nolanmar511 opened this issue Sep 25, 2020 · 1 comment · Fixed by #649

Comments

@nolanmar511
Copy link
Contributor

nolanmar511 commented Sep 25, 2020

The pprof CLI has some support for visualizing profiles with tags (the -tags output format allows one to see all tags in the profile, tag filtering allows one to view only or exclude portions of the profile without tags, and the graph view(s) show some tags as nodeletes), but it's not always possible to visualize which tags are associated with which stacks when using pprof.

On a few occasions now, internal users have hacked pprof to show certain tags as nodes at the root of the call stack, so it's something that has been useful. For example, if samples are tagged such that they can be associated with particular chunks of work (for example, work done for a particular URL endpoint), it can be useful to add a pseudo-node for a particular tag toward the root of the call stack to group stacks associated with a particular chunk of work in the flame graph view.

On possibility for doing this would be to introduce the following options to pprof:

  • -tagroot: takes in a comma-separated list of label keys and adds the associated key/value pairs as pseudo-nodes on the stack for samples which have the listed labels. For each sample and label key, if the sample has a label with the specified key, a pseudo-node will be added. Pseudo-nodes will be added at the top of the call stack (closest to the root), with pseudo-node for the label that is first in the list being highest in the callstack and the pseudo-node for the label that is last in the list appearing just before frames in the original profile.
  • -tagleaf: takes in a comma-separated list of label keys and adds the associated labels as pseudo-nodes on the stack. For each sample and label key, if the sample has a label with the specified key, a pseudo-node will be added. Pseudo-nodes will be added at the bottom of the call stack (after leaf nodes), with pseudo-node for the label that is first in the list being the child of what was the leaf in the original profile and the pseudo-node for the label that is last in the list appearing as the new leaf node.

A key-value pair with key “” and value “value” could be represented as a Function with a function name “:”, and a filename of “”.

mhansen added a commit to mhansen/pprof that referenced this issue Sep 22, 2021
These add synthetic stack frames to samples.

Example usage:

$ pprof -tagroot thread pprof.proto

Will add synthetic stack frames at the root like "thread:UIThread" and
"thread:BackgroundPool-1".

Closes google#558
mhansen added a commit to mhansen/pprof that referenced this issue Sep 22, 2021
These add synthetic stack frames to samples.

Example usage:

$ pprof -tagroot thread pprof.proto

Will add synthetic stack frames at the root like "thread:UIThread" and
"thread:BackgroundPool-1".

Closes google#558
mhansen added a commit to mhansen/pprof that referenced this issue Sep 22, 2021
These add synthetic stack frames to samples.

Example usage:

$ pprof -tagroot thread pprof.proto

Will add synthetic stack frames at the root like "thread:UIThread" and
"thread:BackgroundPool-1".

Closes google#558
mhansen added a commit to mhansen/pprof that referenced this issue Sep 22, 2021
These add synthetic stack frames to samples.

Example usage:

$ pprof -tagroot thread pprof.proto

Will add synthetic stack frames at the root like "thread:UIThread" and
"thread:BackgroundPool-1".

Closes google#558
mhansen added a commit to mhansen/pprof that referenced this issue Sep 23, 2021
These add synthetic stack frames to samples.

Example usage:

$ pprof -tagroot thread pprof.proto

Will add synthetic stack frames at the root like "thread:UIThread" and
"thread:BackgroundPool-1".

Closes google#558
mhansen added a commit to mhansen/pprof that referenced this issue Sep 23, 2021
These add synthetic stack frames to samples.

Example usage:

$ pprof -tagroot thread pprof.proto

Will add synthetic stack frames at the root like "thread:UIThread" and
"thread:BackgroundPool-1".

Closes google#558
mhansen added a commit to mhansen/pprof that referenced this issue Sep 23, 2021
These add synthetic stack frames to samples.

Example usage:

$ pprof -tagroot thread pprof.proto

Will add synthetic stack frames at the root like "thread:UIThread" and
"thread:BackgroundPool-1".

Closes google#558
mhansen added a commit to mhansen/pprof that referenced this issue Sep 23, 2021
These add synthetic stack frames to samples.

Example usage:

$ pprof -tagroot thread pprof.proto

Will add synthetic stack frames at the root like "thread:UIThread" and
"thread:BackgroundPool-1".

Closes google#558
@mhansen
Copy link
Contributor

mhansen commented Sep 23, 2021

Turns out @felixge may have already implemented and documented a variant of this: https://github.com/felixge/pprofutils#labelframes. Linking these up as prior art on this issue.

mhansen added a commit to mhansen/pprof that referenced this issue Sep 27, 2021
These add synthetic stack frames to samples.

Example usage:

$ pprof -tagroot thread pprof.proto

Will add synthetic stack frames at the root like "thread:UIThread" and
"thread:BackgroundPool-1".

Closes google#558
mhansen added a commit to mhansen/pprof that referenced this issue Sep 27, 2021
These add synthetic stack frames to samples.

Example usage:

$ pprof -tagroot thread pprof.proto

Will add synthetic stack frames at the root like "thread:UIThread" and
"thread:BackgroundPool-1".

Closes google#558
mhansen added a commit to mhansen/pprof that referenced this issue Sep 27, 2021
These add synthetic stack frames to samples.

Example usage:

$ pprof -tagroot thread pprof.proto

Will add synthetic stack frames at the root like "thread:UIThread" and
"thread:BackgroundPool-1".

Closes google#558
mhansen added a commit to mhansen/pprof that referenced this issue Sep 28, 2021
These add synthetic stack frames to samples.

Example usage:

$ pprof -tagroot thread pprof.proto

Will add synthetic stack frames at the root like "thread:UIThread" and
"thread:BackgroundPool-1".

Closes google#558
mhansen added a commit to mhansen/pprof that referenced this issue Sep 28, 2021
These add synthetic stack frames to samples.

Example usage:

$ pprof -tagroot thread pprof.proto

Will add synthetic stack frames at the root like "thread:UIThread" and
"thread:BackgroundPool-1".

Closes google#558
mhansen added a commit to mhansen/pprof that referenced this issue Sep 28, 2021
These add synthetic stack frames to samples.

Example usage:

$ pprof -tagroot thread pprof.proto

Will add synthetic stack frames at the root like "thread:UIThread" and
"thread:BackgroundPool-1".

Closes google#558
mhansen added a commit to mhansen/pprof that referenced this issue Sep 28, 2021
These add synthetic stack frames to samples.

Example usage:

$ pprof -tagroot thread pprof.proto

Will add synthetic stack frames at the root like "thread:UIThread" and
"thread:BackgroundPool-1".

Closes google#558
mhansen added a commit to mhansen/pprof that referenced this issue Sep 30, 2021
These add synthetic stack frames to samples.

Example usage:

$ pprof -tagroot thread pprof.proto

Will add synthetic stack frames at the root like "thread:UIThread" and
"thread:BackgroundPool-1".

Closes google#558
mhansen added a commit to mhansen/pprof that referenced this issue Sep 30, 2021
These add synthetic stack frames to samples.

Example usage:

$ pprof -tagroot thread pprof.proto

Will add synthetic stack frames at the root like "UIThread" and
"BackgroundPool-1".

The filename of the added frames will be the label key.

Closes google#558
mhansen added a commit to mhansen/pprof that referenced this issue Sep 30, 2021
These add synthetic stack frames to samples.

Example usage:

$ pprof -tagroot thread pprof.proto

Will add synthetic stack frames at the root like "UIThread" and
"BackgroundPool-1".

The filename of the added frames will be the label key.

Closes google#558
aalexand pushed a commit that referenced this issue Oct 1, 2021
These add synthetic stack frames to samples.

Example usage:

$ pprof -tagroot thread pprof.proto

Will add synthetic stack frames at the root like "UIThread" and
"BackgroundPool-1".

The filename of the added frames will be the label key.

Closes #558
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 a pull request may close this issue.

2 participants