add srv record lookups #58

Merged
merged 5 commits into from May 9, 2012

Conversation

Projects
None yet
3 participants
Owner

rphillips commented Apr 30, 2012

  • adds a query_endpoints config variable to the config file which contains a list of SRV queries
  • remove :sample() for cleanup
agents/monitoring/lua/monitoring-agent.lua
local ConnectionStream = require('./lib/client/connection_stream').ConnectionStream
local misc = require('./lib/util/misc')
local States = require('./lib/states')
local stateFile = require('./lib/state_file')
+local SRV_QUERIES = {
@philips

philips Apr 30, 2012

Contributor

Why put these in the code and not the config file?

@rphillips

rphillips Apr 30, 2012

Owner

i was thinking we don't want the DNS SRV endpoints to be configurable.

@rphillips

rphillips May 1, 2012

Owner

Added configurable SRV records.

agents/monitoring/lua/monitoring-agent.lua
+ end
+ async.map(SRV_QUERIES, iter, function(err, results)
+ local i, v
+ if err then
@Kami

Kami Apr 30, 2012

Member

Passing err to async.map short-circuits it, right? Should not being able to resolve one of the endpoints be fatal?

@rphillips

rphillips Apr 30, 2012

Owner

we will connect to up to 3 endpoints. I'll add some code to manage the error better.

agents/monitoring/lua/monitoring-agent.lua
+ end)
+ else
+ -- Verify that the endpoint addresses are specified in the correct format
+ endpoints = misc.split(self._config['endpoints'], '[^,]+')
@philips

philips Apr 30, 2012

Contributor

Why go through the trouble of making the list comma separated above just to split it again below?

@rphillips

rphillips Apr 30, 2012

Owner

this was the code that was there before... This code handles the non-srv record lookup.

agents/monitoring/lua/monitoring-agent.lua
- logging.log(logging.ERR, "endpoint needs to be specified in the following format ip:port")
+ logging.log(logging.INFO, "'endpoints' is missing from 'config'")
+ logging.log(logging.INFO, "querying for endpoints")
+ self:_queryForEndpoints(function(err, endpoints)
@philips

philips Apr 30, 2012

Contributor

Do we need a second code path for an endpoint list that is specified without a SRV record for testing?

Could you comment on the interval unit?

Owner

rphillips replied May 9, 2012

I globally commented the timeouts/intervals in 30099f1

Hrm, a unit here would be nice too

Perhaps print this at the end of the loop? Would be slightly less spammy.

Contributor

philips commented on 30099f1 May 9, 2012

great! thanks

Contributor

philips commented May 9, 2012

lgtm +1

rphillips added a commit that referenced this pull request May 9, 2012

@rphillips rphillips merged commit 3c6dbbe into master May 9, 2012

rphillips added a commit that referenced this pull request Feb 8, 2013

rphillips added a commit that referenced this pull request Feb 9, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment