Sha256: 3dc6b3017ed201f951b68c2967c852e671e41c52c1a5e279f1afd10670859a7b

Contents?: true

Size: 976 Bytes

Versions: 1

Compression:

Stored size: 976 Bytes

Contents

require "test_utils"
require "logstash/filters/date"

puts "Skipping date tests because this ruby is not jruby" if RUBY_ENGINE != "jruby"
describe LogStash::Filters::Date, :if => RUBY_ENGINE == "jruby" do
  extend LogStash::RSpec

  describe "speed test of date parsing", :if => ENV["SPEEDTEST"] do
    it "should be fast" do
      event_count = 100000
      min_rate = 4000
      max_duration = event_count / min_rate
      input = "Nov 24 01:29:01 -0800"

      filter = LogStash::Filters::Date.new("match" => [ "mydate", "MMM dd HH:mm:ss Z" ])
      filter.register
      duration = 0
      # 10000 for warmup
      [10000, event_count].each do |iterations|
        start = Time.now
        iterations.times do
          event = LogStash::Event.new("mydate" => input)
          filter.execute(event)
        end
        duration = Time.now - start
      end
      puts "date parse rate: #{event_count / duration}"
      insist { duration } < max_duration
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
logstash-lib-1.3.2 spec/filters/date_performance.rb