Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.
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
8 changes: 0 additions & 8 deletions upload/tests/views/test_bundle_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ def test_upload_bundle_analysis_success(db, client, mocker, mock_redis):
"version": "0.4.7",
"action": "bundle_analysis",
"endpoint": "bundle_analysis",
"repo_visibility": "private",
"is_using_shelter": "no",
"position": "end",
},
Expand Down Expand Up @@ -185,7 +184,6 @@ def test_upload_bundle_analysis_success_shelter(db, client, mocker, mock_redis):
"version": "0.4.7",
"action": "bundle_analysis",
"endpoint": "bundle_analysis",
"repo_visibility": "private",
"is_using_shelter": "no",
"position": "end",
},
Expand Down Expand Up @@ -224,7 +222,6 @@ def test_upload_bundle_analysis_org_token(db, client, mocker, mock_redis):
"version": "unknown-user-agent",
"action": "bundle_analysis",
"endpoint": "bundle_analysis",
"repo_visibility": "private",
"is_using_shelter": "no",
"position": "end",
},
Expand Down Expand Up @@ -271,7 +268,6 @@ def test_upload_bundle_analysis_existing_commit(db, client, mocker, mock_redis):
"version": "unknown-user-agent",
"action": "bundle_analysis",
"endpoint": "bundle_analysis",
"repo_visibility": "private",
"is_using_shelter": "no",
"position": "end",
},
Expand Down Expand Up @@ -392,7 +388,6 @@ def test_upload_bundle_analysis_github_oidc_auth(
"version": "unknown-user-agent",
"action": "bundle_analysis",
"endpoint": "bundle_analysis",
"repo_visibility": "private",
"is_using_shelter": "no",
"position": "end",
},
Expand Down Expand Up @@ -453,7 +448,6 @@ def test_upload_bundle_analysis_measurement_datasets_created(
"version": "0.4.7",
"action": "bundle_analysis",
"endpoint": "bundle_analysis",
"repo_visibility": "private",
"is_using_shelter": "no",
"position": "end",
},
Expand Down Expand Up @@ -515,7 +509,6 @@ def test_upload_bundle_analysis_measurement_timeseries_disabled(
"version": "0.4.7",
"action": "bundle_analysis",
"endpoint": "bundle_analysis",
"repo_visibility": "private",
"is_using_shelter": "no",
"position": "end",
},
Expand Down Expand Up @@ -612,7 +605,6 @@ def test_upload_bundle_analysis_tokenless_success(db, client, mocker, mock_redis
"version": "0.4.7",
"action": "bundle_analysis",
"endpoint": "bundle_analysis",
"repo_visibility": "public",
"is_using_shelter": "no",
"position": "end",
},
Expand Down
27 changes: 19 additions & 8 deletions upload/views/bundle_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"action",
"endpoint",
"is_using_shelter",
"repo_visibility",
"position",
],
)
Expand Down Expand Up @@ -81,15 +80,22 @@
return repo_auth_custom_exception_handler

def post(self, request: HttpRequest) -> Response:
BUNDLE_ANALYSIS_UPLOAD_VIEWS_COUNTER.labels(
**generate_upload_sentry_metrics_tags(
try:
labels = generate_upload_sentry_metrics_tags(
action="bundle_analysis",
endpoint="bundle_analysis",
request=self.request,
is_shelter_request=self.is_shelter_request(),
position="start",
)
).inc()
BUNDLE_ANALYSIS_UPLOAD_VIEWS_COUNTER.labels(**labels).inc()
except Exception:
log.warn(

Check warning on line 93 in upload/views/bundle_analysis.py

View check run for this annotation

Codecov Notifications / codecov/patch

upload/views/bundle_analysis.py#L92-L93

Added lines #L92 - L93 were not covered by tests
"Failed to BUNDLE_ANALYSIS_UPLOAD_VIEWS_COUNTER",
exc_info=True,
extra=labels,
)

serializer = UploadSerializer(data=request.data)
if not serializer.is_valid():
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
Expand Down Expand Up @@ -168,16 +174,21 @@
task_arguments=task_arguments,
),
)
BUNDLE_ANALYSIS_UPLOAD_VIEWS_COUNTER.labels(
**generate_upload_sentry_metrics_tags(
try:
labels = generate_upload_sentry_metrics_tags(
action="bundle_analysis",
endpoint="bundle_analysis",
request=self.request,
repository=repo,
is_shelter_request=self.is_shelter_request(),
position="end",
)
).inc()
BUNDLE_ANALYSIS_UPLOAD_VIEWS_COUNTER.labels(**labels).inc()
except Exception:
log.warn(

Check warning on line 187 in upload/views/bundle_analysis.py

View check run for this annotation

Codecov Notifications / codecov/patch

upload/views/bundle_analysis.py#L186-L187

Added lines #L186 - L187 were not covered by tests
"Failed to BUNDLE_ANALYSIS_UPLOAD_VIEWS_COUNTER",
exc_info=True,
extra=labels,
)

dispatch_upload_task(
task_arguments,
Expand Down
Loading