-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Move pkg/jsonlog to be a subpackage of the single consumer #34946
Conversation
3619bfc
to
face2f7
Compare
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.
LGTM
It would be nice to reconcile this with ffjson. |
I agree, but I think we need to get it setup with a |
@dnephin: Can you provide benchmark numbers for memory allocations done before and after these changes, please? |
Created string `json:"time"` | ||
Log []byte `json:"log,omitempty"` | ||
Stream string `json:"stream,omitempty"` | ||
Created time.Time `json:"time"` |
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.
We are using that one on the client side right ? This might break a bunch of user of this pkg
right ?
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.
This struct is not used by the cli. The cli is only using a constant, and is made forward compatible here: docker/cli#551
It might break users of this pkg
, but that is unfortunately necessary. These packages were not maintained properly and developed really bad interfaces which need to be fixed. We're going to be breaking everyone with #32989 anyway, and I think this can be seen as cleanup work necessary for #32989.
The godoc (https://godoc.org/github.com/moby/moby/pkg/jsonlog) doesn't show any consumers of this package. I'm not sure how reliable that is, but it seems to work for other packages.
Looking at this again, I don't think |
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Daniel Nephin <dnephin@docker.com>
face2f7
to
035604c
Compare
I found some benchmarks in
This is the first go benchmark I've written, so let me know if you see anything that looks off. There were some logical errors in what exited before (wrong number of bytes because 1) it was using a different struct to calculate bytes, and 2) it was doing extra iterations not accounted for by |
I removed some more unused code |
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.
LGTM 🐸
Fixes moby#19803 Updated the json-logger to utilize the common log option 'tag' that can define container/image information to include as part of logging. When the 'tag' log option is not included, there is no change to the log content via the json-logger. When the 'tag' log option is included, the tag will be parsed as a template and the result will be stored within each log entry as the attribute 'tag'. Update: Removing test added to integration_cli as those have been deprecated. Update: Using proper test calls (require and assert) in jsonfilelog_test.go based on review. Update: Added new unit test configs for logs with tag. Updated unit test error checking. Update: Cleanup check in jsonlogbytes_test.go to match pending changes in PR moby#34946. Update: Merging to correct conflicts from PR moby#34946. Signed-off-by: bonczj <josh.bonczkowski@gmail.com>
@dnephin: Thank you. I'm worried about regressions related to memory allocations in this code. We've had some unpleasant issues related to this in the past. It's good to see allocations remain pretty much the same. |
Fixes moby#19803 Updated the json-logger to utilize the common log option 'tag' that can define container/image information to include as part of logging. When the 'tag' log option is not included, there is no change to the log content via the json-logger. When the 'tag' log option is included, the tag will be parsed as a template and the result will be stored within each log entry as the attribute 'tag'. Update: Removing test added to integration_cli as those have been deprecated. Update: Using proper test calls (require and assert) in jsonfilelog_test.go based on review. Update: Added new unit test configs for logs with tag. Updated unit test error checking. Update: Cleanup check in jsonlogbytes_test.go to match pending changes in PR moby#34946. Update: Merging to correct conflicts from PR moby#34946. Signed-off-by: bonczj <josh.bonczkowski@gmail.com>
Remove some unused code
Un-export some code that shouldn't be exported
Cleanup test cases
Move a constant to a more appropriate module
Move the pkg/jsonlog to a subpackage of jsonfilelog
/pkg
#32989