]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/munin/files/default/plugins/api_calls_num
Fix some rubocop detected style issues
[chef.git] / cookbooks / munin / files / default / plugins / api_calls_num
index b0c23664b4ef5c304eeb6218b189cf7bee798b9f..c65ae0a7ad48c207e06df7f00046511b4a7699c6 100755 (executable)
@@ -28,19 +28,19 @@ def uris_from_logs
 end
 
 CALL_TYPES = {
-  :map => "Map API calls", 
-  :upload => "Changeset diff uploads", 
-  :amf => "AMF API calls", 
-  :history => "Element history fetches", 
+  :map => "Map API calls",
+  :upload => "Changeset diff uploads",
+  :amf => "AMF API calls",
+  :history => "Element history fetches",
   :full => "Full element fetches",
   :trkpts => "GPX trackpoints calls",
-  :web => "Web site traffic", 
+  :web => "Web site traffic",
   :other => "Other API calls"
 }
 
 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
@@ -63,7 +63,7 @@ else
   min_time, max_time, lines = uris_from_logs
   delta_t = (max_time - min_time).to_f * 24 * 60
   counts = lines.
-      collect {|x| categorise_uri(x)}.
+      collect { |x| categorise_uri(x) }.
       inject(Hash.new) do |h, e|
     if h.has_key? e
       h[e] += 1
@@ -72,7 +72,7 @@ else
     end
     h
   end
-  
+
   CALL_TYPES.keys.each do |type|
     count = counts[type] || 0
     puts "#{type}.value #{count / delta_t}"