Skip to content

Commit f123daa

Browse files
taloricsharang
authored andcommitted
[app] unique func for get epoch sec from id
1 parent 311f12b commit f123daa

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

app/app/application/l7_flow_tracing.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ async def query_all_flows(self, time_filter: str, l7_flow_ids: list,
608608
# build _id IN (xxx) conditions, grouping _id base on the same seconds
609609
iddict = dict()
610610
for flow_id in l7_flow_ids:
611-
seconds = flow_id >> 32
611+
seconds = _get_epochsecond(flow_id)
612612
iddict.setdefault(seconds, []).append(str(flow_id))
613613
# fix start_time from min to max extract from _id
614614
min_start_time = list(iddict.keys())[-1] if len(
@@ -2831,3 +2831,11 @@ def _set_parent_mount_info(flow: dict, flow_parent: dict, info: str = None):
28312831

28322832
def generate_span_id():
28332833
return hex(RandomIdGenerator().generate_span_id())
2834+
2835+
2836+
def _get_epochsecond(id: int):
2837+
"""
2838+
`id` encode with (second<<32 | extra flag)
2839+
so we can get epoch second from id with right shift 32 bits
2840+
"""
2841+
return id >> 32

0 commit comments

Comments
 (0)