Skip to content
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

Merged
merged 2 commits into from
Jun 15, 2022
Merged

Conversation

2rs2ts
Copy link
Contributor

@2rs2ts 2rs2ts commented Jun 8, 2022

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 in core.v1.Event, so I didn't attempt to truncate the message here. Please let me know if I should do so anyway.

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>
@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 8, 2022
@k8s-ci-robot
Copy link
Contributor

Welcome @2rs2ts!

It looks like this is your first PR to kubernetes/node-problem-detector 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/node-problem-detector has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 8, 2022
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),
Copy link
Contributor Author

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.

Copy link
Contributor

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.

@2rs2ts 2rs2ts marked this pull request as ready for review June 8, 2022 21:50
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 8, 2022
@k8s-ci-robot k8s-ci-robot requested a review from dchen1107 June 8, 2022 21:50
Copy link
Contributor

@mmiranda96 mmiranda96 left a 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!

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),
Copy link
Contributor

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.

@mmiranda96
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 9, 2022
@2rs2ts
Copy link
Contributor Author

2rs2ts commented Jun 9, 2022

Thank you for the helpful suggestion, @mmiranda96. Looks like the tests are all good now.

@mmiranda96
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 14, 2022
@2rs2ts
Copy link
Contributor Author

2rs2ts commented Jun 15, 2022

/assign @andyxning

@vteratipally
Copy link
Collaborator

/approve

@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 15, 2022
@k8s-ci-robot k8s-ci-robot merged commit 56122ce into kubernetes:master Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants