Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@
end
end

it 'returns "old" when OTEL_SEMCONV_STABILITY_OPT_IN is old' do
OpenTelemetry::TestHelpers.with_env('OTEL_SEMCONV_STABILITY_OPT_IN' => 'old') do
_(instrumentation.determine_semconv).must_equal('old')
end
end

it 'returns "stable" when OTEL_SEMCONV_STABILITY_OPT_IN is http' do
OpenTelemetry::TestHelpers.with_env('OTEL_SEMCONV_STABILITY_OPT_IN' => 'http') do
_(instrumentation.determine_semconv).must_equal('stable')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
_(span.attributes['http.scheme']).must_equal 'http'
_(span.attributes['http.status_code']).must_equal 200
_(span.attributes['http.target']).must_equal '/success'
_(span.attributes['http.url']).must_equal 'http://example.com'
_(span.attributes['net.peer.name']).must_equal 'example.com'
_(span.attributes['net.peer.port']).must_equal 80
assert_requested(
Expand All @@ -72,6 +73,7 @@
_(span.attributes['http.scheme']).must_equal 'http'
_(span.attributes['http.status_code']).must_equal 500
_(span.attributes['http.target']).must_equal '/failure'
_(span.attributes['http.url']).must_equal 'http://example.com'
_(span.attributes['net.peer.name']).must_equal 'example.com'
_(span.attributes['net.peer.port']).must_equal 80
assert_requested(
Expand All @@ -92,6 +94,7 @@
_(span.attributes['http.scheme']).must_equal 'https'
_(span.attributes['http.status_code']).must_be_nil
_(span.attributes['http.target']).must_equal '/timeout'
_(span.attributes['http.url']).must_equal 'https://example.com'
_(span.attributes['net.peer.name']).must_equal 'example.com'
_(span.attributes['net.peer.port']).must_equal 443
_(span.status.code).must_equal(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@
before do
skip unless ENV['BUNDLE_GEMFILE'].include?('old')

ENV['OTEL_SEMCONV_STABILITY_OPT_IN'] = 'old'
exporter.reset
instrumentation.install({})
end

# Force re-install of instrumentation
after { instrumentation.instance_variable_set(:@installed, false) }
after do
ENV.delete('OTEL_SEMCONV_STABILITY_OPT_IN')
instrumentation.instance_variable_set(:@installed, false)
end

describe '#connect' do
it 'emits span on connect' do
Expand Down
Loading