Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
6 changes: 3 additions & 3 deletions lib/hooks/app/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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:,
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/hooks/app/endpoints/catchall.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/hooks/app/endpoints/health.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/hooks/core/stats.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/hooks/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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