-
Notifications
You must be signed in to change notification settings - Fork 182
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
round durations to the second in events, errors and messages #1083
base: main
Are you sure you want to change the base?
Conversation
7379adb
to
167587d
Compare
hello @stefanprodan |
@tmmorin can you rebase with upstream main and force push. The CI error should be fixed. |
167587d
to
432cc30
Compare
done |
Ok so tests are failing due to |
ah, fair point indeed |
5ffd182
to
dc082a2
Compare
duration rounded: - to the second for durations >= 1s - to the ms for durations < 1s Signed-off-by: Thomas Morin <[email protected]>
dc082a2
to
19bbf68
Compare
I made the suggested change, however this unit test is failing:
I don't get why because, for sure, the logic for generating events is not changed by my PR. |
It is changing a lot, events are no longer unique and they get dropped by deduplication. |
Ok, I see: implicitly the current code (at least the testing code) is relying on timing as a source of "unique event ids". This is unusual. Should the way events are tested be changed ? (e.g. byt testing "new event" or "lastTimestamp is after last action") Or should the side-effect of the new behavior behind this change be avoided ? Including the metadata.generation in the messages is feasible for "Reconciliation finished in" : e.g "Reconciliation of generation %d finished in ...". But this idea wouldn't work for "Reconciliation failed after ....", nor for "Health check failed after..." or "Health passed in...". |
It’s not the testing code the issue here but Kubernetes itself which doesn’t create a new event and drops duplicates, we’re been avoiding by having the full duration in the message so Kubernetes will not see it as a duplicate. Also having the generation with not fix anything as the same generation can reconcile new state from Git. |
To fix the tests we probably have to look at the increment number and determine deduplication. |
Yes, yes, I got it -- the test expects a new event and works only if the events escape deduplication by having pseudo-unique messages.
Yes, indeed. |
This is a small evolution so that messages like
health check failed after 30.040865791s: timeout
are made shorter and more readable, by rounding the duration to the nearest second and avoid useless decimals. The new messages will look likehealth check failed after 30s: timeout
.This is aimed to make logs, events and status conditions messages a bit more readable.