Skip to content

Commit 9fcc55e

Browse files
committed
Simplify stale span cleanup
1 parent 9280447 commit 9fcc55e

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

lib/sentry/opentelemetry/span_storage.ex

+3-10
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,9 @@ defmodule Sentry.OpenTelemetry.SpanStorage do
124124
end)
125125

126126
:ets.match_object(@table, {:_, {:_, :_}})
127-
|> Enum.each(fn {parent_id, {_span, stored_at}} = object ->
128-
cond do
129-
not is_nil(get_root_span(parent_id)) and stored_at < cutoff_time ->
130-
:ets.delete_object(@table, object)
131-
132-
is_nil(get_root_span(parent_id)) and stored_at < cutoff_time ->
133-
:ets.delete_object(@table, object)
134-
135-
true ->
136-
:ok
127+
|> Enum.each(fn {_parent_id, {_span, stored_at}} = object ->
128+
if stored_at < cutoff_time do
129+
:ets.delete_object(@table, object)
137130
end
138131
end)
139132
end

0 commit comments

Comments
 (0)