diff --git a/instrumentation/rack/example/trace_demonstration.rb b/instrumentation/rack/example/trace_demonstration.rb index e6253f57cf..02fc8a7128 100644 --- a/instrumentation/rack/example/trace_demonstration.rb +++ b/instrumentation/rack/example/trace_demonstration.rb @@ -18,7 +18,7 @@ builder = Rack::Builder.app do # integration should be automatic in web frameworks (like rails), # but for a plain Rack application, enable it in your config.ru, e.g., - use OpenTelemetry::Instrumentation::Rack::Middlewares::TracerMiddleware + use ::Rack::Events, [OpenTelemetry::Instrumentation::Rack::Middlewares::EventHandler.new] app = ->(_env) { [200, { 'Content-Type' => 'text/plain' }, ['All responses are OK']] } run app diff --git a/instrumentation/rack/example/trace_demonstration2.rb b/instrumentation/rack/example/trace_demonstration2.rb index c6ac649e9e..66941cfb07 100644 --- a/instrumentation/rack/example/trace_demonstration2.rb +++ b/instrumentation/rack/example/trace_demonstration2.rb @@ -24,7 +24,7 @@ end # integrate instrumentation explicitly: -builder.use OpenTelemetry::Instrumentation::Rack::Middlewares::TracerMiddleware +builder.use ::Rack::Events, [OpenTelemetry::Instrumentation::Rack::Middlewares::EventHandler.new] # demonstrate tracing (span output to console): puts Rack::MockRequest.new(builder).get('/') diff --git a/instrumentation/rack/example/trace_demonstration3.rb b/instrumentation/rack/example/trace_demonstration3.rb index a444ecfebe..38226a72a1 100644 --- a/instrumentation/rack/example/trace_demonstration3.rb +++ b/instrumentation/rack/example/trace_demonstration3.rb @@ -19,7 +19,7 @@ builder = Rack::Builder.app do # integration should be automatic in web frameworks (like rails), # but for a plain Rack application, enable it in your config.ru, e.g., - use OpenTelemetry::Instrumentation::Rack::Middlewares::TracerMiddleware + use ::Rack::Events, [OpenTelemetry::Instrumentation::Rack::Middlewares::EventHandler.new] app = ->(_env) { [200, { 'Content-Type' => 'text/plain' }, ['All responses are OK']] } run app diff --git a/instrumentation/rack/lib/opentelemetry/instrumentation/rack/instrumentation.rb b/instrumentation/rack/lib/opentelemetry/instrumentation/rack/instrumentation.rb index 35be3a5199..4ae265b7e0 100644 --- a/instrumentation/rack/lib/opentelemetry/instrumentation/rack/instrumentation.rb +++ b/instrumentation/rack/lib/opentelemetry/instrumentation/rack/instrumentation.rb @@ -29,7 +29,7 @@ class Instrumentation < OpenTelemetry::Instrumentation::Base option :untraced_requests, default: nil, validate: :callable option :response_propagators, default: [], validate: :array # This option is only valid for applicaitons using Rack 2.0 or greater - option :use_rack_events, default: false, validate: :boolean + option :use_rack_events, default: true, validate: :boolean # Temporary Helper for Sinatra and ActionPack middleware to use during installation # diff --git a/instrumentation/rack/test/opentelemetry/instrumentation/rack/instrumentation_test.rb b/instrumentation/rack/test/opentelemetry/instrumentation/rack/instrumentation_test.rb index 2814bde0df..1db654ddd3 100644 --- a/instrumentation/rack/test/opentelemetry/instrumentation/rack/instrumentation_test.rb +++ b/instrumentation/rack/test/opentelemetry/instrumentation/rack/instrumentation_test.rb @@ -32,7 +32,7 @@ _(instrumentation.config[:url_quantization]).must_be_nil _(instrumentation.config[:untraced_requests]).must_be_nil _(instrumentation.config[:response_propagators]).must_be_empty - _(instrumentation.config[:use_rack_events]).must_equal false + _(instrumentation.config[:use_rack_events]).must_equal true end end