Create daily tag indexes, report in /summary

- Store daily tag roll-ups in vmpooler__tag__<date>
- GET /summary will display daily tag counts and roll-up
This commit is contained in:
Scott Schneider 2015-05-07 08:46:35 -07:00
parent 640b1ef4da
commit 4cfc078684
2 changed files with 37 additions and 1 deletions

View file

@ -147,6 +147,28 @@ module Vmpooler
queue
end
def get_tag_metrics(backend, date_str)
tags = {}
backend.hgetall('vmpooler__tag__' + date_str).each do |key, value|
hostname = 'unknown'
tag = 'unknown'
if key =~ /\:/
hostname, tag = key.split(':', 2)
end
tags[tag] ||= {}
tags[tag][value] ||= 0
tags[tag][value] += 1
tags[tag]['total'] ||= 0
tags[tag]['total'] += 1
end
tags
end
def get_task_metrics(backend, task_str, date_str, opts = {})
opts = {:bypool => false}.merge(opts)