-
Notifications
You must be signed in to change notification settings - Fork 577
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 the first iteration of the blocks viewer cli tool #2697
Conversation
20a6a73
to
1a5bd95
Compare
cmd/profilecli/blocks_tool.go
Outdated
blocksWebToolCmd.Flag("object-store-type", "The type of the object storage (e.g., gcs).").Default("gcs").StringVar(¶ms.objectStoreType) | ||
blocksWebToolCmd.Flag("bucket-name", "The name of the object storage bucket.").StringVar(¶ms.bucketName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really would prefer if we could mimic flags from pyroscope itself and support all the options by calling RegisterFlags
.
Unsure that might be also incredibly hard
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried but it doesn't seem simple enough to do without a bigger refactor, can plan this for later though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! LGTM, just a a few comments, I don't think anything is really blocking before merging, but have a look and adapt things that make sense to you 🙂
pkg/admin/admin.go
Outdated
@@ -0,0 +1 @@ | |||
package admin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure we need this at this point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that is a leftover from something else, good catch!
cmd/profilecli/blocks_tool.go
Outdated
out := output(ctx) | ||
|
||
fmt.Fprintf(out, "The blocks web tool is available at http://localhost:%d/blocks/index\n", t.params.httpListenPort) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice to have: Potentially open the browser automatically: https://stackoverflow.com/questions/39320371/how-start-web-server-to-open-page-in-browser-in-golang
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a good idea and perhaps it needs to be behind a flag if someone finds getting multiple tabs from multiple runs annoying. One issue with most solutions though is they are not robust enough. For example, to open the browser only when the server is successfully up we need to do something like https://stackoverflow.com/questions/32738188/how-can-i-start-the-browser-after-the-server-started-listening/32742904#32742904 but we can't since we don't start the server this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ticked the wrong box
Addresses #2541
Usage:
profilecli tool blocks web --bucket-name <object_store_bucket_name>
http://localhost:4201/blocks/index
in a browser (the URL is also printed to stdout)Notes:
Next steps (outside of this PR):
Screen.Recording.2023-11-17.at.07.55.34.mov