Skip to content

Commit 0c8899f

Browse files
authored
Merge pull request #72 from github/utc
utc or die 🕐 💀
2 parents 107831f + 2b5038d commit 0c8899f

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
hooks-ruby (0.6.4)
4+
hooks-ruby (0.7.0)
55
dry-schema (~> 1.14, >= 1.14.1)
66
grape (~> 2.3)
77
puma (~> 6.6)

lib/hooks/app/api.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class << self
3232
def self.create(config:, endpoints:, log:)
3333
# :nocov:
3434
@production = config[:environment].downcase.strip == "production"
35-
@server_start_time = Time.now
35+
@server_start_time = Time.now.utc
3636

3737
api_class = Class.new(Grape::API) do
3838
content_type :json, "application/json"
@@ -56,7 +56,7 @@ def self.create(config:, endpoints:, log:)
5656

5757
send(http_method, full_path) do
5858
request_id = uuid
59-
start_time = Time.now
59+
start_time = Time.now.utc
6060

6161
request_context = {
6262
request_id:,
@@ -116,7 +116,7 @@ def self.create(config:, endpoints:, log:)
116116
end
117117

118118
log.info("successfully processed webhook event with handler: #{handler_class_name}")
119-
log.debug("processing duration: #{Time.now - start_time}s")
119+
log.debug("processing duration: #{Time.now.utc - start_time}s")
120120
status 200
121121
response
122122
rescue Hooks::Plugins::Handlers::Error => e

lib/hooks/app/endpoints/catchall.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def self.route_block(captured_config, captured_logger)
3434
# :nocov:
3535
proc do
3636
request_id = uuid
37-
start_time = Time.now
37+
start_time = Time.now.utc
3838

3939
# Use captured values
4040
config = captured_config
@@ -86,7 +86,7 @@ def self.route_block(captured_config, captured_logger)
8686
)
8787

8888
log.info("successfully processed webhook event with handler: #{handler_class_name}")
89-
log.debug("processing duration: #{Time.now - start_time}s")
89+
log.debug("processing duration: #{Time.now.utc - start_time}s")
9090
status 200
9191
response
9292
rescue StandardError => e

lib/hooks/app/endpoints/health.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class HealthEndpoint < Grape::API
1818
status: "healthy",
1919
timestamp: Time.now.utc.iso8601,
2020
version: Hooks::VERSION,
21-
uptime_seconds: (Time.now - Hooks::App::API.server_start_time).to_i
21+
uptime_seconds: (Time.now.utc - Hooks::App::API.server_start_time).to_i
2222
}
2323
end
2424
end

lib/hooks/core/stats.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ def timing(metric_name, duration, tags = {})
4343
# @param tags [Hash] Optional tags/labels for the metric
4444
# @return [Object] Return value of the block
4545
def measure(metric_name, tags = {})
46-
start_time = Time.now
46+
start_time = Time.now.utc
4747
result = yield
48-
duration = Time.now - start_time
48+
duration = Time.now.utc - start_time
4949
timing(metric_name, duration, tags)
5050
result
5151
end

lib/hooks/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
module Hooks
55
# Current version of the Hooks webhook framework
66
# @return [String] The version string following semantic versioning
7-
VERSION = "0.6.4".freeze
7+
VERSION = "0.7.0".freeze
88
end

0 commit comments

Comments
 (0)