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

cmd/trace: debugging support like PySnooper? #31847

Closed
guanw opened this issue May 6, 2019 · 9 comments
Closed

cmd/trace: debugging support like PySnooper? #31847

guanw opened this issue May 6, 2019 · 9 comments
Labels
FeatureRequest FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@guanw
Copy link

guanw commented May 6, 2019

This isn't an issue regarding golang itself but would be a nice addition to have.

I notice in Python now there's a really nice debugging library PySnooper. It uses notion of trace from sys.settrace to fire up callback when codes are running so you could monitor/log everything ongoing.

Golang already has a notion of trace but the meaning is bit different from what python had here. I think a tool similar to PySnooper would be particularly helpful for new developers who's learning Golang. Since you are much more experienced with Golang than I am, I'm wondering if you guys think it's a good idea to make a similar module and if so what are some of the existing modules that could help achieve the goal here?(e.g something similar to sys.settrace that provides a nice callback) Thanks in advance for any ideas and recommendations here!

@bcmills
Copy link
Contributor

bcmills commented May 6, 2019

Probably the closest equivalent in the Go standard library is the runtime/trace package.

Please have a look at that package and let us know which (if any) of your use-cases it doesn't address well.

@bcmills bcmills changed the title A Better Debugging Support Like PySnooper cmd/trace: debugging support like PySnooper? May 6, 2019
@bcmills bcmills added FeatureRequest NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels May 6, 2019
@guanw
Copy link
Author

guanw commented May 6, 2019

@bcmills Thanks for the reply. Yeah I did check out runtime/trace package. I think the idea here is to log variable changes in pretty format without any outside interruption for developers.(You'd still have to manually call trace.Log in this case which is not ideal). So I'm not sure this is enough.

@bcmills
Copy link
Contributor

bcmills commented May 6, 2019

Since Go is a compiled language, something like that would presumably require deep compiler support.

A project that large probably ought to go through the proposal process, in which case it would need a lot more detail: what should the API look like, how would we implement it, and how important is the underlying use-case in relation to the other large projects in the issue backlog?

(Or, if you don't want to work it out in that much detail, a description of the general use-case would probably be more helpful as an experience report instead.)

@guanw
Copy link
Author

guanw commented May 7, 2019

Cool. I will write something when I have time. Thanks for the info here.

@bcmills
Copy link
Contributor

bcmills commented May 7, 2019

I'll close this issue for now, but do feel free to file a proposal if/when you're ready. 🙂

@agnivade agnivade closed this as completed May 8, 2019
@guanw
Copy link
Author

guanw commented May 10, 2019

@bcmills I made a draft here: https://github.com/guanw/go-proposal/blob/master/proposal.md. Could you let me know if it's unclear/incomplete and maybe link it to golang's experience report? Thanks.

@bcmills
Copy link
Contributor

bcmills commented May 10, 2019

@guanw thanks, but more detail would still be helpful. Per http://golang.org/wiki/ExperienceReports:

The best experience reports tell: (1) what you wanted to do, (2) what you actually did, and (3) why that wasn’t great, illustrating those by real concrete examples, ideally from production use.

@guanw
Copy link
Author

guanw commented May 14, 2019

@guanw thanks, but more detail would still be helpful. Per http://golang.org/wiki/ExperienceReports:

The best experience reports tell: (1) what you wanted to do, (2) what you actually did, and (3) why that wasn’t great, illustrating those by real concrete examples, ideally from production use.

Updated. Please check again. Thanks.

@bcmills
Copy link
Contributor

bcmills commented May 14, 2019

Added to the wiki. Thanks!

@golang golang locked and limited conversation to collaborators May 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FeatureRequest FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants