Internal Release 0.3.0

Add configurable exception reporter
Avoid leaking tool exceptions by sending them to a configurable exception reporter
Add optional context to pass to tools
Add basic instrumentation data/labels
This commit is contained in:
Topher Bullock 2025-03-24 08:02:32 -04:00
commit 0645351585

View file

@ -0,0 +1,24 @@
# frozen_string_literal: true
module InstrumentationTestHelper
class Instrumentation
attr_reader :callback
attr_reader :data
def initialize
@callback = ->(data) { @data = data }
end
end
def instrumentation_helper
@instrumentation_helper ||= Instrumentation.new
end
def assert_instrumentation_data(expected_data)
data = instrumentation_helper.data.dup
duration = data.delete(:duration)
assert_not_nil(duration, "Duration is not set")
assert_operator(duration, :>=, 0, "Duration is not positive or zero")
assert_equal(expected_data, data, "Instrumentation data does not match expected data")
end
end