Sha256: 7f1a6e559a56590eca12029ca9ea46998d3440eddf7bbf8fb833fb1f877161bd
Contents?: true
Size: 1.26 KB
Versions: 3
Compression:
Stored size: 1.26 KB
Contents
if RUBY_PLATFORM == "java" java_import 'com.codahale.metrics.Gauge' java_import 'com.codahale.metrics.Histogram' java_import 'com.codahale.metrics.JmxReporter' java_import 'com.codahale.metrics.MetricRegistry' java_import 'java.util.concurrent.TimeUnit' class Histogram java_alias :update_long, :update, [Java::long] end module Metrics @registry = MetricRegistry.new @reporters = [] def self.start @period = $conf.metrics.interval @unit = TimeUnit::SECONDS JmxReporter.forRegistry(@registry).build.start Signal.register_shutdown_handler { stop } end def self.stop @reporters.each do |reporter| reporter.run if reporter.respond_to?(:run) reporter.stop end @reporters.clear end def self.register_reporter(reporter) reporter.start(@period, @unit) @reporters << reporter end def self.registry @registry end def self.gauge(name, handler) registry.register(name, handler) end def self.counter(name) registry.counter(name) end def self.meter(name) registry.meter(name) end def self.histogram(name) registry.histogram(name) end def self.timer(name) registry.timer(name) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
liquid-ext-3.5.3 | lib/liquid/metrics.rb |
liquid-ext-3.5.2 | lib/liquid/metrics.rb |
liquid-ext-3.5.0 | lib/liquid/metrics.rb |