Repository navigation
Add retries and timeout to Grafana request in flaky test detection - #40669
schizophrenicmaniac wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
📋 Review Summary
This PR fixes a TypeError in flaky_test_detection.py caused by GitHub returning None for the body of empty issues, and optimizes label checks by inspecting the already-loaded issue.labels property instead of issuing extra API requests via issue.get_labels(). The fix is clean, directly addresses the failure, and includes comprehensive unit test coverage for the affected issue-parsing logic.
🔍 General Feedback
- The null-safe fallback
(issue.body or "")and the switch fromissue.get_labels()toissue.labelsare idiomatic and well-tested intest_flaky_test_detection.py. - No blocking issues or regressions were found.
💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.
|
Assigning reviewers: R: @Abacn added as fallback since no labels match configuration Note: If you would like to opt out of this review, comment Available commands:
The PR bot will only process comments in the main thread (not review comments). |
The flaky test detection job calls the Grafana alertmanager API with a plain
requests.get. That call has no timeout and no retry, so any blip on metrics.beam.apache.org fails the whole run. This change uses a session with urllib3Retry: 5 retries with backoff on connection errors and 429/5xx responses, plus a 30s timeout. If Grafana is still failing after that, the run fails as it did before.get_workflow_issues()also calledissue.get_labels()for every open and closedflaky_testissue, which is one extra API request per issue. The labels already come with the issue listing, so it now readsissue.labels.I added
test_flaky_test_detection.pynext to the existing tool tests. It covers alert parsing, retrying after a 503, no retry on a 404, the timeout, and the label lookup. The Grafana tests run against a small local HTTP server, so the real retry path is exercised.Fixes #40662