|
1 | 1 | from typing import Any
|
2 | 2 |
|
3 | 3 | import orjson
|
4 |
| -from django.http import HttpResponse, HttpResponseRedirect |
5 |
| -from rest_framework import serializers |
| 4 | +from django.http import HttpResponse |
6 | 5 | from rest_framework.request import Request
|
7 | 6 | from rest_framework.response import Response
|
8 | 7 |
|
|
14 | 13 | from sentry.api.serializers import serialize
|
15 | 14 | from sentry.models.project import Project
|
16 | 15 | from sentry.models.release import Release
|
17 |
| -from sentry.organizations.absolute_url import generate_organization_url |
18 | 16 | from sentry.profiles.utils import get_from_profiling_service, proxy_profiling_service
|
19 | 17 |
|
20 | 18 |
|
@@ -98,50 +96,3 @@ def get(
|
98 | 96 | "path": f"/organizations/{project.organization_id}/projects/{project.id}/raw_chunks/{profiler_id}/{chunk_id}",
|
99 | 97 | }
|
100 | 98 | return proxy_profiling_service(**kwargs)
|
101 |
| - |
102 |
| - |
103 |
| -class ProjectProfileEventSerializer(serializers.Serializer): |
104 |
| - name = serializers.CharField(required=False) |
105 |
| - package = serializers.CharField(required=False) |
106 |
| - |
107 |
| - def validate(self, data): |
108 |
| - if "name" not in data and "package" in data: |
109 |
| - raise serializers.ValidationError("The package was specified with no name") |
110 |
| - |
111 |
| - if "name" in data: |
112 |
| - data["package"] = data.get("package", "") |
113 |
| - |
114 |
| - return data |
115 |
| - |
116 |
| - |
117 |
| -@region_silo_endpoint |
118 |
| -class ProjectProfilingEventEndpoint(ProjectProfilingBaseEndpoint): |
119 |
| - def convert_args(self, request: Request, *args, **kwargs): |
120 |
| - # disables the auto conversion of project slug inherited from the |
121 |
| - # project endpoint since this takes the project id instead of the slug |
122 |
| - return (args, kwargs) |
123 |
| - |
124 |
| - def get(self, request: Request, project_id, profile_id: str) -> HttpResponse: |
125 |
| - try: |
126 |
| - project = Project.objects.get_from_cache(id=project_id) |
127 |
| - except Project.DoesNotExist: |
128 |
| - return HttpResponse(status=404) |
129 |
| - |
130 |
| - if not features.has("organizations:profiling", project.organization, actor=request.user): |
131 |
| - return Response(status=404) |
132 |
| - |
133 |
| - serializer = ProjectProfileEventSerializer(data=request.GET) |
134 |
| - if not serializer.is_valid(): |
135 |
| - return Response(serializer.errors, status=400) |
136 |
| - data = serializer.validated_data |
137 |
| - |
138 |
| - org_url = generate_organization_url(project.organization.slug) |
139 |
| - |
140 |
| - redirect_url = f"{org_url}/profiling/profile/{project.slug}/{profile_id}/flamechart/" |
141 |
| - |
142 |
| - if data: |
143 |
| - name = data["name"] |
144 |
| - package = data["package"] |
145 |
| - redirect_url = f"{redirect_url}?frameName={name}&framePackage={package}" |
146 |
| - |
147 |
| - return HttpResponseRedirect(redirect_url) |
0 commit comments