-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
qlog: add a default tracer that writes to QLOGDIR #4233
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #4233 +/- ##
==========================================
- Coverage 84.15% 84.11% -0.04%
==========================================
Files 149 150 +1
Lines 15381 15402 +21
==========================================
+ Hits 12943 12955 +12
- Misses 1941 1947 +6
- Partials 497 500 +3 ☔ View full report in Codecov by Sentry. |
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.
Thank you for working on this @birneee!
It would be nice to have an integration test as well. In that test, you could assert that
- The directory is created
- It contains qlog files for both the client and server
- These qlog files both contain the same connection ID
We can also simplify the qlog instructions in the README: https://github.com/quic-go/quic-go?tab=readme-ov-file#quic-event-logging-using-qlog |
qlog/qlog_dir.go
Outdated
if QlogDir == "" { | ||
return nil | ||
} | ||
path := fmt.Sprintf("%s/%s_%s.qlog", strings.TrimRight(QlogDir, "/"), connID, label) |
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.
Should we also include the date like here: https://github.com/libp2p/go-libp2p/blob/v0.32.2/p2p/transport/quicreuse/tracer.go#L47-L53?
It's quite nice to be able to sort the qlogs by file name and have them in chronological order.
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.
For me, this does not seem to be a big advantage, as one could also sort by file creation time.
I would rather stick with ODCID plus vantage point as recommended by the qlog draft.
if qlogDir == "" { | ||
return nil | ||
} | ||
if _, err := os.Stat(qlogDir); os.IsNotExist(err) { |
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.
- Should we handle non-nil errors that are not
os.IsNotExist
errors? - The documentation for
os.IsNotExist
says we should useerrors.Is(err, fs.ErrNotExist)
.
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'll do this in a follow-up PR. I might also change the file name a bit.
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.
Sounds good to me!
Co-authored-by: Marten Seemann <[email protected]>
Co-authored-by: Marten Seemann <[email protected]>
Co-authored-by: Marten Seemann <[email protected]>
Co-authored-by: Marten Seemann <[email protected]>
if qlogDir == "" { | ||
return nil | ||
} | ||
if _, err := os.Stat(qlogDir); os.IsNotExist(err) { |
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'll do this in a follow-up PR. I might also change the file name a bit.
* add qlog default tracer which writes to QLOGDIR * gofumpt * add qlog default tracer which writes to QLOGDIR * fix flaky tests * Update README.md Co-authored-by: Marten Seemann <[email protected]> * Update README.md Co-authored-by: Marten Seemann <[email protected]> * Update README.md Co-authored-by: Marten Seemann <[email protected]> * Update README.md Co-authored-by: Marten Seemann <[email protected]> --------- Co-authored-by: Marten Seemann <[email protected]>
* add qlog default tracer which writes to QLOGDIR * gofumpt * add qlog default tracer which writes to QLOGDIR * fix flaky tests * Update README.md Co-authored-by: Marten Seemann <[email protected]> * Update README.md Co-authored-by: Marten Seemann <[email protected]> * Update README.md Co-authored-by: Marten Seemann <[email protected]> * Update README.md Co-authored-by: Marten Seemann <[email protected]> --------- Co-authored-by: Marten Seemann <[email protected]>
Issue #4189
Split from #4201