-
Notifications
You must be signed in to change notification settings - Fork 635
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
Add condition message to event message #678
Conversation
If you're using some monitoring solution that aggregates events from your Kubernetes cluster, having the underlying reason why a condition triggered could be very useful, especially if you are using custom plugin monitors. Co-authored-by: Micah Norman <micnorman@paypal.com> Signed-off-by: Ryan Eschinger <reschinger@paypal.com>
Welcome @2rs2ts! |
Hi @2rs2ts. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
pkg/util/helpers.go
Outdated
return types.Event{ | ||
Severity: types.Info, | ||
Timestamp: timestamp, | ||
Reason: reason, | ||
Message: fmt.Sprintf("Node condition %s is now: %s, reason: %s", t, status, reason), | ||
Message: fmt.Sprintf("Node condition %s is now: %s, reason: %s, message: %s", t, status, reason, message), |
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.
As mentioned in the PR summary, I'm totally open to changing the wording and formatting here, just let me know. I would also like to know if this message should be truncated.
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.
I suggest using %q
instead of %s
, since the message might include special render characters (such as \n) and displaying the value makes sense.
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.
Left one small comment. Thanks for this contribution!
pkg/util/helpers.go
Outdated
return types.Event{ | ||
Severity: types.Info, | ||
Timestamp: timestamp, | ||
Reason: reason, | ||
Message: fmt.Sprintf("Node condition %s is now: %s, reason: %s", t, status, reason), | ||
Message: fmt.Sprintf("Node condition %s is now: %s, reason: %s, message: %s", t, status, reason, message), |
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.
I suggest using %q
instead of %s
, since the message might include special render characters (such as \n) and displaying the value makes sense.
/ok-to-test |
Thank you for the helpful suggestion, @mmiranda96. Looks like the tests are all good now. |
/lgtm |
/assign @andyxning |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 2rs2ts, mmiranda96, vteratipally 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 |
If you're using some monitoring solution that aggregates events from your Kubernetes cluster, (e.g., Datadog,) having the underlying reason why a condition triggered could be very useful, especially if you are using custom plugin monitors.
Obviously, the fact that a
message
field contains the word "message" in it is a little awkward, but I didn't know what else to call it, besides something that seemed redundant like "condition message." I'm totally open to suggestions here, as long as the message contents get included somehow.I could not find a documented upper bound on the size of the
message
field incore.v1.Event
, so I didn't attempt to truncate the message here. Please let me know if I should do so anyway.