Skip to content
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

feat(codecov-v2): Add more logging #45225

Merged
merged 2 commits into from
Feb 28, 2023
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
11 changes: 9 additions & 2 deletions src/sentry/api/endpoints/project_stacktrace_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import Any, Dict, List, Mapping, Optional

import requests
from rest_framework import status
from rest_framework.request import Request
from rest_framework.response import Response
from sentry_sdk import Scope, configure_scope
Expand Down Expand Up @@ -399,13 +400,19 @@ def get(self, request: Request, project: Project) -> Response:
}
if error.response.status_code != 404:
logger.exception(
"Failed to get expected data from Codecov, pending investigation. Continuing execution."
"Failed to get expected data from Codecov. Continuing execution."
)
except requests.Timeout:
scope.set_tag("codecov.timeout", True)
result["codecov"] = {
"status": status.HTTP_408_REQUEST_TIMEOUT,
}
logger.exception("Codecov request timed out. Continuing execution.")
except Exception:
logger.exception("Something unexpected happen. Continuing execution.")
result["codecov"] = {
"status": status.HTTP_500_INTERNAL_SERVER_ERROR,
}
logger.exception("Something unexpected happened. Continuing execution.")
# We don't expect coverage data if the integration does not exist (404)

try:
Expand Down
2 changes: 1 addition & 1 deletion tests/sentry/api/endpoints/test_project_stacktrace_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ def test_codecov_line_coverage_exception(self, mock_integration):
(
"sentry.api.endpoints.project_stacktrace_link",
logging.ERROR,
"Something unexpected happen. Continuing execution.",
"Something unexpected happened. Continuing execution.",
)
]

Expand Down