lib/influxdb/rails/middleware/render_subscriber.rb in influxdb-rails-1.0.0 vs lib/influxdb/rails/middleware/render_subscriber.rb in influxdb-rails-1.0.1.beta1
- old
+ new
@@ -1,32 +1,31 @@
-require "influxdb/rails/middleware/simple_subscriber"
+require "influxdb/rails/middleware/subscriber"
module InfluxDB
module Rails
module Middleware
- class RenderSubscriber < SimpleSubscriber # :nodoc:
- def short_hook_name
- return "render_template" if hook_name.include?("render_template")
- return "render_partial" if hook_name.include?("render_partial")
- return "render_collection" if hook_name.include?("render_collection")
- end
-
+ class RenderSubscriber < Subscriber # :nodoc:
private
- def values(started, finished, payload)
- super(started, finished, payload).merge(
+ def values
+ {
+ value: duration,
count: payload[:count],
- cache_hits: payload[:cache_hits]
- ).reject { |_, value| value.nil? }
+ cache_hits: payload[:cache_hits],
+ }
end
- def tags(payload)
- tags = {
- location: location,
+ def tags
+ {
hook: short_hook_name,
filename: payload[:identifier],
}
- super(tags)
+ end
+
+ def short_hook_name
+ return "render_template" if hook_name.include?("render_template")
+ return "render_partial" if hook_name.include?("render_partial")
+ return "render_collection" if hook_name.include?("render_collection")
end
end
end
end
end