This repository has been archived by the owner on May 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add scriptie to generate timings from log/indexer.log (#80)
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |