Skip to content

Commit 979f523

Browse files
authored
feat(profiling): add endpoint to download a raw chunk (#92292)
This adds an endpoint meant to be used for debug purposes. This we'll let us the raw chunk. Depends on: getsentry/vroom#591
1 parent 63725b0 commit 979f523

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/sentry/api/endpoints/project_profiling_profile.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,22 @@ def get(self, request: Request, project: Project, profile_id: str) -> HttpRespon
8484
return proxy_profiling_service(**kwargs)
8585

8686

87+
@region_silo_endpoint
88+
class ProjectProfilingRawChunkEndpoint(ProjectProfilingBaseEndpoint):
89+
def get(
90+
self, request: Request, project: Project, profiler_id: str, chunk_id: str
91+
) -> HttpResponse:
92+
if not features.has(
93+
"organizations:continuous-profiling", project.organization, actor=request.user
94+
):
95+
return Response(status=404)
96+
kwargs: dict[str, Any] = {
97+
"method": "GET",
98+
"path": f"/organizations/{project.organization_id}/projects/{project.id}/raw_chunks/{profiler_id}/{chunk_id}",
99+
}
100+
return proxy_profiling_service(**kwargs)
101+
102+
87103
class ProjectProfileEventSerializer(serializers.Serializer):
88104
name = serializers.CharField(required=False)
89105
package = serializers.CharField(required=False)

src/sentry/api/urls.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,7 @@
646646
from .endpoints.project_profiling_profile import (
647647
ProjectProfilingEventEndpoint,
648648
ProjectProfilingProfileEndpoint,
649+
ProjectProfilingRawChunkEndpoint,
649650
ProjectProfilingRawProfileEndpoint,
650651
)
651652
from .endpoints.project_release_commits import ProjectReleaseCommitsEndpoint
@@ -2855,6 +2856,11 @@ def create_group_urls(name_prefix: str) -> list[URLPattern | URLResolver]:
28552856
ProjectProfilingRawProfileEndpoint.as_view(),
28562857
name="sentry-api-0-project-profiling-raw-profile",
28572858
),
2859+
re_path(
2860+
r"^(?P<organization_id_or_slug>[^\/]+)/(?P<project_id_or_slug>[^\/]+)/profiling/raw_chunks/(?P<profiler_id>(?:\d+|[A-Fa-f0-9-]{32,36}))/(?P<chunk_id>(?:\d+|[A-Fa-f0-9-]{32,36}))/$",
2861+
ProjectProfilingRawChunkEndpoint.as_view(),
2862+
name="sentry-api-0-project-profiling-raw-chunk",
2863+
),
28582864
re_path(
28592865
r"^(?P<organization_id_or_slug>[^\/]+)/(?P<project_id_or_slug>[^\/]+)/statistical-detector/$",
28602866
ProjectStatisticalDetectors.as_view(),

0 commit comments

Comments
 (0)