-
Notifications
You must be signed in to change notification settings - Fork 13.8k
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
chore: log different selenium timeout errors differently #23290
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -176,22 +176,46 @@ def get_screenshot( | |
sleep(selenium_headstart) | ||
|
||
try: | ||
logger.debug("Wait for the presence of %s", element_name) | ||
element = WebDriverWait(driver, self._screenshot_locate_wait).until( | ||
EC.presence_of_element_located((By.CLASS_NAME, element_name)) | ||
) | ||
try: | ||
# page didn't load | ||
logger.debug( | ||
"Wait for the presence of %s at url: %s", element_name, url | ||
) | ||
element = WebDriverWait(driver, self._screenshot_locate_wait).until( | ||
EC.presence_of_element_located((By.CLASS_NAME, element_name)) | ||
) | ||
except TimeoutException as ex: | ||
logger.exception("Selenium timed out requesting url %s", url) | ||
raise ex | ||
|
||
logger.debug("Wait for chart containers to draw") | ||
WebDriverWait(driver, self._screenshot_locate_wait).until( | ||
EC.visibility_of_all_elements_located( | ||
(By.CLASS_NAME, "slice_container") | ||
try: | ||
# chart containers didn't render | ||
logger.debug("Wait for chart containers to draw at url: %s", url) | ||
WebDriverWait(driver, self._screenshot_locate_wait).until( | ||
EC.visibility_of_all_elements_located( | ||
(By.CLASS_NAME, "slice_container") | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These imo are going to be client errors, and will show as errors on the dashboard when the user views it, not just in reports. This is an example where the client db is down. Also dataset role access will show these errors. There's a flag There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is one area where I think a warning may make sense. @craig-rueda what do you think here? |
||
) | ||
) | ||
except TimeoutException as ex: | ||
logger.exception( | ||
"Selenium timed out waiting for chart containers to draw at url %s", | ||
url, | ||
) | ||
raise ex | ||
|
||
logger.debug("Wait for loading element of charts to be gone") | ||
WebDriverWait(driver, self._screenshot_load_wait).until_not( | ||
EC.presence_of_all_elements_located((By.CLASS_NAME, "loading")) | ||
) | ||
try: | ||
# charts took too long to load | ||
logger.debug( | ||
"Wait for loading element of charts to be gone at url: %s", url | ||
) | ||
WebDriverWait(driver, self._screenshot_load_wait).until_not( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this error is going to be because the client db took too long to return the data. Some optimization is possible on either the client db or the superset instance to tune timeouts. Warning vs exception here is a little questionable. |
||
EC.presence_of_all_elements_located((By.CLASS_NAME, "loading")) | ||
) | ||
except TimeoutException as ex: | ||
logger.exception( | ||
"Selenium timed out waiting for charts to load at url %s", url | ||
) | ||
raise ex | ||
|
||
selenium_animation_wait = current_app.config[ | ||
"SCREENSHOT_SELENIUM_ANIMATION_WAIT" | ||
|
@@ -215,9 +239,9 @@ def get_screenshot( | |
) | ||
|
||
img = element.screenshot_as_png | ||
|
||
except TimeoutException: | ||
logger.exception("Selenium timed out requesting url %s", url) | ||
# raise again for the finally block, but handled above | ||
pass | ||
except StaleElementReferenceException: | ||
logger.exception( | ||
"Selenium got a stale element while requesting url %s", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are most likely going to be network errors, i.e., server is down or url is incorrect, or perhaps permissions - user can't access the page.