Skip to content

Commit

Permalink
feat: Use Default Span Name Format
Browse files Browse the repository at this point in the history
It also allows users to rollback to legacy span name format.

Follow up to open-telemetry#1014
  • Loading branch information
arielvalentin committed Jun 24, 2024
1 parent e14d6b0 commit 3f5a3ae
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ 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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@ class Railtie < ::Rails::Railtie
config.after_initialize do
::OpenTelemetry::Instrumentation::ActiveSupport::Instrumentation.instance.install({})

span_name_formatter = 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(
ActionView::Instrumentation.instance.tracer,
subscription_name,
config[:notification_payload_transform],
config[:disallowed_notification_payload_keys]
config[:disallowed_notification_payload_keys],
span_name_formatter: span_name_formatter
)
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.1'
spec.add_dependency 'opentelemetry-instrumentation-active_support', '~> 0.6'
spec.add_dependency 'opentelemetry-instrumentation-base', '~> 0.22.1'

spec.add_development_dependency 'appraisal', '~> 2.5'
Expand Down

0 comments on commit 3f5a3ae

Please sign in to comment.