diff --git a/Gemfile.lock b/Gemfile.lock index 53efde9..1c14346 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - hooks-ruby (0.6.4) + hooks-ruby (0.7.0) dry-schema (~> 1.14, >= 1.14.1) grape (~> 2.3) puma (~> 6.6) diff --git a/lib/hooks/app/api.rb b/lib/hooks/app/api.rb index da71d65..9ef5bb8 100644 --- a/lib/hooks/app/api.rb +++ b/lib/hooks/app/api.rb @@ -32,7 +32,7 @@ class << self def self.create(config:, endpoints:, log:) # :nocov: @production = config[:environment].downcase.strip == "production" - @server_start_time = Time.now + @server_start_time = Time.now.utc api_class = Class.new(Grape::API) do content_type :json, "application/json" @@ -56,7 +56,7 @@ def self.create(config:, endpoints:, log:) send(http_method, full_path) do request_id = uuid - start_time = Time.now + start_time = Time.now.utc request_context = { request_id:, @@ -116,7 +116,7 @@ def self.create(config:, endpoints:, log:) end log.info("successfully processed webhook event with handler: #{handler_class_name}") - log.debug("processing duration: #{Time.now - start_time}s") + log.debug("processing duration: #{Time.now.utc - start_time}s") status 200 response rescue Hooks::Plugins::Handlers::Error => e diff --git a/lib/hooks/app/endpoints/catchall.rb b/lib/hooks/app/endpoints/catchall.rb index d880ab0..b7c5ea5 100644 --- a/lib/hooks/app/endpoints/catchall.rb +++ b/lib/hooks/app/endpoints/catchall.rb @@ -34,7 +34,7 @@ def self.route_block(captured_config, captured_logger) # :nocov: proc do request_id = uuid - start_time = Time.now + start_time = Time.now.utc # Use captured values config = captured_config @@ -86,7 +86,7 @@ def self.route_block(captured_config, captured_logger) ) log.info("successfully processed webhook event with handler: #{handler_class_name}") - log.debug("processing duration: #{Time.now - start_time}s") + log.debug("processing duration: #{Time.now.utc - start_time}s") status 200 response rescue StandardError => e diff --git a/lib/hooks/app/endpoints/health.rb b/lib/hooks/app/endpoints/health.rb index 468bdc7..a3ee8ee 100644 --- a/lib/hooks/app/endpoints/health.rb +++ b/lib/hooks/app/endpoints/health.rb @@ -18,7 +18,7 @@ class HealthEndpoint < Grape::API status: "healthy", timestamp: Time.now.utc.iso8601, version: Hooks::VERSION, - uptime_seconds: (Time.now - Hooks::App::API.server_start_time).to_i + uptime_seconds: (Time.now.utc - Hooks::App::API.server_start_time).to_i } end end diff --git a/lib/hooks/core/stats.rb b/lib/hooks/core/stats.rb index 650a0dd..650cf26 100644 --- a/lib/hooks/core/stats.rb +++ b/lib/hooks/core/stats.rb @@ -43,9 +43,9 @@ def timing(metric_name, duration, tags = {}) # @param tags [Hash] Optional tags/labels for the metric # @return [Object] Return value of the block def measure(metric_name, tags = {}) - start_time = Time.now + start_time = Time.now.utc result = yield - duration = Time.now - start_time + duration = Time.now.utc - start_time timing(metric_name, duration, tags) result end diff --git a/lib/hooks/version.rb b/lib/hooks/version.rb index 852e11c..8681f58 100644 --- a/lib/hooks/version.rb +++ b/lib/hooks/version.rb @@ -4,5 +4,5 @@ module Hooks # Current version of the Hooks webhook framework # @return [String] The version string following semantic versioning - VERSION = "0.6.4".freeze + VERSION = "0.7.0".freeze end