diff --git a/logstash-core/lib/logstash/filter_delegator.rb b/logstash-core/lib/logstash/filter_delegator.rb index 712c2bc4b..a18ee8371 100644 --- a/logstash-core/lib/logstash/filter_delegator.rb +++ b/logstash-core/lib/logstash/filter_delegator.rb @@ -37,9 +37,9 @@ module LogStash def multi_filter(events) @metric_events.increment(:in, events.size) - start = Time.now + clock = @filter.metric.time(:duration_in_millis) new_events = @filter.multi_filter(events) - @filter.metric.increment(:duration_in_millis, ((Time.now - start)*1000).to_i) + clock.stop # There is no garantee in the context of filter # that EVENTS_INT == EVENTS_OUT, see the aggregates and diff --git a/logstash-core/lib/logstash/instrument/metric.rb b/logstash-core/lib/logstash/instrument/metric.rb index e6e12262a..1bc39d754 100644 --- a/logstash-core/lib/logstash/instrument/metric.rb +++ b/logstash-core/lib/logstash/instrument/metric.rb @@ -46,7 +46,7 @@ module LogStash module Instrument end def report_time(namespace, key, duration) - collector.push(namespace, key, :mean, :increment, duration) + collector.push(namespace, key, :counter, :increment, duration) end # This method return a metric instance tied to a specific namespace @@ -81,7 +81,7 @@ module LogStash module Instrument # # @see LogStash::Instrument::Metric#time class TimedExecution - MILLISECONDS = 1_000_000.0.freeze + MILLISECONDS = 1_000.0.freeze def initialize(metric, namespace, key) @metric = metric