Skip to content

Parse Net::LDAP::PDU when calling Net::LDAP::Connection#read, instrument PDU parsing #131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Oct 16, 2014

Conversation

mtodd
Copy link
Member

@mtodd mtodd commented Oct 15, 2014

This PR reduces the duplication by moving the PDU parsing into the Net::LDAP::Connection#read method and instruments PDU parsing to give more visibility into the messages being sent from the server.

Should not result in any behavior change.

I believe this is along similar lines to #116, though not exactly the same.

For what it's worth, I looked at instrumenting the Net::LDAP::PDU.new method from the inside but there's no reference to the instrumentation_service object to service the instrumentation events (and I didn't want to go the route of a global default handler). This seemed like a good balance and a needed refactoring anyway.

Done:

  • parse PDU in Net::LDAP::Connection#read
  • instrument parse_pdu.net_ldap_connection event
  • unit tests
  • cleanup/refactoring of Net::LDAP::Connection#read callsites

Still to do:

  • integration tests (optional)

Many of the read callsites look like this:

(pdu = read) or raise Net::LDAP::LdapError, "no bind result"

This should be cleaned up, and this PR is a good opportunity to do so. Done.

cc @jch @schaary

Conflicts:
	lib/net/ldap/connection.rb
@jch
Copy link
Member

jch commented Oct 16, 2014

👍 🚢

I would've preferred separate pull requests for the #read refactoring and instrumentation, but it's a good set of changes. I also like the additional integration tests (but those could've also been a separate PR as well 😉)

@mtodd
Copy link
Member Author

mtodd commented Oct 16, 2014

@jch yeah, gonna try to make sure subsequent PRs are more focused.

mtodd added a commit that referenced this pull request Oct 16, 2014
Parse Net::LDAP::PDU when calling Net::LDAP::Connection#read, instrument PDU parsing
@mtodd mtodd merged commit 0aeceaf into master Oct 16, 2014
@mtodd mtodd deleted the instrument-messages branch October 16, 2014 20:16
astratto pushed a commit to astratto/ruby-net-ldap that referenced this pull request Dec 18, 2015
Parse Net::LDAP::PDU when calling Net::LDAP::Connection#read, instrument PDU parsing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants