From ed978b2dd9109abd55ad5c437d95e84f2abe472f Mon Sep 17 00:00:00 2001 From: Erich Soares Machado Date: Fri, 13 Dec 2024 10:18:49 -0500 Subject: [PATCH] Rename the OpenTelemetry::Instrumentation::ActiveSupport::SpanSubscriber name parameter to pattern --- .../instrumentation/active_support/span_subscriber.rb | 6 +++--- .../active_support/span_subscriber_test.rb | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/instrumentation/active_support/lib/opentelemetry/instrumentation/active_support/span_subscriber.rb b/instrumentation/active_support/lib/opentelemetry/instrumentation/active_support/span_subscriber.rb index b4ce4ff47..2f7df00db 100644 --- a/instrumentation/active_support/lib/opentelemetry/instrumentation/active_support/span_subscriber.rb +++ b/instrumentation/active_support/lib/opentelemetry/instrumentation/active_support/span_subscriber.rb @@ -27,7 +27,7 @@ def self.subscribe( span_name_formatter: nil ) subscriber = OpenTelemetry::Instrumentation::ActiveSupport::SpanSubscriber.new( - name: pattern, + pattern: pattern, tracer: tracer, notification_payload_transform: notification_payload_transform, disallowed_notification_payload_keys: disallowed_notification_payload_keys, @@ -64,8 +64,8 @@ class SpanSubscriber ALWAYS_VALID_PAYLOAD_TYPES = [TrueClass, FalseClass, String, Numeric, Symbol].freeze # rubocop:disable Metrics/ParameterLists - def initialize(name:, tracer:, notification_payload_transform: nil, disallowed_notification_payload_keys: nil, kind: nil, span_name_formatter: nil) - @pattern = name + def initialize(pattern:, tracer:, notification_payload_transform: nil, disallowed_notification_payload_keys: nil, kind: nil, span_name_formatter: nil) + @pattern = pattern @tracer = tracer @notification_payload_transform = notification_payload_transform @disallowed_notification_payload_keys = Array(disallowed_notification_payload_keys) diff --git a/instrumentation/active_support/test/opentelemetry/instrumentation/active_support/span_subscriber_test.rb b/instrumentation/active_support/test/opentelemetry/instrumentation/active_support/span_subscriber_test.rb index 1d25ba0e9..87f562362 100644 --- a/instrumentation/active_support/test/opentelemetry/instrumentation/active_support/span_subscriber_test.rb +++ b/instrumentation/active_support/test/opentelemetry/instrumentation/active_support/span_subscriber_test.rb @@ -15,7 +15,7 @@ let(:notification_name) { 'bar.foo' } let(:subscriber) do OpenTelemetry::Instrumentation::ActiveSupport::SpanSubscriber.new( - name: notification_name, + pattern: notification_name, tracer: tracer, kind: span_kind ) @@ -37,7 +37,7 @@ def finish(name, id, payload) it 'uses the provided tracer' do subscriber = OpenTelemetry::Instrumentation::ActiveSupport::SpanSubscriber.new( - name: 'oh.hai', + pattern: 'oh.hai', tracer: OpenTelemetry.tracer_provider.tracer('foo') ) span, = subscriber.start('oh.hai', 'abc', {}) @@ -111,7 +111,7 @@ def finish(name, id, payload) describe 'instrumentation option - disallowed_notification_payload_keys' do let(:subscriber) do OpenTelemetry::Instrumentation::ActiveSupport::SpanSubscriber.new( - name: notification_name, + pattern: notification_name, tracer: tracer, notification_payload_transform: nil, disallowed_notification_payload_keys: [:foo] @@ -149,7 +149,7 @@ def finish(name, id, payload) let(:transformer_proc) { ->(v) { v.transform_values { 'optimus prime' } } } let(:subscriber) do OpenTelemetry::Instrumentation::ActiveSupport::SpanSubscriber.new( - name: notification_name, + pattern: notification_name, tracer: tracer, notification_payload_transform: transformer_proc, disallowed_notification_payload_keys: [:foo]