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

Emit warning-level logs when truncating messages in notifications #3145

Merged
merged 7 commits into from Dec 13, 2022

Conversation

alexweav
Copy link
Contributor

@alexweav alexweav commented Nov 25, 2022

Some integrations define maximum lengths of messages that they accept. We usually respect these, by truncating the user's message for them.

Since we are actively modifying what the user asked us to send, let's log this event at warning level. That way, operators can more easily see when their message is too long, and know that we changed it for them.

Fixes #3134

We no longer log the full-blown message per #3134 (comment).

if truncated {
level.Debug(n.logger).Log("msg", "truncated message", "truncated_message", message, "alert", key)
level.Debug(n.logger).Log("msg", "Truncated message", "alert", key, "runes", maxMessageLenRunes)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Standardized the capitalization of these to use a capital at the beginning. Please let me know if you'd rather me go the other way.

Copy link
Member

@simonpasquier simonpasquier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

leaving the final word to @gotjosh

@alexweav
Copy link
Contributor Author

hey @gotjosh, any final comments here?

@prometheus prometheus deleted a comment from alexweav Dec 13, 2022
Copy link
Member

@gotjosh gotjosh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, LGTM but I have one small nit.

notify/opsgenie/opsgenie.go Outdated Show resolved Hide resolved
Signed-off-by: Alex Weaver <weaver.alex.d@gmail.com>
Signed-off-by: Alex Weaver <weaver.alex.d@gmail.com>
Signed-off-by: Alex Weaver <weaver.alex.d@gmail.com>
Signed-off-by: Alex Weaver <weaver.alex.d@gmail.com>
Signed-off-by: Alex Weaver <weaver.alex.d@gmail.com>
Signed-off-by: Alex Weaver <weaver.alex.d@gmail.com>
Signed-off-by: Alex Weaver <weaver.alex.d@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change log level to warn when truncating messages on notification integrations
3 participants