Skip to content

Commit c3d90e7

Browse files
committed
Skip the EXISTS check by using child_ic heuristic
1 parent a98fc40 commit c3d90e7

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/sentry/scripts/spans/add-buffer.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,10 @@ for i = NUM_ARGS + 1, NUM_ARGS + num_spans do
187187
redis.call("del", child_ibc_key)
188188
end
189189

190-
local child_members_key = string.format("span-buf:mk:{%s}:%s", project_and_trace, span_id)
191-
if redis.call("exists", child_members_key) == 1 then
190+
-- Presence of child_ic implies that this span is a root span. Only root spans have these associations.
191+
-- We can skip all the child spans (which will be no-ops) and save some Redis calls.
192+
if child_ic then
193+
local child_members_key = string.format("span-buf:mk:{%s}:%s", project_and_trace, span_id)
192194
merge_set(child_members_key, members_key)
193195
redis.call("del", child_members_key)
194196
end

0 commit comments

Comments
 (0)