From aaac9bbe8dc3b28cf0f5963145926f24b02a0e7d Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Tue, 10 Oct 2023 11:42:04 -0500 Subject: [PATCH] fix: Remove dependence on activesupport (#687) Instrumentations must not use transitive dependencies used by the library. In this case, relying on the gruf library to load specific ActiveSupport extensions leaves the instrumentation vulnerable to bugs. For this reason I have changed the code to use Enumerable methods instead of ActiveSupport extensions. See https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues/686 --- .../opentelemetry/instrumentation/gruf/interceptors/client.rb | 2 +- .../opentelemetry/instrumentation/gruf/interceptors/server.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/instrumentation/gruf/lib/opentelemetry/instrumentation/gruf/interceptors/client.rb b/instrumentation/gruf/lib/opentelemetry/instrumentation/gruf/interceptors/client.rb index d1c28022f..ffb69973f 100644 --- a/instrumentation/gruf/lib/opentelemetry/instrumentation/gruf/interceptors/client.rb +++ b/instrumentation/gruf/lib/opentelemetry/instrumentation/gruf/interceptors/client.rb @@ -10,7 +10,7 @@ module Gruf module Interceptors class Client < ::Gruf::Interceptors::ClientInterceptor def call(request_context:) - return yield if instrumentation_config.blank? + return yield if instrumentation_config.empty? service = request_context.method.split('/')[1] method = request_context.method_name diff --git a/instrumentation/gruf/lib/opentelemetry/instrumentation/gruf/interceptors/server.rb b/instrumentation/gruf/lib/opentelemetry/instrumentation/gruf/interceptors/server.rb index 5609d9c63..fec68f357 100644 --- a/instrumentation/gruf/lib/opentelemetry/instrumentation/gruf/interceptors/server.rb +++ b/instrumentation/gruf/lib/opentelemetry/instrumentation/gruf/interceptors/server.rb @@ -10,7 +10,7 @@ module Gruf module Interceptors class Server < ::Gruf::Interceptors::ServerInterceptor def call - return yield if instrumentation_config.blank? + return yield if instrumentation_config.empty? method = request.method_name