Skip to content

Commit

Permalink
Rename the OpenTelemetry::Instrumentation::ActiveSupport::SpanSubscri…
Browse files Browse the repository at this point in the history
…ber name parameter to pattern
  • Loading branch information
erichmachado committed Dec 13, 2024
1 parent ae89d18 commit ed978b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand All @@ -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', {})
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit ed978b2

Please sign in to comment.