lib/fluent/plugin/statusz.rb in fluent-plugin-google-cloud-0.12.10 vs lib/fluent/plugin/statusz.rb in fluent-plugin-google-cloud-0.12.11
- old
+ new
@@ -17,26 +17,26 @@
# Module for collecting diagnostic information and formatting it as an
# HTML page to serve on the /statusz endpoint.
module Statusz
module_function
- # Note: The plugin parameter is referenced in STATUSZ_TMPL.
+ # NOTE: The plugin parameter is referenced in STATUSZ_TMPL.
def response(plugin)
uptime = Time.now - SERVER_START
- uptime_str = format('%d hr %02d min %02d sec',
- uptime / 3600,
- (uptime / 60) % 60,
- uptime % 60)
+ uptime_str = format('%<hours>d hr %<minutes>02d min %<seconds>02d sec',
+ hours: uptime / 3600,
+ minutes: (uptime / 60) % 60,
+ seconds: uptime % 60)
ERB.new(STATUSZ_TMPL).result(binding)
end
end
SERVER_START = Time.now
# Does not include the following deprecated config params:
# auth_method, private_key_email, private_key_passphrase, private_key_path
-CONFIG_KEYS = %w(
+CONFIG_KEYS = %w[
adjust_invalid_timestamps
autoformat_stackdriver_trace
coerce_to_utf8
detect_json
detect_subservice
@@ -66,13 +66,12 @@
use_grpc
use_metadata_service
vm_id
vm_name
zone
-).freeze
+].freeze
-# rubocop:disable LineLength
STATUSZ_TMPL = %(\
<!DOCTYPE html>
<html>
<head>
<title>Status for <%= File.basename($PROGRAM_NAME) %></title>
@@ -119,6 +118,5 @@
#{CONFIG_KEYS.map { |k| " <tr><th>#{k}</th><td><%= plugin.#{k} %></td></tr>" }.join("\n")}
</table>
</body>
</html>
).freeze
-# rubocop:enable LineLength