@@ -23,6 +23,7 @@ class LDAP
2323require 'net/ldap/dataset'
2424require 'net/ldap/password'
2525require 'net/ldap/entry'
26+ require 'net/ldap/instrumentation'
2627require 'net/ldap/version'
2728
2829# == Quick-start for the Impatient
@@ -242,6 +243,7 @@ class LDAP
242243# and then keeps it open while it executes a user-supplied block.
243244# Net::LDAP#open closes the connection on completion of the block.
244245class Net ::LDAP
246+ include Net ::LDAP ::Instrumentation
245247
246248 class LdapError < StandardError ; end
247249
@@ -1145,6 +1147,8 @@ def paged_searches_supported?
11451147# This is a private class used internally by the library. It should not
11461148# be called by user code.
11471149class Net ::LDAP ::Connection #:nodoc:
1150+ include Net ::LDAP ::Instrumentation
1151+
11481152 LdapVersion = 3
11491153 MaxSaslChallenges = 10
11501154
@@ -1245,21 +1249,6 @@ def setup_encryption(args)
12451249 end
12461250 end
12471251
1248- # Internal: Instrument a block with the defined instrumentation service.
1249- #
1250- # Returns the return value of the block.
1251- def instrument ( event , payload = { } )
1252- return yield ( payload ) unless instrumentation_service
1253-
1254- instrumentation_service . instrument ( event , payload ) do |payload |
1255- payload [ :result ] = yield ( payload )
1256- end
1257- end
1258- private :instrument
1259-
1260- attr_reader :instrumentation_service
1261- private :instrumentation_service
1262-
12631252 #--
12641253 # This is provided as a convenience method to make sure a connection
12651254 # object gets closed without waiting for a GC to happen. Clients shouldn't
0 commit comments