Fix Ping check on non-English Windows - #3075
Merged
Merged
Conversation
|
🎯 Code Coverage (details) 🔗 Commit SHA: 2b87752 | Docs | Datadog PR Page | Give us feedback! |
ddog-nasirthomas
marked this pull request as ready for review
July 23, 2026 21:02
dkirov-dd
requested changes
Jul 29, 2026
dkirov-dd
left a comment
Contributor
There was a problem hiding this comment.
Looks good but I have one blocker
| lines = self._exec_ping(timeout, host) | ||
| regex = re.compile(r"time[<=]((\d|\.)*)") | ||
| # Match on the untranslated "ms" unit, since ping localizes the "time" label (e.g. German "Zeit=") | ||
| regex = re.compile(r"[<=]\s*([\d.]+)\s*ms") |
Contributor
There was a problem hiding this comment.
request
I'd keep this only as a fallback, keeping the old regex as the primary one.
Unless we are absolutely certain that there is no way another time unit is returned by the command (e.g. s, µs, etc.)
dkirov-dd
approved these changes
Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes the Ping check on non-English Windows. Windows prints ping's output in the system language, and the check couldn't handle that:
'utf-8' codec can't decode byte 0x81.timeto read the response time, which Windows translates (e.g. GermanZeit) — so it reported reachable hosts as down.The check now reads the output as UTF-8 and finds the response time by its
msunit instead of the English word, so it works in any language.Motivation
Customers were seeing this error
'utf-8' codec can't decode byte 0x81for customers that were utilizing non-english hosts.Review checklist
no-changeloglabel attachedAdditional Notes
Anything else we should know when reviewing?