Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/fixed-15370.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Log lines that merely mention "bad gateway", "service unavailable" or "gateway timeout" in prose are no longer classified as GitHub upstream-unavailable errors; only the `: <status>` forms match (#15370).
12 changes: 7 additions & 5 deletions src/pkg/fleetreport/fleetreport.go
Original file line number Diff line number Diff line change
Expand Up @@ -825,15 +825,17 @@ func IsGitHubRateLimited(s string) bool {
// upstreamUnavailableSubstrings are lower-case fragments that mark a GitHub
// gateway-class transient failure (see IsGitHubUpstreamUnavailable). The
// status codes are anchored to go-github's "<METHOD> <url>: 503 ..." shape so
// a PR number or page=503 cannot match; 500 is deliberately absent.
// a PR number or page=503 cannot match; 500 is deliberately absent. The
// status phrases are anchored to the same ": " separator so prose that merely
// mentions them does not match.
var upstreamUnavailableSubstrings = []string{
": 502 ",
": 503 ",
": 504 ",
"bad gateway",
"service unavailable",
"gateway timeout",
"gateway time-out",
": bad gateway",
": service unavailable",
": gateway timeout",
": gateway time-out",
}

// IsGitHubUpstreamUnavailable reports whether s (a log message or an error
Expand Down
4 changes: 4 additions & 0 deletions src/pkg/fleetreport/runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,10 @@ func TestIsGitHubUpstreamUnavailable(t *testing.T) {
{"GET https://api.github.com/repos/o/r/pulls/1336: 503 []", true},
{"GET https://api.github.com/repos/o/r/pulls/1: 504 Gateway Timeout []", true},
{"upstream: Service Unavailable", true},
{"GET https://api.github.com/repos/o/r: 503 Service Unavailable []", true},
{"issue title mentions service unavailable but request succeeded", false},
{`"bad gateway" appears in quoted prose`, false},
{"gateway timeout handling was documented", false},
{"GET https://api.github.com/repos/o/r: 500 Internal Server Error", false},
{"GET https://api.github.com/repos/o/r: 404 Not Found", false},
{"GET https://api.github.com/repos/o/r/pulls/503: 404 Not Found", false},
Expand Down
Loading