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

Multiline values #8

Open
ansel1 opened this issue Jan 7, 2025 · 3 comments
Open

Multiline values #8

ansel1 opened this issue Jan 7, 2025 · 3 comments

Comments

@ansel1
Copy link

ansel1 commented Jan 7, 2025

When an attr value has newlines in it, it can make the value of the attr a little hard to scan. For example, in the below output, consider the "errorVerbose" attribute. The value of this attribute is:

boom

main.testVariousHandlers
        /Users/regan/dev/flume/v2/cmd/demo/main.go:215
main.main
        /Users/regan/dev/flume/v2/cmd/demo/main.go:78
runtime.main
        /opt/homebrew/Cellar/go/1.23.4/libexec/src/runtime/proc.go:272
runtime.goexit
        /opt/homebrew/Cellar/go/1.23.4/libexec/src/runtime/asm_arm64.s:1223
image

It's a little hard to scan, because the first line of the value ("boom") appears on the same line as the key, and the last line of the value also includes the "size" attr.

I have some sample code which sorts all multi line values to the end of the buffer, so simple values are all on a single line together, and then the multi-line values are each printed on their own line. Note how the key and the value each have their own line. I also used a different separator for them (":" instead of "="), just as an experiment. Would you consider a PR for something like this?

image
@phsym
Copy link
Owner

phsym commented Jan 11, 2025

Hi ! That's an interresting proposal for which I would definitely consider a PR 🙂

@ansel1
Copy link
Author

ansel1 commented Jan 11, 2025

I am working on another PR which merges the other PRs together. They were all playing in the same files, and could each take advantage of some of the optimizations in the others.

I've optimized them such that there are still zero allocations, even when all the features are in use. The only feature which adds some overhead is the multiline handling. In my local benchmarks, that increases the duration of Handle() from around 750ns to 900ns. The others have no performance impact (in fact, its a little faster than before).

I'm just crossing some t's and dotting some i's on that. Should have it submitted today. Put the other PRs in draft for now.

@ansel1
Copy link
Author

ansel1 commented Jan 11, 2025

Just pushed a new PR with these features merged together. #15

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

No branches or pull requests

2 participants