Skip to content

Commit 0cb1de4

Browse files
authored
ref(profiles): Use encoding utilities to convert between profile IDs and EAP item IDs (#106032)
Refactoring to use a common EAP util to calculate EAP `item_id` for profiles data. Follow-up to #105981.
1 parent e259527 commit 0cb1de4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/sentry/profiles/task.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
from sentry.taskworker.retry import Retry
6868
from sentry.utils import json, metrics
6969
from sentry.utils.arroyo_producer import SingletonProducer, get_arroyo_producer
70+
from sentry.utils.eap import hex_to_item_id
7071
from sentry.utils.kafka_config import get_topic_definition
7172
from sentry.utils.locking import UnableToAcquireLock
7273
from sentry.utils.outcomes import Outcome, track_outcome
@@ -1725,7 +1726,7 @@ def build_chunk_functions_eap_trace_items(
17251726
organization_id=chunk.get_organization_id(),
17261727
project_id=chunk.get_project_id(),
17271728
trace_id=chunk.get_profiler_id(), # until we actually get a trace_id from the SDKs
1728-
item_id=int(chunk.get_profiler_id(), 16).to_bytes(16, "little"),
1729+
item_id=hex_to_item_id(chunk.get_profiler_id()),
17291730
item_type=TraceItemType.TRACE_ITEM_TYPE_PROFILE_FUNCTION,
17301731
timestamp=_timestamp(chunk.start_timestamp()),
17311732
attributes=attributes,
@@ -1801,7 +1802,7 @@ def build_profile_functions_eap_trace_items(
18011802
organization_id=profile.get_organization_id(),
18021803
project_id=profile.get_project_id(),
18031804
trace_id=profile.get_profile_id(), # until we actually get a trace_id from the SDKs
1804-
item_id=int(profile.get_profile_id(), 16).to_bytes(16, "little"),
1805+
item_id=hex_to_item_id(profile.get_profile_id()),
18051806
item_type=TraceItemType.TRACE_ITEM_TYPE_PROFILE_FUNCTION,
18061807
timestamp=_timestamp(profile.get_timestamp()),
18071808
attributes=attributes,

0 commit comments

Comments
 (0)