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

qlog: add a default tracer that writes to QLOGDIR #4233

Merged
merged 8 commits into from
Jan 12, 2024

Conversation

birneee
Copy link
Contributor

@birneee birneee commented Jan 3, 2024

Issue #4189

Split from #4201

Copy link

codecov bot commented Jan 3, 2024

Codecov Report

Attention: 9 lines in your changes are missing coverage. Please review.

Comparison is base (8cad3d2) 84.15% compared to head (7bae523) 84.11%.
Report is 4 commits behind head on master.

Files Patch % Lines
qlog/qlog_dir.go 62.50% 7 Missing and 2 partials ⚠️
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.
📢 Have feedback on the report? Share it here.

Copy link
Member

@marten-seemann marten-seemann left a 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

  1. The directory is created
  2. It contains qlog files for both the client and server
  3. These qlog files both contain the same connection ID

qlog/qlog_dir.go Outdated Show resolved Hide resolved
qlog/qlog_dir.go Outdated Show resolved Hide resolved
qlog/qlog_dir_test.go Outdated Show resolved Hide resolved
@marten-seemann
Copy link
Member

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)
Copy link
Member

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.

Copy link
Contributor Author

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.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
if qlogDir == "" {
return nil
}
if _, err := os.Stat(qlogDir); os.IsNotExist(err) {
Copy link
Member

Choose a reason for hiding this comment

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

  1. Should we handle non-nil errors that are not os.IsNotExist errors?
  2. The documentation for os.IsNotExist says we should use errors.Is(err, fs.ErrNotExist).

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good to me!

birneee and others added 4 commits January 10, 2024 10:47
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) {
Copy link
Member

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.

@marten-seemann marten-seemann changed the title Add qlog default tracer which writes to QLOGDIR if set qlog: add a default tracer that writes to QLOGDIR Jan 12, 2024
@marten-seemann marten-seemann merged commit 2cd9ed3 into quic-go:master Jan 12, 2024
19 checks passed
nanokatze pushed a commit to nanokatze/quic-go that referenced this pull request Feb 1, 2024
* 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]>
mgjeong pushed a commit to mgjeong/quic-go that referenced this pull request Feb 13, 2024
* 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]>
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.

Enable and set destination for qlog output via QLOGDIR environment variable
2 participants