lib/opentelemetry/context.rb in opentelemetry-api-1.2.4 vs lib/opentelemetry/context.rb in opentelemetry-api-1.2.5
- old
+ new
@@ -111,11 +111,14 @@
# @param [String] key The lookup key
def value(key)
current.value(key)
end
+ # Clears the fiber-local Context stack. This allocates a new array for the
+ # stack, which is important in some use-cases to avoid sharing the backing
+ # array between fibers.
def clear
- stack.clear
+ Thread.current[STACK_KEY] = []
end
def empty
new(EMPTY_ENTRIES)
end