Skip to content

Commit

Permalink
revert: "feat: Use Default Span Name Format (open-telemetry#1039)"
Browse files Browse the repository at this point in the history
This reverts commit f999e70.
  • Loading branch information
arielvalentin committed Aug 8, 2024
1 parent d87f1f8 commit 94c3c3b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
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.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'
Expand Down

0 comments on commit 94c3c3b

Please sign in to comment.