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

Add shared metric type check for Collector#default_value_from #18

Open
rafamanzo opened this issue Apr 18, 2016 · 0 comments
Open

Add shared metric type check for Collector#default_value_from #18

rafamanzo opened this issue Apr 18, 2016 · 0 comments

Comments

@rafamanzo
Copy link
Member

From kolekti_analizo (https://github.com/mezuro/kolekti_analizo/blob/master/lib/kolekti_analizo/collector.rb#L25) we have:

metric = !metric_configuration.nil? ? metric_configuration.metric : nil
if metric.nil? || metric.type != 'NativeMetricSnapshot' || metric.metric_collector_name != self.name
  raise ArgumentError.new("Metric configuration does not belong to Analizo")
end

This logic will be repeated through other uses like MetricFu.

We can extract it into a new method, use it inside default_value_from and preserve the raise.

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

No branches or pull requests

1 participant