File tree Expand file tree Collapse file tree 5 files changed +7
-14
lines changed
rack/lib/opentelemetry/instrumentation/rack
lib/opentelemetry/instrumentation/sinatra
test/opentelemetry/instrumentation Expand file tree Collapse file tree 5 files changed +7
-14
lines changed Original file line number Diff line number Diff line change 458458# Set up fake Rack application
459459builder = Rack::Builder.app do
460460 # Integration is automatic in web frameworks but plain Rack applications require this line.
461- # - middleware_args_old to emit old HTTP semantic conventions
462- # - middleware_args_stable to emit stable HTTP semantic conventions
463- # - middleware_args_dup to emit both old and stable HTTP semantic conventions
464461 # Enable it in your config.ru.
465- use *OpenTelemetry::Instrumentation::Rack::Instrumentation.instance.middleware_args_old
462+ use *OpenTelemetry::Instrumentation::Rack::Instrumentation.instance.middleware_args
466463 run ExampleAPI
467464end
468465app = Rack::MockRequest.new(builder)
Original file line number Diff line number Diff line change @@ -36,19 +36,19 @@ class Instrumentation < OpenTelemetry::Instrumentation::Base
3636 #
3737 # @example Default usage
3838 # Rack::Builder.new do
39- # use *OpenTelemetry::Instrumentation::Rack::Instrumenation.instance.middleware_args_old
39+ # use *OpenTelemetry::Instrumentation::Rack::Instrumenation.instance.middleware_args
4040 # run lambda { |_arg| [200, { 'Content-Type' => 'text/plain' }, body] }
4141 # end
4242 # @return [Array] consisting of a middleware and arguments used in rack builders
43- def middleware_args_old
43+ def middleware_args
4444 if config . fetch ( :use_rack_events , false ) == true && defined? ( OpenTelemetry ::Instrumentation ::Rack ::Middlewares ::Old ::EventHandler )
4545 [ ::Rack ::Events , [ OpenTelemetry ::Instrumentation ::Rack ::Middlewares ::Old ::EventHandler . new ] ]
4646 else
4747 [ OpenTelemetry ::Instrumentation ::Rack ::Middlewares ::Old ::TracerMiddleware ]
4848 end
4949 end
5050
51- alias middleware_args middleware_args_old
51+ alias middleware_args_old middleware_args
5252
5353 def middleware_args_dup
5454 if config . fetch ( :use_rack_events , false ) == true && defined? ( OpenTelemetry ::Instrumentation ::Rack ::Middlewares ::Dup ::EventHandler )
Original file line number Diff line number Diff line change @@ -47,9 +47,5 @@ class App < Sinatra::Base
4747 end
4848end
4949
50- # Rack instrumentation is moving through the process of migrating to the new HTTP semantic
51- # conventions. In this example, we will use the old HTTP conventions by patching the Rack
52- # middleware that uses the old conventions. See README: HTTP Semantic Conventions for more
53- # information.
54- use ( *OpenTelemetry ::Instrumentation ::Rack ::Instrumentation . instance . middleware_args_old )
50+ use ( *OpenTelemetry ::Instrumentation ::Rack ::Instrumentation . instance . middleware_args )
5551run App
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ def install_middleware(app)
6060 elsif values . include? ( 'http' )
6161 app . use ( *OpenTelemetry ::Instrumentation ::Rack ::Instrumentation . instance . middleware_args_stable )
6262 else
63- app . use ( *OpenTelemetry ::Instrumentation ::Rack ::Instrumentation . instance . middleware_args_old )
63+ app . use ( *OpenTelemetry ::Instrumentation ::Rack ::Instrumentation . instance . middleware_args )
6464 end
6565 end
6666
Original file line number Diff line number Diff line change @@ -198,7 +198,7 @@ class CustomError < StandardError; end
198198 let ( :app ) do
199199 apps_to_build = apps
200200 Rack ::Builder . new do
201- use ( *OpenTelemetry ::Instrumentation ::Rack ::Instrumentation . instance . middleware_args_old )
201+ use ( *OpenTelemetry ::Instrumentation ::Rack ::Instrumentation . instance . middleware_args )
202202
203203 apps_to_build . each do |root , app |
204204 map root do
You can’t perform that action at this time.
0 commit comments