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

(WIP) (RE-7014) Add support for statsd #150

Closed
wants to merge 2 commits into from

Conversation

shermdog
Copy link
Contributor

They way we were using graphite was incorrect for the type of data we were sending it. statsd is the appropriate mechanism for our needs.
statsd and graphite are mutually exclusive and configuring statsd will take precendence over Graphite. Example of configuration in vmpooler.yaml.example

@shermdog shermdog force-pushed the RE-7014 branch 2 times, most recently from c1a4c3d to 40bdd8b Compare May 10, 2016 18:07
$config = config

# Load logger library
$logger = logger

unless graphite.nil?
# statsd and graphite are mutex in the context of vmpooler
unless statsd.nil?
Copy link
Contributor

@mckern mckern May 10, 2016

Choose a reason for hiding this comment

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

I've got more to say about this in another comment I'm working on, but nil is already falsey, so you can just use the status of something that might be nil instead of explicitly checking for it.

# No don't do this!
unless graphite.nil?

# Yes do this!
if graphite

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Word - I generally just follow what ever pattern was done before, but I'm by no means opposed to cleaning this up as we go :)

Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer the latter approach if we can try to match general style.

They way we were using graphite was incorrect for the type of data we were sending it.  statsd is the appropriate mechanism for our needs.
statsd and graphite are mutually exclusive and configuring statsd will take precendence over Graphite.  Example of configuration in vmpooler.yaml.example
@@ -258,6 +263,7 @@ def clone_vm(template, folder, datastore, target)
$redis.decr('vmpooler__tasks__clone')

begin
$statsd.timing($config[:statsd]['prefix'] + ".clone.#{vm['template']}", finish) if defined? $statsd
$graphite.log($config[:graphite]['prefix'] + ".clone.#{vm['template']}", finish) if defined? $graphite
Copy link
Contributor

@mckern mckern May 10, 2016

Choose a reason for hiding this comment

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

It looks like you're checking on $statsd and $graphite a lot. Consider letting the initializer define both of those values (and letting one fall through to nil, and then wrapping those into a general method (this is by no means complete but if you're interested then I can help you flesh it out):

# @return [SomeKindOfObject, nil] an object representing the defined processing system for metric collection
def metric_collector
  $statsd || $graphite
end
metric_collector.increment($config[:statsd]['prefix'] + '.ready.' + pool['name'], $redis.scard('vmpooler__ready__' + pool['name']))

(Disregard the use of $config[:statsd]['prefix']; that's part of the fleshed out solution)

@shermdog shermdog changed the title (RE-7014) Add support for statsd (WIP) (RE-7014) Add support for statsd May 10, 2016
This adds the statsd tracking of pool gets.  It is seemingly working on success, but not fail. WIP
@rick
Copy link
Contributor

rick commented May 12, 2016

Random aside, if we are using statsd, it's worth knowing about brubeck:

http://githubengineering.com/brubeck/

Cc @heathseals with whom I was talking about this

@shermdog
Copy link
Contributor Author

shermdog commented Jun 8, 2016

Superseded by #155

@shermdog shermdog closed this Jun 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants