-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
ext/har: add HAR logger extension #610
Conversation
Port HAR logging from abourget/goproxy to ext package. Closes elazarl#609
…e exportLoop, test viability,and package fixing
… into feature/har-logger
@ErikPelli Fixed up those errors I believe |
@CameronBadman the comment that I left for the tests has been resolved but I don't see the requested changes in the branch |
ext/har/logger_test.go
Outdated
assert.Equal(t, 3, len(exports), "should have 3 export batches") | ||
assert.Equal(t, threshold, len(exports[0]), "first batch should have threshold size") | ||
assert.Equal(t, threshold, len(exports[1]), "second batch should have threshold size") | ||
assert.Equal(t, 1, len(exports[2]), "last batch should have remainder") |
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.
Since we are handling the batch in goroutines, we don't have anymore an enforced order. You have to adapt the assertion to expect two full batches and one with only one entry in any possible order.
ext/har/logger_test.go
Outdated
entriesCopy := make([]Entry, len(entries)) | ||
copy(entriesCopy, entries) | ||
exports = append(exports, entriesCopy) |
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.
Here there is a race condition, you are appending to a shared slice but there is no mutex to prevent concurrent accesses.
Add it to prevent this.
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.
not entirely sure if I have solved this one
Co-authored-by: Erik Pellizzon <[email protected]>
…ogger test to measure based on freq not a sorterd set
Thanks! LGTM. Tomorrow I'll do one final check and, if it will be ok, I will merge this pull request |
Thanks! |
ext/har: add HAR logger extension
Port HAR (HTTP Archive) logging functionality from abourget/goproxy
to the ext/ package. Features include:
This is a self-contained extension that doesn't modify core functionality.
Credit to abourget/goproxy for the original implementation.
Closes #609