X-Git-Url: https://git.openstreetmap.org/chef.git/blobdiff_plain/3a4d52bd4c0f8e6ae7679145846b7bc7845d8ace..f9a223297545b98090c533f10991d60334087fcb:/cookbooks/munin/files/default/plugins/api_calls_num diff --git a/cookbooks/munin/files/default/plugins/api_calls_num b/cookbooks/munin/files/default/plugins/api_calls_num index 0e5034a63..1c3a28e05 100755 --- a/cookbooks/munin/files/default/plugins/api_calls_num +++ b/cookbooks/munin/files/default/plugins/api_calls_num @@ -42,13 +42,13 @@ def categorise_uri(line) uri = line.split(" ")[1] case uri - when /api\/0\.6\/map/ then :map - when /api\/0\.6\/changeset\/[0-9]*\/upload/ then :upload - when /api\/0\.6\/amf/ then :amf - when /api\/0\.6\/(node|way|relation)\/[0-9]*\/history/ then :history - when /api\/0\.6\/(node|way|relation)\/[0-9]*\/full/ then :full - when /api\/0\.6\/trackpoints/ then :trkpts - when /api\/0\.6\// then :other + when %r{api/0\.6/map} then :map + when %r{api/0\.6/changeset/[0-9]*/upload} then :upload + when %r{api/0\.6/amf} then :amf + when %r{api/0\.6/(node|way|relation)/[0-9]*/history} then :history + when %r{api/0\.6/(node|way|relation)/[0-9]*/full} then :full + when %r{api/0\.6/trackpoints} then :trkpts + when %r{api/0\.6/} then :other else :web end end @@ -64,7 +64,7 @@ else delta_t = (max_time - min_time).to_f * 24 * 60 counts = lines .collect { |x| categorise_uri(x) } - .each_with_object(Hash.new) do |h, e| + .each_with_object({}) do |h, e| if h.key? e h[e] += 1 else