Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ Metrics/PerceivedComplexity:
Naming/FileName:
Exclude:
- '**/opentelemetry-*'
### TODO: Enable this is a separate PR
Naming/BlockForwarding:
Enabled: false
Style/ArgumentsForwarding:
Enabled: false
#######################
Style/Documentation:
Exclude:
- "**/test/**/*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
end
end

def with_configuration(values, &block)
def with_configuration(values, &)
original_config = instrumentation.instance_variable_get(:@config)
modified_config = original_config.merge(values)
instrumentation.instance_variable_set(:@config, modified_config)
Expand All @@ -126,14 +126,14 @@ def with_configuration(values, &block)
instrumentation.instance_variable_set(:@config, original_config)
end

def subscribing_to_deliver(&block)
def subscribing_to_deliver(&)
subscription = OpenTelemetry::Instrumentation::ActionMailer::Railtie.subscribe_to_deliver
yield
ensure
ActiveSupport::Notifications.unsubscribe(subscription)
end

def subscribing_to_process(&block)
def subscribing_to_process(&)
subscription = OpenTelemetry::Instrumentation::ActionMailer::Railtie.subscribe_to_process
yield
ensure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,91 +29,91 @@ def destroy!
end
end

def becomes(klass)
def becomes(...)
tracer.in_span("#{self.class}#becomes") do
super
end
end

def becomes!(klass)
def becomes!(...)
tracer.in_span("#{self.class}#becomes!") do
super
end
end

def update_attribute(name, value)
def update_attribute(...)
tracer.in_span("#{self.class}#update_attribute") do
super
end
end

def update(attributes)
def update(...)
tracer.in_span("#{self.class}#update") do
super
end
end

def update!(attributes)
def update!(...)
tracer.in_span("#{self.class}#update!") do
super
end
end

def update_column(name, value)
def update_column(...)
tracer.in_span("#{self.class}#update_column") do
super
end
end

def update_columns(attributes)
def update_columns(...)
tracer.in_span("#{self.class}#update_columns") do
super
end
end

def increment(attribute, by = 1)
def increment(...)
tracer.in_span("#{self.class}#increment") do
super
end
end

def increment!(attribute, by = 1, touch: nil)
def increment!(...)
tracer.in_span("#{self.class}#increment!") do
super
end
end

def decrement(attribute, by = 1)
def decrement(...)
tracer.in_span("#{self.class}#decrement") do
super
end
end

def decrement!(attribute, by = 1, touch: nil)
def decrement!(...)
tracer.in_span("#{self.class}#decrement!") do
super
end
end

def toggle(attribute)
def toggle(...)
tracer.in_span("#{self.class}#toggle") do
super
end
end

def toggle!(attribute)
def toggle!(...)
tracer.in_span("#{self.class}#toggle!") do
super
end
end

def reload(options = nil)
def reload(...)
tracer.in_span("#{self.class}#reload") do
super
end
end

def touch(*names, time: nil)
def touch(...)
tracer.in_span("#{self.class}#touch") do
super
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,31 @@ class << base

# Contains ActiveRecord::Persistence::ClassMethods to be patched
module ClassMethods
def create(attributes = nil, &block)
def create(...)
tracer.in_span("#{self}.create") do
super
end
end

def create!(attributes = nil, &block)
def create!(...)
tracer.in_span("#{self}.create!") do
super
end
end

def update(id = :all, attributes) # rubocop:disable Style/OptionalArguments
def update(...)
tracer.in_span("#{self}.update") do
super
end
end

def destroy(id)
def destroy(...)
tracer.in_span("#{self}.destroy") do
super
end
end

def delete(id_or_array)
def delete(...)
tracer.in_span("#{self}.delete") do
super
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,37 @@ class << base

# Contains ActiveRecord::Persistence::ClassMethods to be patched
module ClassMethods
ruby2_keywords def insert(*args)
def insert(...)
tracer.in_span("#{self}.insert") do
super
end
end

ruby2_keywords def insert_all(*args)
def insert_all(...)
tracer.in_span("#{self}.insert_all") do
super
end
end

ruby2_keywords def insert!(*args)
def insert!(...)
tracer.in_span("#{self}.insert!") do
super
end
end

ruby2_keywords def insert_all!(*args)
def insert_all!(...)
tracer.in_span("#{self}.insert_all!") do
super
end
end

ruby2_keywords def upsert(*args)
def upsert(...)
tracer.in_span("#{self}.upsert") do
super
end
end

ruby2_keywords def upsert_all(*args)
def upsert_all(...)
tracer.in_span("#{self}.upsert_all") do
super
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ module ActiveRecord
module Patches
# Module to prepend to ActiveRecord::Relation for instrumentation
module RelationPersistence
def update_all(*)
def update_all(...)
tracer.in_span("#{model.name}.update_all") do
super
end
end

def delete_all(*)
def delete_all(...)
tracer.in_span("#{model.name}.delete_all") do
super
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class << base

# Contains ActiveRecord::Transactions::ClassMethods to be patched
module ClassMethods
def transaction(**options, &block)
def transaction(...)
tracer.in_span('ActiveRecord.transaction', attributes: { 'code.namespace' => name }) do
super
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ module Patches
# https://github.com/rails/rails/blob/v5.2.4.5/activerecord/lib/active_record/validations.rb#L42-L53
# Contains the ActiveRecord::Validations methods to be patched
module Validations
def save(**options)
def save(...)
tracer.in_span("#{self.class}#save") do
super
end
end

def save!(**options)
def save!(...)
tracer.in_span("#{self.class}#save!") do
super
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@
# NOTE: The test for service_update_metadata.active_storage is skipped because this event is only for GCS service.
# https://github.com/rails/rails/blob/fa9cf269191c5077de1abdd1e3f934fbeaf2a5d0/guides/source/active_support_instrumentation.md?plain=1#L928

def with_configuration(values, &block)
def with_configuration(values, &)
original_config = instrumentation.instance_variable_get(:@config)
modified_config = original_config.merge(values)
instrumentation.instance_variable_set(:@config, modified_config)
Expand All @@ -351,7 +351,7 @@ def with_configuration(values, &block)
instrumentation.instance_variable_set(:@config, original_config)
end

def with_subscription(&block)
def with_subscription(&)
OpenTelemetry::Instrumentation::ActiveStorage::Railtie.subscribe
yield
ensure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def preview(**options)

private

def draw_sample_image(file, &block)
draw 'echo', '"test previewer called"', &block
def draw_sample_image(file, &)
draw('echo', '"test previewer called"', &)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def call(context)

private

def span_wrapper(context, &block)
def span_wrapper(context, &)
service_id = HandlerHelper.service_id(context)
client_method = HandlerHelper.client_method(service_id, context)
context.tracer.in_span(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ module Bunny
# For additional details around trace messaging semantics
# See https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/messaging.md#messaging-attributes
module PatchHelpers
def self.with_send_span(channel, tracer, exchange, routing_key, &block)
def self.with_send_span(channel, tracer, exchange, routing_key, &)
attributes = basic_attributes(channel, channel.connection, exchange, routing_key)
destination = destination_name(exchange, routing_key)

tracer.in_span("#{destination} publish", attributes: attributes, kind: :producer, &block)
tracer.in_span("#{destination} publish", attributes: attributes, kind: :producer, &)
end

def self.with_process_span(channel, tracer, delivery_info, properties, &block)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ module Patches
# Concurrent::ThreadPoolExecutor patch for instrumentation
module ThreadPoolExecutor
# @see Concurrent::ExecutorService#post
def post(*args, **kwargs, &task)
def post(*args, **kwargs, &)
context = OpenTelemetry::Context.current
return super unless context

super(*args, **kwargs) do # rubocop:disable Style/SuperArguments
super do
OpenTelemetry::Context.with_current(context) do
yield(*args, **kwargs)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module Plugins
# Delayed Job plugin that instruments invoke_job and other hooks
class TracerPlugin < Delayed::Plugin
class << self
def instrument_enqueue(job, &block)
def instrument_enqueue(job, &)
return yield(job) unless enabled?

attributes = build_attributes(job)
Expand All @@ -27,7 +27,7 @@ def instrument_enqueue(job, &block)
end
end

def instrument_invoke(job, &block)
def instrument_invoke(job, &)
return yield(job) unless enabled?

attributes = build_attributes(job)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,32 +302,32 @@ def initialize(events:, **_options)
super
end

def platform_execute_field(platform_key, &block)
def platform_execute_field(platform_key, &)
@events << platform_key
yield
end

def platform_execute_field_lazy(platform_key, &block)
def platform_execute_field_lazy(platform_key, &)
@events << platform_key
yield
end

def platform_authorized(platform_key, &block)
def platform_authorized(platform_key, &)
@events << platform_key
yield
end

def platform_authorized_lazy(platform_key, &block)
def platform_authorized_lazy(platform_key, &)
@events << platform_key
yield
end

def platform_resolve_type(platform_key, &block)
def platform_resolve_type(platform_key, &)
@events << platform_key
yield
end

def platform_resolve_type_lazy(platform_key, &block)
def platform_resolve_type_lazy(platform_key, &)
@events << platform_key
yield
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module Client

private

def do_get_block(req, proxy, conn, &block)
def do_get_block(req, proxy, conn, &)
uri = req.header.request_uri
url = "#{uri.scheme}://#{uri.host}"
request_method = req.header.request_method
Expand Down
Loading
Loading