@@ -66,8 +66,9 @@ def get(self, request: Request, organization: Organization) -> HttpResponse:
6666 if not features .has (
6767 "organizations:continuous-profiling-compat" , organization , actor = request .user
6868 ):
69- params = self .get_snuba_params (request , organization )
70- project_ids = params ["project_id" ]
69+ snuba_params , _ = self .get_snuba_dataclass (request , organization )
70+
71+ project_ids = snuba_params .project_ids
7172 if len (project_ids ) > 1 :
7273 raise ParseError (detail = "You cannot get a flamegraph from multiple projects." )
7374
@@ -79,12 +80,12 @@ def get(self, request: Request, organization: Organization) -> HttpResponse:
7980 organization .id ,
8081 project_ids [0 ],
8182 function_fingerprint ,
82- params ,
83+ snuba_params ,
8384 request .GET .get ("query" , "" ),
8485 )
8586 else :
8687 sentry_sdk .set_tag ("dataset" , "profiles" )
87- profile_ids = get_profile_ids (params , request .query_params .get ("query" , None ))
88+ profile_ids = get_profile_ids (snuba_params , request .query_params .get ("query" , None ))
8889
8990 return proxy_profiling_service (
9091 method = "POST" ,
@@ -125,26 +126,28 @@ def get(self, request: Request, organization: Organization) -> HttpResponse:
125126 return Response (status = 404 )
126127
127128 # We disable the date quantizing here because we need the timestamps to be precise.
128- params = self .get_snuba_params (request , organization , quantize_date_params = False )
129+ snuba_params , _ = self .get_snuba_dataclass (
130+ request , organization , quantize_date_params = False
131+ )
129132
130- project_ids = params . get ( "project_id" )
133+ project_ids = snuba_params . project_ids
131134 if project_ids is None or len (project_ids ) != 1 :
132135 raise ParseError (detail = "one project_id must be specified." )
133136
134137 profiler_id = request .query_params .get ("profiler_id" )
135138 if profiler_id is None :
136139 raise ParseError (detail = "profiler_id must be specified." )
137140
138- chunk_ids = get_chunk_ids (params , profiler_id , project_ids [0 ])
141+ chunk_ids = get_chunk_ids (snuba_params , profiler_id , project_ids [0 ])
139142
140143 return proxy_profiling_service (
141144 method = "POST" ,
142145 path = f"/organizations/{ organization .id } /projects/{ project_ids [0 ]} /chunks" ,
143146 json_data = {
144147 "profiler_id" : profiler_id ,
145148 "chunk_ids" : chunk_ids ,
146- "start" : str (int (params [ "start" ] .timestamp () * 1e9 )),
147- "end" : str (int (params [ "end" ] .timestamp () * 1e9 )),
149+ "start" : str (int (snuba_params . start_date .timestamp () * 1e9 )),
150+ "end" : str (int (snuba_params . end_date .timestamp () * 1e9 )),
148151 },
149152 )
150153
@@ -155,10 +158,10 @@ def get(self, request: Request, organization: Organization) -> HttpResponse:
155158 if not features .has ("organizations:profiling" , organization , actor = request .user ):
156159 return Response (status = 404 )
157160
158- params = self .get_snuba_params (request , organization )
161+ snuba_params , _ = self .get_snuba_dataclass (request , organization )
159162
160- project_ids = params . get ( "project_id" )
161- if project_ids is None or len (project_ids ) != 1 :
163+ project_ids = snuba_params . project_ids
164+ if len (project_ids ) != 1 :
162165 raise ParseError (detail = "one project_id must be specified." )
163166
164167 span_group = request .query_params .get ("span_group" )
@@ -168,7 +171,7 @@ def get(self, request: Request, organization: Organization) -> HttpResponse:
168171 spans = get_spans_from_group (
169172 organization .id ,
170173 project_ids [0 ],
171- params ,
174+ snuba_params ,
172175 span_group ,
173176 )
174177
0 commit comments