dry-monitor 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85738f938dcede38fc7ce87e0370b28d6007a4bc623add02b36266c92436ddc4
4
- data.tar.gz: ff09a85ea8d421a6af32c711d2c84a62164f868462b2676cb5b644af6b5a4dcb
3
+ metadata.gz: d81f64e41a8aefe7efc798b025228ea7c29d7b6228bbf6992f31b3aa2a7ae38d
4
+ data.tar.gz: b4eb4c4928bb5aacc9f160f7caba9047b2bcac5e77934407697a6f910f5808b0
5
5
  SHA512:
6
- metadata.gz: 57421c674b4a278f86ec556e84f09778400e30767cce50f5190dc0ddc1403f9c9cbb570fb45b7a481f2aecce325c52cc67f6ba0bdec55a8d58c92354845a1f3e
7
- data.tar.gz: 3cd559b457cab3d252875a9464b9cc24d96e486f56f4ae31c50e1003aa81d7d63306ee77daa33116bf780c70a138f3c6b092b3796de9ed5e02bde7c5bc822c58
6
+ metadata.gz: 174dbc6c5c059a6a22ddb37b38c211690735de3e9efa97b2826e1f3190123f7a21af54f75ca72d226a18c8671eaa6856b406336217d23326ffc9561a3ed0716a
7
+ data.tar.gz: e249416fc29c6296d6c6cbe3488e5899a877224cdcc247f06cbd1fc2789c4fa4514575e884b26793947cc92f645816f765e50ccc2f8d31df4f783523f0b8220e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ <!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
2
+
3
+ ## 0.4.0
4
+
5
+
6
+ ### Fixed
7
+
8
+ - Compatibility with MRI 3.0 (@alex-damian-negru)
9
+
10
+
11
+ [Compare v0.3.2...master](https://github.com/dry-rb/dry-monitor/compare/v0.3.2...master)
12
+
1
13
  ## 0.3.2 2020-04-09
2
14
 
3
15
 
@@ -8,7 +20,6 @@
8
20
  ### Changed
9
21
 
10
22
  - Performance improvements (@davydovanton)
11
- - Dependency on `dry-events` was bumped to `~> 0.5` (@davydovanton)
12
23
 
13
24
  [Compare v0.3.1...v0.3.2](https://github.com/dry-rb/dry-monitor/compare/v0.3.1...v0.3.2)
14
25
 
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015-2020 dry-rb team
3
+ Copyright (c) 2015-2021 dry-rb team
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
data/README.md CHANGED
@@ -21,7 +21,7 @@
21
21
 
22
22
  This library officially supports the following Ruby versions:
23
23
 
24
- * MRI >= `2.4`
24
+ * MRI >= `2.5`
25
25
  * jruby >= `9.2`
26
26
 
27
27
  ## License
data/dry-monitor.gemspec CHANGED
@@ -25,12 +25,11 @@ Gem::Specification.new do |spec|
25
25
  spec.metadata['source_code_uri'] = 'https://github.com/dry-rb/dry-monitor'
26
26
  spec.metadata['bug_tracker_uri'] = 'https://github.com/dry-rb/dry-monitor/issues'
27
27
 
28
- spec.required_ruby_version = ">= 2.4.0"
28
+ spec.required_ruby_version = ">= 2.5.0"
29
29
 
30
30
  # to update dependencies edit project.yml
31
31
  spec.add_runtime_dependency "dry-configurable", "~> 0.5"
32
- spec.add_runtime_dependency "dry-core", "~> 0.4"
33
- spec.add_runtime_dependency "dry-equalizer", "~> 0.2"
32
+ spec.add_runtime_dependency "dry-core", "~> 0.5", ">= 0.5"
34
33
  spec.add_runtime_dependency "dry-events", "~> 0.2"
35
34
 
36
35
  spec.add_development_dependency "bundler"
@@ -22,9 +22,7 @@ module Dry
22
22
  class Notifications
23
23
  include Events::Publisher["Dry::Monitor::Notifications"]
24
24
 
25
- attr_reader :id
26
-
27
- attr_reader :clock
25
+ attr_reader :id, :clock
28
26
 
29
27
  def initialize(id)
30
28
  @id = id
@@ -39,8 +37,8 @@ module Dry
39
37
  instrument(event_id, payload)
40
38
  end
41
39
 
42
- def instrument(event_id, payload = EMPTY_HASH)
43
- result, time = @clock.measure { yield } if block_given?
40
+ def instrument(event_id, payload = EMPTY_HASH, &block)
41
+ result, time = @clock.measure(&block) if block_given?
44
42
 
45
43
  process(event_id, payload) do |event, listener|
46
44
  if time
@@ -21,9 +21,7 @@ module Dry
21
21
  QUERY_MSG = %( Query parameters )
22
22
  FILTERED = "[FILTERED]"
23
23
 
24
- attr_reader :logger
25
-
26
- attr_reader :config
24
+ attr_reader :logger, :config
27
25
 
28
26
  def initialize(logger, config = self.class.config)
29
27
  @logger = logger
@@ -31,17 +29,9 @@ module Dry
31
29
  end
32
30
 
33
31
  def attach(rack_monitor)
34
- rack_monitor.on(:start) do |env:|
35
- log_start_request(env)
36
- end
37
-
38
- rack_monitor.on(:stop) do |env:, status:, time:|
39
- log_stop_request(env, status, time)
40
- end
41
-
42
- rack_monitor.on(:error) do |event|
43
- log_exception(event[:exception])
44
- end
32
+ rack_monitor.on(:start) { |params| log_start_request(params[:env]) }
33
+ rack_monitor.on(:stop) { |params| log_stop_request(**params) }
34
+ rack_monitor.on(:error) { |event| log_exception(event[:exception]) }
45
35
  end
46
36
 
47
37
  def log_exception(err)
@@ -59,11 +49,11 @@ module Dry
59
49
  log_request_params(request)
60
50
  end
61
51
 
62
- def log_stop_request(request, status, time)
52
+ def log_stop_request(env:, status:, time:)
63
53
  logger.info STOP_MSG % [
64
- request[REQUEST_METHOD],
65
- request[PATH_INFO],
66
- request[REMOTE_ADDR],
54
+ env[REQUEST_METHOD],
55
+ env[PATH_INFO],
56
+ env[REMOTE_ADDR],
67
57
  time,
68
58
  status
69
59
  ]
@@ -14,9 +14,7 @@ module Dry
14
14
  Notifications.register_event(REQUEST_STOP)
15
15
  Notifications.register_event(REQUEST_ERROR)
16
16
 
17
- attr_reader :app
18
-
19
- attr_reader :notifications
17
+ attr_reader :app, :notifications
20
18
 
21
19
  def initialize(*args)
22
20
  @notifications, @app = *args
@@ -15,8 +15,7 @@ module Dry
15
15
  module SQL
16
16
  module Colorizers
17
17
  class Rouge
18
- attr_reader :formatter
19
- attr_reader :lexer
18
+ attr_reader :formatter, :lexer
20
19
 
21
20
  def initialize(theme)
22
21
  @formatter = ::Rouge::Formatters::Terminal256.new(theme || ::Rouge::Themes::Gruvbox.new)
@@ -40,9 +40,7 @@ module Dry
40
40
  setting :theme, nil
41
41
  setting :message_template, %( Loaded %s in %sms %s)
42
42
 
43
- attr_reader :config
44
- attr_reader :logger
45
- attr_reader :template
43
+ attr_reader :config, :logger, :template
46
44
 
47
45
  load_extensions(:default_colorizer)
48
46
 
@@ -53,12 +51,10 @@ module Dry
53
51
  end
54
52
 
55
53
  def subscribe(notifications)
56
- notifications.subscribe(:sql) do |time:, name:, query:|
57
- log_query(time, name, query)
58
- end
54
+ notifications.subscribe(:sql) { |params| log_query(**params) }
59
55
  end
60
56
 
61
- def log_query(time, name, query)
57
+ def log_query(time:, name:, query:)
62
58
  logger.info template % [name.inspect, time, colorizer.call(query)]
63
59
  end
64
60
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Dry
4
4
  module Monitor
5
- VERSION = "0.3.2"
5
+ VERSION = "0.4.0"
6
6
  end
7
7
  end
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: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-09 00:00:00.000000000 Z
11
+ date: 2021-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable
@@ -30,28 +30,20 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.4'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '0.4'
41
- - !ruby/object:Gem::Dependency
42
- name: dry-equalizer
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
33
+ version: '0.5'
34
+ - - ">="
46
35
  - !ruby/object:Gem::Version
47
- version: '0.2'
36
+ version: '0.5'
48
37
  type: :runtime
49
38
  prerelease: false
50
39
  version_requirements: !ruby/object:Gem::Requirement
51
40
  requirements:
52
41
  - - "~>"
53
42
  - !ruby/object:Gem::Version
54
- version: '0.2'
43
+ version: '0.5'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0.5'
55
47
  - !ruby/object:Gem::Dependency
56
48
  name: dry-events
57
49
  requirement: !ruby/object:Gem::Requirement
@@ -166,14 +158,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
166
158
  requirements:
167
159
  - - ">="
168
160
  - !ruby/object:Gem::Version
169
- version: 2.4.0
161
+ version: 2.5.0
170
162
  required_rubygems_version: !ruby/object:Gem::Requirement
171
163
  requirements:
172
164
  - - ">="
173
165
  - !ruby/object:Gem::Version
174
166
  version: '0'
175
167
  requirements: []
176
- rubygems_version: 3.0.3
168
+ rubygems_version: 3.1.6
177
169
  signing_key:
178
170
  specification_version: 4
179
171
  summary: Monitoring and instrumentation APIs