-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
libpod/events: Use unix timestamp for event time, and add a timeNano field for event time in nanoseconds #18549
Conversation
pkg/domain/entities/events.go
Outdated
libpodEvents "github.com/containers/podman/v4/libpod/events" | ||
dockerEvents "github.com/docker/docker/api/types/events" | ||
"strconv" |
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.
Please keep the golang native separate from the githup imports.
Thanks @ch33hau |
Changes LGTM once @rhatdan 's comment is addressed and the tests are made happy. |
8cdb0f3
to
ead1cf4
Compare
Thanks for reviewing, @rhatdan @TomSweeneyRedHat ! @rhatdan I think your comment about the I have fixed that linter complaint as well as some bugs (should use By the way, I have a side question which is not directly related to this issue:
I will keep investigating how I can make it works but just wanted to ask you if you by chance have any ideas to deal with these problems. (I tried to search from Github issues but seems no other people have similar issues) Thanks a lot for your time! |
ead1cf4
to
66395eb
Compare
/retest |
@ch33hau: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
66395eb
to
1473bef
Compare
- Use unix timestamp for event time - Add a timeNano field for event time in nanoseconds Fixes: containers#14993 Signed-off-by: Chee Hau Lim <[email protected]>
1473bef
to
ec0668a
Compare
This seems to break API? |
Still working on fixing |
Yes. The Event struct is used in the REST API, so we need to keep it stable. Looking at #14993, I am not we can guarantee compatibility on the raw JSON level. Was there a concrete issue or bug caused by the differences or is it more of a cosmetic nature? |
@edsantiago @vrothberg thanks for mentioning the API changes. That sounds like I should on-hold the changes until a decision has been made, right? |
The issue links https://github.com/stepchowfun/docuum Looking at #14993 the docker json output is all lowercase, so technically we could add new fields as lowercase. Converting the timestamp can be done on the client side. Breaking the internal event type must be avoided, this would result in a newer client unable to read the events from the event file. |
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@vrothberg Sorry that I am pretty new to Podman so I might not totally get your question correctly. What I learned from #14993 was that a user is asking if Podman is trying to match Docker's outputs, because the user is facing some issues when using a tool that is working fine with Docker but not Podman. And then this comment says that |
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.
Apologies, I was on PTO for two weeks.
@Luap99, what's your take?
@@ -147,8 +147,10 @@ func eventSockDir() (string, error) { | |||
func newMachineEvent(status events.Status, event events.Event) { | |||
openEventSock.Do(initMachineEvents) | |||
|
|||
now := time.Now() | |||
event.Time = now.Unix() | |||
event.TimeNano = now.UnixNano() |
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.
Alternatively use events.new(status)
.
The unix time can be added to the json but only in the frontend, i.e. cmd/podman/system/events.go. We cannot break our internal structure here, this is also used via our libpod rest API. You could embed the |
A friendly reminder that this PR had no activity for 30 days. |
Friendly ping. @ch33hau, do you have cycles to complete this PR? |
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.
Closing this PR due to inactivity. Feel free to reopen or others to take over and create a new PR.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ch33hau, vrothberg The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fixes: #14993
Does this PR introduce a user-facing change?
Yes