-
Notifications
You must be signed in to change notification settings - Fork 306
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
Dogwrap fails to event with unicode in stderr, stdout when using buffer_outs option #201
Comments
Looks like unicode might be the issue, possibly duplicates: #55 |
Final: This issue is now invalid. The problem doesn't appear to be unicode related at all. At this point, it appears there is an issue with the Closing and reopening a new ticket that focuses on this directly without all the noise in this ticket. |
buffer_opts
and unicode in stderr
, stdout
buffer_opts
and unicode in stderr
, stdout
Figured out it really was unicode issue. PR Submitted: #203 |
I believe this is closed with #203. Thanks again @ronindesign |
[invalid] Real issue from
-b
(buffer_opts) withstderr
,stdout
redirectEnvironment
Context
Using
dogwrap
via cron to run a PHP cli script:/home/MYUSER/.local/bin/dogwrap -n "My Cron" -k APIKEY -b --submit_mode all --notify_error="Notifying @MYEMAIL1 @MYEMAIL2" --tags=cron,test "php -q cron.php" >/dev/null 2>&1
The cron runs every 15 minutes. When there are no tasks, a small summary string of (ascii) text is sent to
stdout
from PHP cli (dogwrap correctly captures it, and I see it in my events view):However, each and every time
cron.php
does have a task to do,dogwrap
fails to send the event to datadog server. The dogwrap command doesn't seem to exit or crash, it simply finishes and prints buffered output fromstdout
andstderr
like everything is fine, but the event never seems to send. The output in these cases, seen by removing null route>/dev/null
is:Thus, the only seemingly significant difference I can see between the outputs is the use of extended character encoding via UTF-8. Specifically the use of:
(UTF-8) Light Shade (U+2591) | ASCII: 9617
https://www.utf8icons.com/character/9617/light-shade
(UTF-8) Dark Shade ( U+2593) | ASCII: 9619
https://www.utf8icons.com/character/9619/dark-shade
I believe this is likely a unicode encoding issue.
Without redirecting
stdout
, there is no crash, everything prints fine in my console (where sys.stdout.encoding=UTF-8), and the event is successfully transmitted.If I test with some unicode, and redirect to a file instead of to
/dev/null
, I see an exceptions:So maybe there is an issue with unicode support, conversion, handling, etc?
I mostly use Python 3+ these days, but, if I understand correctly, most datadog related python is based on version
2.7.x
where unicode support is handled differently? (I.e. in 3+ astr
is unicode by default, but no so in2.7.x
I think?)stdout
,stderr
(with/without IO redirection).--tags=test░tag
, tag does not appear on event.According to
dogwrap --help
:It seems like the
buffer_outs
option causes different path for string printing, that doesn't include / support unicode encoding. I believe the culprit here indatadogpy.dogshell.wrap
:Following the state of
stdout
, it is concatenated with a unicode string, changing its type to unicode as well. However, it is never encoded back before printing.Pull Request for minimal fix for just this localized issue: #203
The text was updated successfully, but these errors were encountered: