diff --git a/instrumentation/action_view/lib/opentelemetry/instrumentation/action_view.rb b/instrumentation/action_view/lib/opentelemetry/instrumentation/action_view.rb index ad42d0dec..ef341c0cd 100644 --- a/instrumentation/action_view/lib/opentelemetry/instrumentation/action_view.rb +++ b/instrumentation/action_view/lib/opentelemetry/instrumentation/action_view.rb @@ -9,7 +9,7 @@ module OpenTelemetry module Instrumentation - # (see OpenTelemetry::Instrumentation::ActionView::Instrumentation) + # Contains the OpenTelemetry instrumentation for the ActionView gem module ActionView end end diff --git a/instrumentation/action_view/lib/opentelemetry/instrumentation/action_view/instrumentation.rb b/instrumentation/action_view/lib/opentelemetry/instrumentation/action_view/instrumentation.rb index bb9b60056..9087d4475 100644 --- a/instrumentation/action_view/lib/opentelemetry/instrumentation/action_view/instrumentation.rb +++ b/instrumentation/action_view/lib/opentelemetry/instrumentation/action_view/instrumentation.rb @@ -7,42 +7,7 @@ module OpenTelemetry module Instrumentation module ActionView - # The {OpenTelemetry::Instrumentation::ActionView::Instrumentation} class contains logic to detect and install the ActionView instrumentation - # - # Installation and configuration of this instrumentation is done within the - # {https://www.rubydoc.info/gems/opentelemetry-sdk/OpenTelemetry/SDK#configure-instance_method OpenTelemetry::SDK#configure} - # block, calling {https://www.rubydoc.info/gems/opentelemetry-sdk/OpenTelemetry%2FSDK%2FConfigurator:use use()} - # or {https://www.rubydoc.info/gems/opentelemetry-sdk/OpenTelemetry%2FSDK%2FConfigurator:use_all use_all()}. - # - # ## Configuration keys and options - # - # ### `:disallowed_notification_payload_keys` - # - # Specifies an array of keys that should be excluded from the notification payload as span attributes. - # - # ### `:notification_payload_transform` - # - # - `proc` **default** `nil` - # - # Specifies custom proc used to extract span attributes form the notification payload. - # Use this to rename keys, extract nested values, or perform any other custom logic. - # - # ### `:legacy_span_names` - # - # - `boolean` **default** `false` - # - # Specifies whether spans names should use the legacy format where the subscription was reverse ordered and white space separated. (Ex. `action_view render_template`) - # If set to `true`, the span name will match the name of the notification itself. (Ex. `render_template.action_view`) - # - # @example An explicit default configuration - # OpenTelemetry::SDK.configure do |c| - # c.use_all({ - # 'OpenTelemetry::Instrumentation::ActionView' => { - # disallowed_notification_payload_keys: [], - # legacy_span_names: true, - # }, - # }) - # end + # The Instrumentation class contains logic to detect and install the ActionView instrumentation class Instrumentation < OpenTelemetry::Instrumentation::Base MINIMUM_VERSION = Gem::Version.new('6.1.0') install do |_config| @@ -59,7 +24,6 @@ class Instrumentation < OpenTelemetry::Instrumentation::Base option :disallowed_notification_payload_keys, default: [], validate: :array option :notification_payload_transform, default: nil, validate: :callable - option :legacy_span_names, default: false, validate: :boolean private diff --git a/instrumentation/action_view/lib/opentelemetry/instrumentation/action_view/railtie.rb b/instrumentation/action_view/lib/opentelemetry/instrumentation/action_view/railtie.rb index 2c2bf381a..276af1106 100644 --- a/instrumentation/action_view/lib/opentelemetry/instrumentation/action_view/railtie.rb +++ b/instrumentation/action_view/lib/opentelemetry/instrumentation/action_view/railtie.rb @@ -19,16 +19,13 @@ class Railtie < ::Rails::Railtie config.after_initialize do ::OpenTelemetry::Instrumentation::ActiveSupport::Instrumentation.instance.install({}) - instance = ::OpenTelemetry::Instrumentation::ActionView::Instrumentation.instance - span_name_formatter = instance.config[:legacy_span_names] ? ::OpenTelemetry::Instrumentation::ActiveSupport::LEGACY_NAME_FORMATTER : nil - SUBSCRIPTIONS.each do |subscription_name| + config = ActionView::Instrumentation.instance.config ::OpenTelemetry::Instrumentation::ActiveSupport.subscribe( - instance.tracer, + ActionView::Instrumentation.instance.tracer, subscription_name, - instance.config[:notification_payload_transform], - instance.config[:disallowed_notification_payload_keys], - span_name_formatter: span_name_formatter + config[:notification_payload_transform], + config[:disallowed_notification_payload_keys] ) end end diff --git a/instrumentation/action_view/opentelemetry-instrumentation-action_view.gemspec b/instrumentation/action_view/opentelemetry-instrumentation-action_view.gemspec index 825106243..27bd8239f 100644 --- a/instrumentation/action_view/opentelemetry-instrumentation-action_view.gemspec +++ b/instrumentation/action_view/opentelemetry-instrumentation-action_view.gemspec @@ -26,7 +26,7 @@ Gem::Specification.new do |spec| spec.required_ruby_version = '>= 3.0' spec.add_dependency 'opentelemetry-api', '~> 1.0' - spec.add_dependency 'opentelemetry-instrumentation-active_support', '~> 0.6' + spec.add_dependency 'opentelemetry-instrumentation-active_support', '~> 0.1' spec.add_dependency 'opentelemetry-instrumentation-base', '~> 0.22.1' spec.add_development_dependency 'appraisal', '~> 2.5'