99from datetime import datetime , timezone
1010from operator import itemgetter
1111from time import time
12- from typing import Any , TypedDict
12+ from typing import Any
1313from uuid import UUID
1414
1515import msgpack
5858from sentry .profiles .utils import (
5959 Profile ,
6060 apply_stack_trace_rules_to_profile ,
61- get_from_profiling_service ,
6261)
6362from sentry .search .utils import DEVICE_CLASS
6463from sentry .signals import first_profile_received
@@ -1075,62 +1074,6 @@ def _track_failed_outcome(profile: Profile, project: Project, reason: str) -> No
10751074 )
10761075
10771076
1078- @metrics .wraps ("process_profile.insert_vroom_profile" )
1079- def _insert_vroom_profile (profile : Profile ) -> bool :
1080- with sentry_sdk .start_span (op = "task.profiling.insert_vroom" ):
1081- try :
1082- path = "/chunk" if "profiler_id" in profile else "/profile"
1083- response = get_from_profiling_service (
1084- method = "POST" ,
1085- path = path ,
1086- json_data = profile ,
1087- metric = (
1088- "profiling.profile.payload.size" ,
1089- {
1090- "type" : "chunk" if "profiler_id" in profile else "profile" ,
1091- "platform" : profile ["platform" ],
1092- },
1093- ),
1094- )
1095-
1096- sentry_sdk .set_tag ("vroom.response.status_code" , str (response .status ))
1097-
1098- reason = "bad status"
1099-
1100- if response .status == 204 :
1101- return True
1102- elif response .status == 429 :
1103- reason = "gcs timeout"
1104- elif response .status == 412 :
1105- reason = "duplicate profile"
1106-
1107- metrics .incr (
1108- "process_profile.insert_vroom_profile.error" ,
1109- tags = {
1110- "platform" : profile ["platform" ],
1111- "reason" : reason ,
1112- "status_code" : response .status ,
1113- },
1114- sample_rate = 1.0 ,
1115- )
1116- return False
1117- except Exception as e :
1118- sentry_sdk .capture_exception (e )
1119- metrics .incr (
1120- "process_profile.insert_vroom_profile.error" ,
1121- tags = {"platform" : profile ["platform" ], "reason" : "encountered error" },
1122- sample_rate = 1.0 ,
1123- )
1124- return False
1125-
1126-
1127- def _push_profile_to_vroom (profile : Profile , project : Project ) -> bool :
1128- if _insert_vroom_profile (profile = profile ):
1129- return True
1130- _track_failed_outcome (profile , project , "profiling_failed_vroom_insertion" )
1131- return False
1132-
1133-
11341077def prepare_android_js_profile (profile : Profile ) -> None :
11351078 profile ["js_profile" ] = {"profile" : profile ["js_profile" ]}
11361079 p = profile ["js_profile" ]
@@ -1152,11 +1095,6 @@ def clean_android_js_profile(profile: Profile) -> None:
11521095 del p ["dist" ]
11531096
11541097
1155- class _ProjectKeyKwargs (TypedDict ):
1156- project_id : int
1157- use_case : str
1158-
1159-
11601098@metrics .wraps ("process_profile.track_outcome" )
11611099def _track_duration_outcome (
11621100 profile : Profile ,
0 commit comments