Skip to content
This repository has been archived by the owner on May 28, 2024. It is now read-only.

Commit

Permalink
add scriptie to generate timings from log/indexer.log (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
Darren Hardy authored and cbeer committed Nov 9, 2016
1 parent 68bee00 commit 69eb582
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions script/parse_indexing_log.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env ruby
#
# parses an `indexer.log` and outputs a CSV file of the timings.
#
# The data output are the real time as `:real` and percentage of time
# spend idle as `:pct_idle` (e.g., waiting for network requests), for
# the time it takes to read the core data from Fedora into an object
# `load:` and the time it takes to convert that object into a solr
# document `:to_solr`
#
# Usage: script/parse_indexing_log.rb [log/indexing.log ...] > data.csv
#
puts %w(druid load:real load:pct_idle to_solr:real to_solr:pct_idle total:real).join(',')

ARGF.lines do |line|
matches = %r{successfully updated index for druid:([a-z0-9]+).+metrics: load_instance realtime ([\d\.]+)s total CPU ([\d\.]+)s; to_solr realtime ([\d\.]+)s total CPU ([\d\.]+)s}.match(line)
if matches
druid, load_real, load_cpu, solr_real, solr_cpu = matches[1..5]
record = [
druid,
load_real,
"%0.3f" % (100 * (load_real.to_f - load_cpu.to_f)/(load_real.to_f)),
solr_real,
"%0.3f" % (100 * (solr_real.to_f - solr_cpu.to_f)/(solr_real.to_f)),
"%0.6f" % (load_real.to_f + solr_real.to_f)
]
puts record.join(',')
end
end

0 comments on commit 69eb582

Please sign in to comment.