Skip to content
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

Instrument queries #29

Merged
merged 13 commits into from
Aug 31, 2014
Merged

Instrument queries #29

merged 13 commits into from
Aug 31, 2014

Conversation

mtodd
Copy link
Member

@mtodd mtodd commented Jul 21, 2014

Starting work on adding instrumentation around every query reaching out to the LDAP server, especially in loops.

This adds GitHub::Ldap#instrument that takes an event name and payload with a block that will proxy out to the configured instrumentation service (ActiveSupport::Notifications, for instance). If no instrumentation service is configured, the block is called normally.

Next step is to wrap queries with instrument.

cc @rtomayko @sbryant @mcolyer @MikeMcQuaid @dbussink @jmickeyd

Not definite on the event names and payloads here. Just getting this going.
@mcolyer
Copy link

mcolyer commented Jul 21, 2014

@mtodd I've done a quick once over but I haven't worked in this code before.

Have you verified that previous behavior works and that we get the logging output we expect since tests are failing?

@rtomayko
Copy link
Contributor

I'm going to try a slightly different direction that taps in at a single chokepoint. We won't have great details on what generated the query but I'm a little concerned about introducing so much change in a bugfix release. I'll leave this here and start another PR for that.

@mtodd
Copy link
Member Author

mtodd commented Jul 22, 2014

@mcolyer I haven't. Tests aren't working, and this doesn't really do anything until you subscribe to the events that the instrumentation service will emit when in use.

@rtomayko 👌 happy to hear more of what you were thinking. I'm basing this off of gjtorikian/html-pipeline#45 somewhat since it's been super helpful in making the HTML pipeline's internal workings visible for external logging et al.

@MikeMcQuaid
Copy link
Contributor

@mtodd Is this something we'll want to backport?

@mcolyer
Copy link

mcolyer commented Jul 22, 2014

@MikeMcQuaid I don't think so.

I haven't. Tests aren't working, and this doesn't really do anything until you subscribe to the events that the instrumentation service will emit when in use.

No worries, was just trying to leave helpful comments at the time but now it sounds like @rtomayko is working something up.

@mtodd
Copy link
Member Author

mtodd commented Jul 23, 2014

Still want to get this incorporated, but not urgently.

@rtomayko happy to follow up with specific instrumentation/logging/metrics otherwise.

@rtomayko
Copy link
Contributor

👌 happy to hear more of what you were thinking.

Mostly I'm just kind of down on sprinkling these types of instrumentation blocks all over the codebase if you can find a single chokepoint. You lose a little meta information but are guaranteed to instrument calls added in the future and it's less error prone given that there's fewer changes. I tried to run with that approach, though, and the net-ldap library just doesn't make it easy unfortunately.

Happy to see you continue work in this branch as planned, was just hoping for something a bit less intense that got us 90% of the way.

@mcolyer
Copy link

mcolyer commented Jul 23, 2014

Still want to get this incorporated, but not urgently.

👍

rs = @connection.search(options.merge(:base => base), &block)
result.concat Array(rs) unless rs == false
end
instrument "search.github_ldap", options.dup do |payload|
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the most substantive change in this branch, which I think is good to go. We're wrapping the chokepoint with instrumentation to get an idea of every search that this library generates. And what this doesn't instrument, https://github.com/github/ruby-net-ldap/pull/1 should provide us with visibility into.

This is because we modify what comes in (with, at the very least,
:result).
mtodd added a commit that referenced this pull request Aug 31, 2014
@mtodd mtodd merged commit 4781c22 into master Aug 31, 2014
@mtodd mtodd deleted the instrumentation branch August 31, 2014 07:15
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.

4 participants