lib/opentelemetry/instrumentation/mysql2/instrumentation.rb in opentelemetry-instrumentation-mysql2-0.18.1 vs lib/opentelemetry/instrumentation/mysql2/instrumentation.rb in opentelemetry-instrumentation-mysql2-0.19.0
- old
+ new
@@ -8,20 +8,29 @@
module Instrumentation
module Mysql2
# The Instrumentation class contains logic to detect and install the Mysql2
# instrumentation
class Instrumentation < OpenTelemetry::Instrumentation::Base
- install do |_config|
+ install do |config|
+ if config[:enable_sql_obfuscation]
+ config[:db_statement] = :obfuscate
+ OpenTelemetry.logger.warn(
+ 'Instrumentation mysql2 configuration option enable_sql_obfuscation has been deprecated,' \
+ 'use db_statement option instead'
+ )
+ end
+
require_dependencies
patch_client
end
present do
defined?(::Mysql2)
end
option :peer_service, default: nil, validate: :string
option :enable_sql_obfuscation, default: false, validate: :boolean
+ option :db_statement, default: :include, validate: ->(opt) { %I[omit include obfuscate].include?(opt) }
private
def require_dependencies
require_relative 'patches/client'