Skip to content

Commit 2b0be68

Browse files
committed
Instrument Net::LDAP#bind
1 parent f7ba771 commit 2b0be68

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

lib/net/ldap.rb

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -742,22 +742,26 @@ def search(args = {})
742742
# the documentation for #auth, the password parameter can be a Ruby Proc
743743
# instead of a String.
744744
def bind(auth = @auth)
745-
if @open_connection
746-
@result = @open_connection.bind(auth)
747-
else
748-
begin
749-
conn = Connection.new \
750-
:host => @host,
751-
:port => @port,
752-
:encryption => @encryption,
753-
:instrumentation_service => @instrumentation_service
754-
@result = conn.bind(auth)
755-
ensure
756-
conn.close if conn
745+
instrument "bind.net_ldap" do |payload|
746+
if @open_connection
747+
payload[:connection] = @open_connection
748+
payload[:bind] = @result = @open_connection.bind(auth)
749+
else
750+
begin
751+
conn = Connection.new \
752+
:host => @host,
753+
:port => @port,
754+
:encryption => @encryption,
755+
:instrumentation_service => @instrumentation_service
756+
payload[:connection] = conn
757+
payload[:bind] = @result = conn.bind(auth)
758+
ensure
759+
conn.close if conn
760+
end
757761
end
758-
end
759762

760-
@result.success?
763+
@result.success?
764+
end
761765
end
762766

763767
# #bind_as is for testing authentication credentials.

0 commit comments

Comments
 (0)