Skip to content

Commit

Permalink
[app] unique func for get epoch sec from id
Browse files Browse the repository at this point in the history
  • Loading branch information
taloric authored and sharang committed Jun 20, 2024
1 parent 311f12b commit f123daa
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/app/application/l7_flow_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ async def query_all_flows(self, time_filter: str, l7_flow_ids: list,
# build _id IN (xxx) conditions, grouping _id base on the same seconds
iddict = dict()
for flow_id in l7_flow_ids:
seconds = flow_id >> 32
seconds = _get_epochsecond(flow_id)
iddict.setdefault(seconds, []).append(str(flow_id))
# fix start_time from min to max extract from _id
min_start_time = list(iddict.keys())[-1] if len(
Expand Down Expand Up @@ -2831,3 +2831,11 @@ def _set_parent_mount_info(flow: dict, flow_parent: dict, info: str = None):

def generate_span_id():
return hex(RandomIdGenerator().generate_span_id())


def _get_epochsecond(id: int):
"""
`id` encode with (second<<32 | extra flag)
so we can get epoch second from id with right shift 32 bits
"""
return id >> 32

0 comments on commit f123daa

Please sign in to comment.