-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
feat(code_review): Improve debuggability #106567
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
base: master
Are you sure you want to change the base?
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 |
|---|---|---|
|
|
@@ -70,6 +70,7 @@ def handle_check_run_event( | |
| *, | ||
| github_event: GithubWebhookType, | ||
| event: Mapping[str, Any], | ||
| extra: Mapping[str, str | None], | ||
| **kwargs: Any, | ||
| ) -> None: | ||
| """ | ||
|
|
@@ -87,8 +88,6 @@ def handle_check_run_event( | |
| return | ||
|
|
||
| action = event.get("action") | ||
| # We can use html_url to search through the logs for this event. | ||
| extra = {"html_url": event.get("check_run", {}).get("html_url"), "action": action} | ||
|
Member
Author
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.
|
||
|
|
||
| if action is None: | ||
| logger.error(Log.MISSING_ACTION.value, extra=extra) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ | |
|
|
||
| from ..metrics import record_webhook_filtered | ||
| from ..preflight import CodeReviewPreflightService | ||
| from ..utils import extract_github_info | ||
| from .check_run import handle_check_run_event | ||
| from .issue_comment import handle_issue_comment_event | ||
| from .pull_request import handle_pull_request_event | ||
|
|
@@ -46,16 +47,17 @@ def handle_webhook_event( | |
| integration: The GitHub integration | ||
| **kwargs: Additional keyword arguments | ||
| """ | ||
| # The extracted important key values are used for debugging with logs | ||
| extra = extract_github_info(event, github_event=github_event.value) | ||
| extra["organization_slug"] = organization.slug | ||
|
Member
Author
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. Currently, we only have a couple of keys to filter-by. Here's a screenshot using these kind of keys on Sentry Logs (link):
|
||
|
|
||
| # Skip GitHub Enterprise on-prem - code review is only supported for GitHub Cloud | ||
| if integration and integration.provider == IntegrationProviderSlug.GITHUB_ENTERPRISE: | ||
| return | ||
|
|
||
| handler = EVENT_TYPE_TO_HANDLER.get(github_event) | ||
| if handler is None: | ||
| logger.warning( | ||
| "github.webhook.handler.not_found", | ||
| extra={"github_event": github_event.value}, | ||
| ) | ||
| logger.warning("github.webhook.handler.not_found", extra=extra) | ||
cursor[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return | ||
|
|
||
| from ..utils import get_pr_author_id | ||
|
|
@@ -83,4 +85,5 @@ def handle_webhook_event( | |
| repo=repo, | ||
| integration=integration, | ||
| org_code_review_settings=preflight.settings, | ||
| extra=extra, | ||
| ) | ||

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.
I'm just adding some missing data in these fixtures.