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

Adds ability to view series in text editor by pressing "v" or "enter" on a selected row #20

Merged
merged 14 commits into from
Jan 31, 2025

Conversation

swar8080
Copy link
Contributor

Let me know what you think. I tested this both with a terminal editor (vim) and editor that opens files in a different window (sublime).

Styling the "flash message" was surprisingly tricky so it looks pretty basic, but the control flow was fun to write.

I can also update the README once you're done reviewing

Closes #19

Copy link
Owner

@pedro-stanaka pedro-stanaka left a comment

Choose a reason for hiding this comment

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

Thanks for this. Left some feedback to be addressed.

Signed-off-by: Pedro Tanaka <[email protected]>
@pedro-stanaka
Copy link
Owner

Left feedback as PR as well: swar8080#1

swar8080 and others added 4 commits January 18, 2025 15:59
Feedback PR to view raw series in editor
Co-authored-by: Pedro Tanaka <[email protected]>
…tograms and summaries into a single base metric for consistency with native histograms
@swar8080
Copy link
Contributor Author

I noticed that classic histograms stopped working in the editor, which the recent commit fixes. It also now lists classic histograms and summaries under a single base metric like it does for native histograms. I noticed the way cardinality is displayed is still different though, where each _bucket, _count, and _sum is counted towards the classic/summary cardinality.

I'll take a look at the test failure


// Run the editor and clean up
err := cmd.Run()
os.Remove(tmpFile)
Copy link
Owner

Choose a reason for hiding this comment

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

I think it is fine to leave those temp files. If you try to open on a GUI editor, the file will be empty. I tried with EDITOR=code.

Copy link
Owner

@pedro-stanaka pedro-stanaka left a comment

Choose a reason for hiding this comment

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

This is looking good already. Just let's leave the temp file behind as I said and I will approve/merge.

…t block when called through exec.Command, so the file they're editing needs to remain
@swar8080
Copy link
Contributor Author

This is looking good already. Just let's leave the temp file behind as I said and I will approve/merge.

Okay just made that change. I realized that text editors like sublime block the go thread when running exec.Command until you close the editor, but thats not the case for vscode

Also, I noticed you added a line to quit the program after viewing text in the editor. Does it work correctly for you if you leave the program running? I find it convenient to explore multiple metrics without having to restart the program each time

@pedro-stanaka
Copy link
Owner

This looks fine for me, but it still quits the program once we run the editor.

Also, I noticed you added a line to quit the program after viewing text in the editor. Does it work correctly for you if you leave the program running? I find it convenient to explore multiple metrics without having to restart the program each time

I had a problem when using vim/nvim where the rendering of the file would be mixed with the rest of the program. Like both of them were running in paralllel. My combination of software was: iTerm2 + Zsh + NVIM v0.10.2

@swar8080
Copy link
Contributor Author

This looks fine for me, but it still quits the program once we run the editor.

Also, I noticed you added a line to quit the program after viewing text in the editor. Does it work correctly for you if you leave the program running? I find it convenient to explore multiple metrics without having to restart the program each time

I had a problem when using vim/nvim where the rendering of the file would be mixed with the rest of the program. Like both of them were running in paralllel. My combination of software was: iTerm2 + Zsh + NVIM v0.10.2

Ahh okay, i'm going to dig into how k9s handles editing resources

…tor to see if it avoids interference with editors that run in the same terminal
@swar8080
Copy link
Contributor Author

Hi @pedro-stanaka, I couldn't reproduce the issue with the same set-up but am wondering if my last commit fixes the issue?

I looked at the k9s code and it looks very similar except they suspend the UI event loop and also "disengage" the terminal using the below code. Bubbletea supports suspending the event loop, which is what this recent change does, but I'm not sure if it offers everything the k9s disengage code does.

image

Copy link
Owner

@pedro-stanaka pedro-stanaka left a comment

Choose a reason for hiding this comment

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

LG with latest changes.

@pedro-stanaka pedro-stanaka merged commit c133741 into pedro-stanaka:main Jan 31, 2025
6 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.

Allow viewing a metric's series
2 participants