-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
dap: show pprof labels in thread names #3493
Comments
Here's a PR: #3501 |
@stefanhaller Can you please include a screenshot for this? |
I added a screenshot to the PR description; it's the one from the I agree that it could be a problem if there are many labels. Do you have any suggestion how else to show them? I find it essential that they are visible directly in the stacktrace view so that it's easy to see which go routine is which (as opposed to having to hover over things to see the information, for example). |
@stefanhaller I would love to understand more about your use case. When you are debugging, when would you most commonly want to refer to these labels? Are you using them to identify specific goroutines and navigate between them? Would moving the keys to after the function name make them less useful to you? If you can get a screenshot from a more realistic use case than the test fixture that would be very helpful as well. For the implementation, it would also be great if we can make sure that loading the labels doesn't have a significant impact on the latency of the threads request. |
OK, I see that I might be abusing labels for something that they weren't meant for. My real goal is to identify goroutines by name in the call stack view. In C/C++ programs I can give names to threads using the Now I want the same thing for go, and since golang doesn't have a feature to set a name for a goroutine, I figured that pprof labels would be the closest approximation. The code base that I mostly work with doesn't use labels yet, so it would be easy to assign one key/value pair to each goroutine to identify it. Actually I don't care about the key, it would be always something like "name" for me, which is a bit pointless. I do realize that this wouldn't work well for code bases that already make heavy use of labels. So maybe it needs to be an opt-in feature with a config? The config could be a list of labels to show in the debugger, or maybe even just a single label, where it would then only show the value and not the key. This latter option would work best for me, I guess. |
Come to think of it, could it perhaps be acceptable to always show the value of the "name" label if there is one, without an opt-in config? |
Ok sounds good, thanks for the info! Given the use case, I think the placement probably makes sense, since it will be more differentiating than the function name. I think starting with an opt in config would be good and we can start trying out the UX with different projects that are using pprof labels more regularly. |
Cool. Any suggestions for the name of the config? I can only think of awkwardly long ones like |
For lack of better suggestions I went with |
Sorry that I was late. I wonder if anyone considered
|
Yes, I did consider this, and I mentioned it above. For me this is less ideal though, because in this case we'd have to show both the keys and the values, and in case you configure only one label that's unnecessary noise. For example, if you choose "name" as the key for all your thread names, then it would show That said, if everybody agrees that this more flexible solution is what we want, I could do that too. I have to admit that I'm a bit unsure how decision making works around here... |
It would be useful to see pprof labels in VS Code's debugger. One possible way to show them is to append them after the go routine ID in the thread names, e.g. instead of showing just
[Go 42]
, show[Go 42 key1: value1, key2: value2]
.dlv version
)? 1.20.2go version
)? go1.20.7 darwin/arm64The text was updated successfully, but these errors were encountered: