-
Notifications
You must be signed in to change notification settings - Fork 284
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
Not Sending PagerDuty Alerts Due to UnicodeEncodeError #1077
Comments
You may need to: Fix UnicodeEncodeError in PagerDutyAlerter If you have an environment where you can use PagerDuty, could you fix it, check it works, and submit a pull request if there is no problem? |
Please reply first to see if you can handle it. |
I think I can handle it, but it'll have to wait a few days. My only concern is that this probably effects more than the PagerDuty alert. Probably all alerts that work via POST request have this bug. |
Should utf-8 be added as a fixed encoding to request.post? I think it is possible to set it externally as follows. Could you give us your opinion? schema.yaml pagerduty_encode: {type: string} pagerduty.py
|
Some thoughts on this in no particular order:
Again, internationalization and encodings are not an area of expertise, so I'm unsure if more configurability is required. |
When inserting
Where do I make the following utf-8 mode changes? I don't usually use python, so I'm not familiar with it either.
|
Set |
For Docker and Kubernetes, I think this would be the way to do it – we can update the default Docker image to set this by default. For use as a Python package without the Docker wrapper, maybe we can recommend users set Either way, would like to hear what @jertel thinks about this idea. |
Please stop responding. Because the maintainer is discussing the response |
Thank you all for contributing to this discussion! I've run a few tests and posted the results below:
Based on these findings we can conclude that the global setting will not help us here. Each alerter will need to be modified to encode the request body to UTF-8. |
chatwork.py, line.py body opsgenie.py Since the post of json = post in opsgenie.py is an array, encode ('utf-8') for each value before setting to the array? gelf.py Gelf.py is already supported, so no modification is required 60 Line
|
I plan to release the next version of ElastAlert 2 later this week. I'm mentioning it only in case this is important enough that you might want to submit the PR before then, to have it included. |
A UnicodeError is raised when the json.dump() function is used with the ensure_ascii=False argument and the data also contains non-ASCII characters. |
Logs
Steps to reproduce
⇢
character and include that message in an alert to PagerDuty.More info
This is happening with our spring java services that use reactor, as their stack traces use that character. Encoding aside, elastalert2 should catch and handle all exceptions when sending a POST, instead of only looking at the response code.
The text was updated successfully, but these errors were encountered: