|
@@ -1,14 +1,13 @@
|
|
|
from typing import Any
|
|
|
|
|
|
-from django.conf import settings
|
|
|
from rest_framework.request import Request
|
|
|
from rest_framework.response import Response
|
|
|
|
|
|
from sentry import features
|
|
|
from sentry.api.bases.organization import OrganizationEndpoint
|
|
|
from sentry.api.paginator import GenericOffsetPaginator
|
|
|
-from sentry.http import safe_urlopen
|
|
|
from sentry.models import Organization
|
|
|
+from sentry.utils.profiling import get_from_profiling_service, proxy_profiling_service
|
|
|
|
|
|
PROFILE_FILTERS = [
|
|
|
"android_api_level",
|
|
@@ -43,10 +42,8 @@ class OrganizationProfilingProfilesEndpoint(OrganizationEndpoint):
|
|
|
def data_fn(offset: int, limit: int) -> Any:
|
|
|
params["offset"] = offset
|
|
|
params["limit"] = limit
|
|
|
- response = safe_urlopen(
|
|
|
- f"{settings.SENTRY_PROFILING_SERVICE_URL}/organizations/{organization.id}/profiles",
|
|
|
- method="GET",
|
|
|
- params=params,
|
|
|
+ response = get_from_profiling_service(
|
|
|
+ "GET", f"/organizations/{organization.id}/profiles", params=params
|
|
|
)
|
|
|
return response.json().get("profiles", [])
|
|
|
|
|
@@ -69,10 +66,6 @@ class OrganizationProfilingFiltersEndpoint(OrganizationEndpoint):
|
|
|
if len(projects) > 0:
|
|
|
params["project"] = [p.id for p in projects]
|
|
|
|
|
|
- response = safe_urlopen(
|
|
|
- f"{settings.SENTRY_PROFILING_SERVICE_URL}/organizations/{organization.id}/filters",
|
|
|
- method="GET",
|
|
|
- params=params,
|
|
|
+ return proxy_profiling_service(
|
|
|
+ "GET", f"/organizations/{organization.id}/filters", params=params
|
|
|
)
|
|
|
-
|
|
|
- return Response(response.json(), status=200)
|