dry-monitor 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/dry/monitor/clock.rb +6 -1
- data/lib/dry/monitor/notifications.rb +2 -2
- data/lib/dry/monitor/rack/logger.rb +1 -1
- data/lib/dry/monitor/rack/middleware.rb +5 -4
- data/lib/dry/monitor/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afa00138c4dc7ce920300c3d5ea5e88bfe95a32d8a195b55398a5ae8896c734a
|
4
|
+
data.tar.gz: d2486b5a1dbdb10630969e46c52cf0b3e4c2db66cf1576a64a6dc9486e6c6d93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74d9e1d40b2c51fdf96cff797eb66c4c16b3d38924b226d83045384de3c48695f05b15b485930513924957c5a38862496c6e541b28a6b9235be0f7a2cecbe0c6
|
7
|
+
data.tar.gz: e049809c0246586f57195438dffef39c3e521fb8793e7f1a772b96185fdc87d97f2170c540517cb22a1984f0772d7a815672e44e27149313f3f98c45a04c1799
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
<!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
|
2
2
|
|
3
|
+
## 1.0.1 2022-11-17
|
4
|
+
|
5
|
+
|
6
|
+
### Added
|
7
|
+
|
8
|
+
- Extend Clock with support for configurable units (via #50) (@solnic)
|
9
|
+
|
10
|
+
|
11
|
+
[Compare v1.0.0...v1.0.1](https://github.com/dry-rb/dry-monitor/compare/v1.0.0...v1.0.1)
|
12
|
+
|
3
13
|
## 1.0.0 2022-11-04
|
4
14
|
|
5
15
|
|
data/lib/dry/monitor/clock.rb
CHANGED
@@ -4,6 +4,11 @@ module Dry
|
|
4
4
|
module Monitor
|
5
5
|
# @api public
|
6
6
|
class Clock
|
7
|
+
# @api private
|
8
|
+
def initialize(unit: :millisecond)
|
9
|
+
@unit = unit
|
10
|
+
end
|
11
|
+
|
7
12
|
# @api public
|
8
13
|
def measure
|
9
14
|
start = current
|
@@ -13,7 +18,7 @@ module Dry
|
|
13
18
|
|
14
19
|
# @api public
|
15
20
|
def current
|
16
|
-
Process.clock_gettime(Process::CLOCK_MONOTONIC,
|
21
|
+
Process.clock_gettime(Process::CLOCK_MONOTONIC, @unit)
|
17
22
|
end
|
18
23
|
end
|
19
24
|
end
|
@@ -16,7 +16,7 @@ module Dry
|
|
16
16
|
QUERY_STRING = "QUERY_STRING"
|
17
17
|
|
18
18
|
START_MSG = %(Started %s "%s" for %s at %s)
|
19
|
-
STOP_MSG = %(Finished %s "%s" for %s in %
|
19
|
+
STOP_MSG = %(Finished %s "%s" for %s in %s [Status: %s]\n)
|
20
20
|
QUERY_MSG = %( Query parameters )
|
21
21
|
FILTERED = "[FILTERED]"
|
22
22
|
|
@@ -14,12 +14,13 @@ module Dry
|
|
14
14
|
|
15
15
|
attr_reader :app, :notifications
|
16
16
|
|
17
|
-
def initialize(*args)
|
17
|
+
def initialize(*args, clock: CLOCK)
|
18
18
|
@notifications, @app = *args
|
19
|
+
@clock = clock
|
19
20
|
end
|
20
21
|
|
21
|
-
def new(app, *_args, &_block)
|
22
|
-
self.class.new(notifications, app)
|
22
|
+
def new(app, *_args, clock: @clock, &_block)
|
23
|
+
self.class.new(notifications, app, clock: clock)
|
23
24
|
end
|
24
25
|
|
25
26
|
def on(event_id, &block)
|
@@ -32,7 +33,7 @@ module Dry
|
|
32
33
|
|
33
34
|
def call(env)
|
34
35
|
notifications.start(REQUEST_START, env: env)
|
35
|
-
response, time =
|
36
|
+
response, time = @clock.measure { app.call(env) }
|
36
37
|
notifications.stop(REQUEST_STOP, env: env, time: time, status: response[0])
|
37
38
|
response
|
38
39
|
end
|
data/lib/dry/monitor/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry-monitor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Solnica
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-configurable
|