Allow selection of which metrics to submit from Librato metrics reporter #9

Open
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
@ryanlower

Can specific :only or :except when initializing the reporter, e.g.

Metriks::Reporter::LibratoMetrics.new(
  'email',
  'key',
  {
    prefix: 'example',
    only: [
      :count,
      :mean,
      :one_minute_rate
    ]
  }
).start
@eric

This comment has been minimized.

Show comment Hide comment
@eric

eric Apr 18, 2012

Owner

This is great. It may be a couple days before I get a chance to merge and release this — I'm traveling in Japan at the moment... but this looks useful.

Thanks for the pull request.

Owner

eric commented Apr 18, 2012

This is great. It may be a couple days before I get a chance to merge and release this — I'm traveling in Japan at the moment... but this looks useful.

Thanks for the pull request.

+ raise 'Can only specify one of :only or :except'
+ end
+ @only = options[:only] || []
+ @except = options[:except] || []

This comment has been minimized.

Show comment Hide comment
@eric

eric Apr 25, 2012

Owner

Defaulting these to an empty array is going to cause the if's later on to always evaluate to true.

I think this may be worth a test case to not break things.

@eric

eric Apr 25, 2012

Owner

Defaulting these to an empty array is going to cause the if's later on to always evaluate to true.

I think this may be worth a test case to not break things.

@douglasdollars

This comment has been minimized.

Show comment Hide comment
@douglasdollars

douglasdollars Apr 28, 2012

This one is going to really come in handy. Thanks guys!

This one is going to really come in handy. Thanks guys!

@@ -121,6 +127,15 @@ def prepare_metric(base_name, metric, keys, snapshot_keys = [])
base_name = "#{@prefix}.#{base_name}"
end
+ if @only

This comment has been minimized.

Show comment Hide comment
@eric

eric Jul 3, 2012

Owner

With the defaulting above, this is going to need to be if @only && !@only.empty? — same with the @except one.

@eric

eric Jul 3, 2012

Owner

With the defaulting above, this is going to need to be if @only && !@only.empty? — same with the @except one.

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