mnemosyne-ruby 1.16.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +29 -25
  3. data/.rubocop.yml +1 -1
  4. data/Appraisals +8 -25
  5. data/CHANGELOG.md +23 -1
  6. data/Gemfile +1 -1
  7. data/README.md +8 -7
  8. data/gemfiles/core.gemfile +1 -0
  9. data/gemfiles/faraday_10.gemfile +1 -0
  10. data/gemfiles/{faraday_09.gemfile → faraday_20.gemfile} +2 -1
  11. data/gemfiles/rails_61.gemfile +1 -0
  12. data/gemfiles/rails_70.gemfile +1 -0
  13. data/gemfiles/{rails_52.gemfile → rails_71.gemfile} +2 -1
  14. data/gemfiles/redis_40.gemfile +1 -0
  15. data/gemfiles/redis_50.gemfile +1 -0
  16. data/gemfiles/sidekiq_60.gemfile +1 -0
  17. data/gemfiles/sidekiq_70.gemfile +1 -0
  18. data/lib/mnemosyne/client.rb +1 -1
  19. data/lib/mnemosyne/global.rb +6 -2
  20. data/lib/mnemosyne/instrumenter.rb +1 -1
  21. data/lib/mnemosyne/middleware/rack.rb +7 -5
  22. data/lib/mnemosyne/middleware/sidekiq.rb +7 -5
  23. data/lib/mnemosyne/probes/acfs/request.rb +6 -2
  24. data/lib/mnemosyne/probes/action_controller/process_action.rb +6 -2
  25. data/lib/mnemosyne/probes/action_controller/renderers.rb +6 -3
  26. data/lib/mnemosyne/probes/action_dispatch/show_exceptions.rb +6 -1
  27. data/lib/mnemosyne/probes/action_view/render_partial.rb +6 -2
  28. data/lib/mnemosyne/probes/action_view/render_template.rb +6 -2
  29. data/lib/mnemosyne/probes/active_job/perform.rb +6 -2
  30. data/lib/mnemosyne/probes/active_record/instantiation.rb +6 -2
  31. data/lib/mnemosyne/probes/active_record/query.rb +6 -2
  32. data/lib/mnemosyne/probes/faraday/base.rb +1 -10
  33. data/lib/mnemosyne/probes/grape/endpoint_render.rb +5 -2
  34. data/lib/mnemosyne/probes/grape/endpoint_run.rb +6 -2
  35. data/lib/mnemosyne/probes/grape/endpoint_run_filters.rb +5 -2
  36. data/lib/mnemosyne/probes/mnemosyne/tracer.rb +6 -2
  37. data/lib/mnemosyne/probes/msgr/client.rb +1 -1
  38. data/lib/mnemosyne/probes/msgr/consumer.rb +5 -3
  39. data/lib/mnemosyne/probes/responder/respond.rb +5 -2
  40. data/lib/mnemosyne/probes/restify/base.rb +1 -1
  41. data/lib/mnemosyne/probes/sidekiq/client.rb +1 -1
  42. data/lib/mnemosyne/probes/view_component/render_component.rb +6 -2
  43. data/lib/mnemosyne/span.rb +5 -5
  44. data/lib/mnemosyne/trace.rb +7 -7
  45. data/lib/mnemosyne/version.rb +2 -2
  46. data/mnemosyne-ruby.gemspec +2 -2
  47. metadata +8 -11
  48. data/.github/workflows/lint.yml +0 -25
  49. data/gemfiles/rails_60.gemfile +0 -27
  50. data/gemfiles/sidekiq_50.gemfile +0 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 43c02b1229d902d187dee8281c88820a95d13a30ee594af7ca131645ffd85485
4
- data.tar.gz: c6ebd7b760e56adacacbb89390d5abc463ded7a72e37d346de0d51fb615a6582
3
+ metadata.gz: 4c57253509dac7b4769c0e5849ceaff9f3a95d5d2ddd8ac3e21085fccd4b4579
4
+ data.tar.gz: e66afe82c07e5334de5d8f71c06803aea19e033e242d71b632d65a088f9d4e5a
5
5
  SHA512:
6
- metadata.gz: 14220075cac092132c13d0c6d82bdfbc374c0c7a50db0d3e0d07e950fae0eda073b6958c30657f3bb089cbfcc0137d18fd56ae2f505e1f16d61917b929d25a6e
7
- data.tar.gz: a568b0e9ea1b96549ed78082c9ccef3946a5a8dbd8b7b9dc231a609a52d59c928069d7f7a5cf4c99f509589830279ff16b1e05a055114674d5dac8d2ccf85274
6
+ metadata.gz: 7934610efa74dfbcbd6a58c61b6266ada44babd8dbb299b724e5967598dbcbcef17159931ac40339ae79865b29e90fe8a3a00a2bc0ed3a9476ad00f594382c18
7
+ data.tar.gz: bbf9d044b365f8e1b17374808201f929719335f72e956f71f31421f47449d231603ea1eccc27e2e3104aa971418bb0e16c8c6aabd29f1404cf12d15eaafc42e0
@@ -12,55 +12,49 @@ jobs:
12
12
  fail-fast: false
13
13
  matrix:
14
14
  ruby:
15
+ - "3.3"
15
16
  - "3.2"
16
17
  - "3.1"
17
- - "3.0"
18
- - "2.7"
19
18
  suite:
20
19
  - core
21
- - faraday-0.9
22
20
  - faraday-1.0
21
+ - faraday-2.0
23
22
  - msgr
24
23
  - rack
25
- - rails-5.2
26
- - rails-6.0
27
24
  - rails-6.1
28
25
  - rails-7.0
26
+ - rails-7.1
29
27
  - redis-4.0
30
28
  - redis-5.0
31
29
  - redis-client
32
30
  - restify
33
- - sidekiq-5
34
31
  - sidekiq-6
35
32
  - sidekiq-7
36
33
  include:
37
34
  - suite: core
38
35
  spec: --tag ~probe
39
36
  gemfile: gemfiles/core.gemfile
40
- - suite: faraday-0.9
41
- spec: --tag probe:faraday
42
- gemfile: gemfiles/faraday_09.gemfile
43
37
  - suite: faraday-1.0
44
38
  spec: --tag probe:faraday
45
39
  gemfile: gemfiles/faraday_10.gemfile
40
+ - suite: faraday-2.0
41
+ spec: --tag probe:faraday
42
+ gemfile: gemfiles/faraday_20.gemfile
46
43
  - suite: msgr
47
44
  spec: --tag probe:msgr
48
45
  gemfile: gemfiles/core.gemfile
49
46
  - suite: rack
50
47
  spec: --tag probe:rack
51
48
  gemfile: gemfiles/core.gemfile
52
- - suite: rails-5.2
53
- spec: --tag probe:rails --tag ~probe
54
- gemfile: gemfiles/rails_52.gemfile
55
- - suite: rails-6.0
56
- spec: --tag probe:rails --tag ~probe
57
- gemfile: gemfiles/rails_60.gemfile
58
49
  - suite: rails-6.1
59
50
  spec: --tag probe:rails --tag ~probe
60
51
  gemfile: gemfiles/rails_61.gemfile
61
52
  - suite: rails-7.0
62
53
  spec: --tag probe:rails --tag ~probe
63
54
  gemfile: gemfiles/rails_70.gemfile
55
+ - suite: rails-7.1
56
+ spec: --tag probe:rails --tag ~probe
57
+ gemfile: gemfiles/rails_71.gemfile
64
58
  - suite: redis-4.0
65
59
  spec: --tag probe:redis
66
60
  gemfile: gemfiles/redis_40.gemfile
@@ -73,22 +67,12 @@ jobs:
73
67
  - suite: restify
74
68
  spec: --tag probe:restify
75
69
  gemfile: gemfiles/core.gemfile
76
- - suite: sidekiq-5
77
- spec: --tag probe:sidekiq
78
- gemfile: gemfiles/sidekiq_50.gemfile
79
70
  - suite: sidekiq-6
80
71
  spec: --tag probe:sidekiq
81
72
  gemfile: gemfiles/sidekiq_60.gemfile
82
73
  - suite: sidekiq-7
83
74
  spec: --tag probe:sidekiq
84
75
  gemfile: gemfiles/sidekiq_70.gemfile
85
- exclude:
86
- - suite: rails-5.2
87
- ruby: '3.2'
88
- - suite: rails-5.2
89
- ruby: '3.1'
90
- - suite: rails-5.2
91
- ruby: '3.0'
92
76
 
93
77
  env:
94
78
  BUNDLE_GEMFILE: ${{ matrix.gemfile }}
@@ -118,3 +102,23 @@ jobs:
118
102
  env:
119
103
  AMQP_SERVER: amqp://localhost:${{ job.services.rabbitmq.ports[5672] }}
120
104
  run: bundle exec rspec --color ${{ matrix.spec }}
105
+
106
+ rubocop:
107
+ name: rubocop
108
+ runs-on: ubuntu-22.04
109
+
110
+ env:
111
+ BUNDLE_WITHOUT: development test
112
+
113
+ steps:
114
+ - uses: actions/checkout@master
115
+ - uses: ruby/setup-ruby@v1
116
+ env:
117
+ BUNDLE_JOBS: 4
118
+ BUNDLE_RETRY: 3
119
+ with:
120
+ ruby-version: 3.1
121
+ bundler-cache: true
122
+
123
+ - name: Run rubocop
124
+ run: bundle exec rubocop --parallel --color
data/.rubocop.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.7
2
+ TargetRubyVersion: 3.1
3
3
  Exclude:
4
4
  - 'vendor/**/*'
5
5
  - 'gemfiles/**/*'
data/Appraisals CHANGED
@@ -4,14 +4,6 @@ appraise 'core' do
4
4
  remove_gem 'rubocop'
5
5
  end
6
6
 
7
- appraise 'faraday-09' do
8
- remove_gem 'rubocop'
9
-
10
- group :test do
11
- gem 'faraday', '~> 0.9'
12
- end
13
- end
14
-
15
7
  appraise 'faraday-10' do
16
8
  remove_gem 'rubocop'
17
9
 
@@ -20,38 +12,37 @@ appraise 'faraday-10' do
20
12
  end
21
13
  end
22
14
 
23
- appraise 'rails-70' do
15
+ appraise 'faraday-20' do
24
16
  remove_gem 'rubocop'
25
17
 
26
18
  group :test do
27
- gem 'rails', '~> 7.0.0'
28
- gem 'sqlite3', '~> 1.4'
19
+ gem 'faraday', '~> 2.0'
29
20
  end
30
21
  end
31
22
 
32
- appraise 'rails-61' do
23
+ appraise 'rails-71' do
33
24
  remove_gem 'rubocop'
34
25
 
35
26
  group :test do
36
- gem 'rails', '~> 6.1.0'
27
+ gem 'rails', '~> 7.1.0'
37
28
  gem 'sqlite3', '~> 1.4'
38
29
  end
39
30
  end
40
31
 
41
- appraise 'rails-60' do
32
+ appraise 'rails-70' do
42
33
  remove_gem 'rubocop'
43
34
 
44
35
  group :test do
45
- gem 'rails', '~> 6.0.0'
36
+ gem 'rails', '~> 7.0.0'
46
37
  gem 'sqlite3', '~> 1.4'
47
38
  end
48
39
  end
49
40
 
50
- appraise 'rails-52' do
41
+ appraise 'rails-61' do
51
42
  remove_gem 'rubocop'
52
43
 
53
44
  group :test do
54
- gem 'rails', '~> 5.2.0'
45
+ gem 'rails', '~> 6.1.0'
55
46
  gem 'sqlite3', '~> 1.4'
56
47
  end
57
48
  end
@@ -72,14 +63,6 @@ appraise 'redis-50' do
72
63
  end
73
64
  end
74
65
 
75
- appraise 'sidekiq-50' do
76
- remove_gem 'rubocop'
77
-
78
- group :test do
79
- gem 'sidekiq', '~> 5.0'
80
- end
81
- end
82
-
83
66
  appraise 'sidekiq-60' do
84
67
  remove_gem 'rubocop'
85
68
 
data/CHANGELOG.md CHANGED
@@ -6,6 +6,27 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ### Removed
10
+
11
+ - Dropped support for Ruby < 3.1
12
+ - Dropped support for Rails < 6.1
13
+ - Dropped support for Sidekiq < 6.0
14
+ - Dropped support for Faraday < 1.0
15
+
16
+ ### Added
17
+
18
+ - Added Faraday 2.0 to test matrix
19
+
20
+ ## [1.17.0] - 2023-11-28
21
+
22
+ ### Added
23
+
24
+ - Add testing for Rails 7.1 by @MrSerth
25
+
26
+ ### Fixed
27
+
28
+ - Invalid exception class for ActionDispatch::ExceptionWrapper by @jgraichen
29
+
9
30
  ## [1.16.0] - 2023-08-24
10
31
 
11
32
  ### Added
@@ -202,7 +223,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
202
223
 
203
224
  - Add platform identifier
204
225
 
205
- [Unreleased]: https://github.com/mnemosyne-mon/mnemosyne-ruby/compare/v1.16.0...HEAD
226
+ [Unreleased]: https://github.com/mnemosyne-mon/mnemosyne-ruby/compare/v1.17.0...HEAD
227
+ [1.17.0]: https://github.com/mnemosyne-mon/mnemosyne-ruby/compare/v1.16.0...v1.17.0
206
228
  [1.16.0]: https://github.com/mnemosyne-mon/mnemosyne-ruby/compare/v1.15.0...v1.16.0
207
229
  [1.15.0]: https://github.com/mnemosyne-mon/mnemosyne-ruby/compare/v1.14.0...v1.15.0
208
230
  [1.14.0]: https://github.com/mnemosyne-mon/mnemosyne-ruby/compare/v1.14.0...v1.13.0
data/Gemfile CHANGED
@@ -6,7 +6,7 @@ source 'https://rubygems.org'
6
6
  gemspec
7
7
 
8
8
  gem 'rake', '~> 13.0'
9
- gem 'rubocop', '~> 1.56.0'
9
+ gem 'rubocop', '~> 1.60.0'
10
10
 
11
11
  group :test do
12
12
  gem 'rspec', '~> 3.6'
data/README.md CHANGED
@@ -6,14 +6,19 @@ Supported probes:
6
6
 
7
7
  * Acfs: Remote calls including tracing middleware
8
8
  * ActionController: Processing actions and rendering
9
- * ActiveView: Template and Partial rendering
9
+ * ActionDispatch: Error capturing
10
+ * ActiveJob: Background job execution
10
11
  * ActiveRecord: SQL query time
12
+ * ActiveView: Template and Partial rendering
13
+ * Faraday: HTTP client operations and tracing injection
11
14
  * Grape: Endpoint run, filter and render times
12
15
  * Mnemosyne: Custom traces
16
+ * Msgr: Event publishing and consumer processing
17
+ * Rack: Middleware for request tracing
18
+ * Redis: Client operations
13
19
  * Responders: render time
14
20
  * Restify: Remote calls including tracing middleware
15
21
  * Sidekiq: Client and server tracing
16
- * Rack: Middleware for request tracing
17
22
  * ViewComponent: Component rendering (needs [additional configuration](https://viewcomponent.org/guide/instrumentation.html))
18
23
 
19
24
  ## Installation
@@ -21,15 +26,11 @@ Supported probes:
21
26
  Add this line to your Gemfile:
22
27
 
23
28
  ```ruby
24
- gem 'mnemosyne-ruby', '~> 1.0'
29
+ gem 'mnemosyne-ruby', '~> 2.0'
25
30
  ```
26
31
 
27
32
  Note: Removing support for ancient Ruby or Rails versions will not result in a new major. Please be extra careful when using ancient Ruby or Rails versions and updating gems.
28
33
 
29
- ## Usage
30
-
31
- TODO
32
-
33
34
  ## License
34
35
 
35
36
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -11,6 +11,7 @@ group :test do
11
11
  gem "msgr"
12
12
  gem "rails"
13
13
  gem "redis"
14
+ gem "redis-client"
14
15
  gem "restify"
15
16
  gem "sidekiq"
16
17
  gem "sqlite3"
@@ -11,6 +11,7 @@ group :test do
11
11
  gem "msgr"
12
12
  gem "rails"
13
13
  gem "redis"
14
+ gem "redis-client"
14
15
  gem "restify"
15
16
  gem "sidekiq"
16
17
  gem "sqlite3"
@@ -7,10 +7,11 @@ gem "rake", "~> 13.0"
7
7
  group :test do
8
8
  gem "rspec", "~> 3.6"
9
9
  gem "timecop", "~> 0.9.1"
10
- gem "faraday", "~> 0.9"
10
+ gem "faraday", "~> 2.0"
11
11
  gem "msgr"
12
12
  gem "rails"
13
13
  gem "redis"
14
+ gem "redis-client"
14
15
  gem "restify"
15
16
  gem "sidekiq"
16
17
  gem "sqlite3"
@@ -11,6 +11,7 @@ group :test do
11
11
  gem "msgr"
12
12
  gem "rails", "~> 6.1.0"
13
13
  gem "redis"
14
+ gem "redis-client"
14
15
  gem "restify"
15
16
  gem "sidekiq"
16
17
  gem "sqlite3", "~> 1.4"
@@ -11,6 +11,7 @@ group :test do
11
11
  gem "msgr"
12
12
  gem "rails", "~> 7.0.0"
13
13
  gem "redis"
14
+ gem "redis-client"
14
15
  gem "restify"
15
16
  gem "sidekiq"
16
17
  gem "sqlite3", "~> 1.4"
@@ -9,8 +9,9 @@ group :test do
9
9
  gem "timecop", "~> 0.9.1"
10
10
  gem "faraday"
11
11
  gem "msgr"
12
- gem "rails", "~> 5.2.0"
12
+ gem "rails", "~> 7.1.0"
13
13
  gem "redis"
14
+ gem "redis-client"
14
15
  gem "restify"
15
16
  gem "sidekiq"
16
17
  gem "sqlite3", "~> 1.4"
@@ -11,6 +11,7 @@ group :test do
11
11
  gem "msgr"
12
12
  gem "rails"
13
13
  gem "redis", "~> 4.0"
14
+ gem "redis-client"
14
15
  gem "restify"
15
16
  gem "sidekiq"
16
17
  gem "sqlite3"
@@ -11,6 +11,7 @@ group :test do
11
11
  gem "msgr"
12
12
  gem "rails"
13
13
  gem "redis", "~> 5.0"
14
+ gem "redis-client"
14
15
  gem "restify"
15
16
  gem "sidekiq"
16
17
  gem "sqlite3"
@@ -11,6 +11,7 @@ group :test do
11
11
  gem "msgr"
12
12
  gem "rails"
13
13
  gem "redis"
14
+ gem "redis-client"
14
15
  gem "restify"
15
16
  gem "sidekiq", "~> 6.0"
16
17
  gem "sqlite3"
@@ -11,6 +11,7 @@ group :test do
11
11
  gem "msgr"
12
12
  gem "rails"
13
13
  gem "redis"
14
+ gem "redis-client"
14
15
  gem "restify"
15
16
  gem "sidekiq", "~> 7.0"
16
17
  gem "sqlite3"
@@ -15,7 +15,7 @@ module Mnemosyne
15
15
  logger.info "[Mnemosyne] Connect to #{@config.server}..."
16
16
 
17
17
  connection = ::Bunny.new @config.amqp,
18
- logger: logger,
18
+ logger:,
19
19
  heartbeat: :server
20
20
 
21
21
  connection.start
@@ -3,8 +3,12 @@
3
3
  module Mnemosyne
4
4
  module Global
5
5
  def trace(name, meta: {}, &block)
6
- ::ActiveSupport::Notifications.instrument 'trace.mnemosyne',
7
- name: name, meta: meta, &block
6
+ ::ActiveSupport::Notifications.instrument(
7
+ 'trace.mnemosyne',
8
+ name:,
9
+ meta:,
10
+ &block
11
+ )
8
12
  end
9
13
 
10
14
  def attach_error(err)
@@ -66,7 +66,7 @@ module Mnemosyne
66
66
 
67
67
  client = Client.new(config)
68
68
 
69
- @instance = new(config: config, client: client)
69
+ @instance = new(config:, client:)
70
70
  end
71
71
  rescue StandardError => e
72
72
  ::Mnemosyne::Logging.logger.warn(Mnemosyne) do
@@ -16,9 +16,9 @@ module Mnemosyne
16
16
  @body.respond_to?(*args)
17
17
  end
18
18
 
19
- def method_missing(*args, &block)
19
+ def method_missing(*args, &)
20
20
  super if args.first && args.first.to_s == 'to_ary'
21
- @body.__send__(*args, &block)
21
+ @body.__send__(*args, &)
22
22
  end
23
23
 
24
24
  def close
@@ -64,9 +64,11 @@ module Mnemosyne
64
64
  ::SecureRandom.uuid
65
65
  end
66
66
 
67
- trace = ::Mnemosyne::Instrumenter.trace 'app.web.request.rack',
68
- transaction: transaction,
69
- origin: origin
67
+ trace = ::Mnemosyne::Instrumenter.trace(
68
+ 'app.web.request.rack',
69
+ transaction:,
70
+ origin:
71
+ )
70
72
 
71
73
  if trace
72
74
  trace.start!
@@ -9,15 +9,17 @@ module Mnemosyne
9
9
 
10
10
  meta = {
11
11
  raw: job,
12
- queue: queue,
12
+ queue:,
13
13
  worker: worker.class.name,
14
14
  arguments: job['args']
15
15
  }
16
16
 
17
- trace = ::Mnemosyne::Instrumenter.trace 'app.job.perform.sidekiq',
18
- transaction: transaction,
19
- origin: origin,
20
- meta: meta
17
+ trace = ::Mnemosyne::Instrumenter.trace(
18
+ 'app.job.perform.sidekiq',
19
+ transaction:,
20
+ origin:,
21
+ meta:
22
+ )
21
23
 
22
24
  trace&.start!
23
25
 
@@ -25,8 +25,12 @@ module Mnemosyne
25
25
  backtrace: callers[1..]
26
26
  }
27
27
 
28
- span = ::Mnemosyne::Span.new 'external.run.acfs',
29
- start: start, finish: finish, meta: meta
28
+ span = ::Mnemosyne::Span.new(
29
+ 'external.run.acfs',
30
+ start:,
31
+ finish:,
32
+ meta:
33
+ )
30
34
 
31
35
  trace << span
32
36
  end
@@ -17,8 +17,12 @@ module Mnemosyne
17
17
  format: payload[:format]
18
18
  }
19
19
 
20
- span = ::Mnemosyne::Span.new 'app.controller.request.rails',
21
- start: start, finish: finish, meta: meta
20
+ span = ::Mnemosyne::Span.new(
21
+ 'app.controller.request.rails',
22
+ start:,
23
+ finish:,
24
+ meta:
25
+ )
22
26
 
23
27
  trace << span
24
28
  end
@@ -17,15 +17,18 @@ module Mnemosyne
17
17
  start = ::Mnemosyne::Clock.to_tick(start)
18
18
  finish = ::Mnemosyne::Clock.to_tick(finish)
19
19
 
20
- span = ::Mnemosyne::Span.new 'app.controller.renderers.rails',
21
- start: start, finish: finish
20
+ span = ::Mnemosyne::Span.new(
21
+ 'app.controller.renderers.rails',
22
+ start:,
23
+ finish:
24
+ )
22
25
 
23
26
  trace << span
24
27
  end
25
28
  end
26
29
 
27
30
  module Instrumentation
28
- def render_to_body(*args, &block)
31
+ def render_to_body(*args, &)
29
32
  ::ActiveSupport::Notifications.instrument CATEGORY do
30
33
  super
31
34
  end
@@ -12,7 +12,12 @@ module Mnemosyne
12
12
  module Instrumentation
13
13
  def render_exception(env, exception)
14
14
  if (trace = ::Mnemosyne::Instrumenter.current_trace)
15
- trace.attach_error(exception)
15
+ if exception.respond_to?(:unwrapped_exception) && exception.respond_to?(:exception)
16
+ # ActionDispatch::ExceptionWrapper
17
+ trace.attach_error(exception.exception)
18
+ else
19
+ trace.attach_error(exception)
20
+ end
16
21
  end
17
22
 
18
23
  super
@@ -11,8 +11,12 @@ module Mnemosyne
11
11
  start = ::Mnemosyne::Clock.to_tick(start)
12
12
  finish = ::Mnemosyne::Clock.to_tick(finish)
13
13
 
14
- span = ::Mnemosyne::Span.new 'view.render.template.rails',
15
- start: start, finish: finish, meta: payload
14
+ span = ::Mnemosyne::Span.new(
15
+ 'view.render.template.rails',
16
+ start:,
17
+ finish:,
18
+ meta: payload
19
+ )
16
20
 
17
21
  trace << span
18
22
  end
@@ -11,8 +11,12 @@ module Mnemosyne
11
11
  start = ::Mnemosyne::Clock.to_tick(start)
12
12
  finish = ::Mnemosyne::Clock.to_tick(finish)
13
13
 
14
- span = ::Mnemosyne::Span.new 'view.render.template.rails',
15
- start: start, finish: finish, meta: payload
14
+ span = ::Mnemosyne::Span.new(
15
+ 'view.render.template.rails',
16
+ start:,
17
+ finish:,
18
+ meta: payload
19
+ )
16
20
 
17
21
  trace << span
18
22
  end
@@ -20,8 +20,12 @@ module Mnemosyne
20
20
  queue: job.queue_name
21
21
  }
22
22
 
23
- span = ::Mnemosyne::Span.new 'app.job.perform.active_job',
24
- start: start, finish: finish, meta: meta
23
+ span = ::Mnemosyne::Span.new(
24
+ 'app.job.perform.active_job',
25
+ start:,
26
+ finish:,
27
+ meta:
28
+ )
25
29
 
26
30
  trace << span
27
31
  end
@@ -16,8 +16,12 @@ module Mnemosyne
16
16
  class_name: payload[:class_name]
17
17
  }
18
18
 
19
- span = ::Mnemosyne::Span.new 'db.instantiation.active_record',
20
- start: start, finish: finish, meta: meta
19
+ span = ::Mnemosyne::Span.new(
20
+ 'db.instantiation.active_record',
21
+ start:,
22
+ finish:,
23
+ meta:
24
+ )
21
25
 
22
26
  trace << span
23
27
  end
@@ -18,8 +18,12 @@ module Mnemosyne
18
18
  binds: extract_bind_values(payload)
19
19
  }
20
20
 
21
- span = ::Mnemosyne::Span.new 'db.query.active_record',
22
- start: start, finish: finish, meta: meta
21
+ span = ::Mnemosyne::Span.new(
22
+ 'db.query.active_record',
23
+ start:,
24
+ finish:,
25
+ meta:
26
+ )
23
27
 
24
28
  trace << span
25
29
  end
@@ -17,16 +17,7 @@ module Mnemosyne
17
17
 
18
18
  module Extension
19
19
  def lock!
20
- unless @handlers.include?('Mnemosyne::Middleware::Faraday')
21
- if ::Faraday::VERSION < '1.0' &&
22
- respond_to?(:is_adapter?, true) &&
23
- (idx = @handlers.find_index {|m| is_adapter?(m) })
24
-
25
- insert(idx, ::Mnemosyne::Middleware::Faraday)
26
- else
27
- use(::Mnemosyne::Middleware::Faraday)
28
- end
29
- end
20
+ use(::Mnemosyne::Middleware::Faraday) unless @handlers.include?('Mnemosyne::Middleware::Faraday')
30
21
 
31
22
  super
32
23
  end
@@ -14,8 +14,11 @@ module Mnemosyne
14
14
  endpoint = payload[:endpoint]
15
15
  return unless endpoint
16
16
 
17
- span = ::Mnemosyne::Span.new 'view.render.grape',
18
- start: start, finish: finish
17
+ span = ::Mnemosyne::Span.new(
18
+ 'view.render.grape',
19
+ start:,
20
+ finish:
21
+ )
19
22
 
20
23
  trace << span
21
24
  end
@@ -19,8 +19,12 @@ module Mnemosyne
19
19
  format: extract_format(payload[:env])
20
20
  }
21
21
 
22
- span = ::Mnemosyne::Span.new 'app.controller.request.grape',
23
- start: start, finish: finish, meta: meta
22
+ span = ::Mnemosyne::Span.new(
23
+ 'app.controller.request.grape',
24
+ start:,
25
+ finish:,
26
+ meta:
27
+ )
24
28
 
25
29
  trace << span
26
30
  end
@@ -14,8 +14,11 @@ module Mnemosyne
14
14
  endpoint = payload[:endpoint]
15
15
  return unless endpoint
16
16
 
17
- span = ::Mnemosyne::Span.new 'app.controller.filter.grape',
18
- start: start, finish: finish
17
+ span = ::Mnemosyne::Span.new(
18
+ 'app.controller.filter.grape',
19
+ start:,
20
+ finish:
21
+ )
19
22
 
20
23
  trace << span
21
24
  end
@@ -11,8 +11,12 @@ module Mnemosyne
11
11
  start = ::Mnemosyne::Clock.to_tick(start)
12
12
  finish = ::Mnemosyne::Clock.to_tick(finish)
13
13
 
14
- span = ::Mnemosyne::Span.new 'custom.trace',
15
- start: start, finish: finish, meta: payload
14
+ span = ::Mnemosyne::Span.new(
15
+ 'custom.trace',
16
+ start:,
17
+ finish:,
18
+ meta: payload
19
+ )
16
20
 
17
21
  trace << span
18
22
  end
@@ -16,7 +16,7 @@ module Mnemosyne
16
16
  def publish(payload, options = {})
17
17
  if (trace = ::Mnemosyne::Instrumenter.current_trace)
18
18
  meta = {}
19
- span = ::Mnemosyne::Span.new(NAME, meta: meta)
19
+ span = ::Mnemosyne::Span.new(NAME, meta:)
20
20
  span.start!
21
21
 
22
22
  options[:headers] ||= {}
@@ -24,9 +24,11 @@ module Mnemosyne
24
24
  ::SecureRandom.uuid
25
25
  end
26
26
 
27
- trace = ::Mnemosyne::Instrumenter.trace NAME,
28
- transaction: transaction,
29
- origin: origin
27
+ trace = ::Mnemosyne::Instrumenter.trace(
28
+ NAME,
29
+ transaction:,
30
+ origin:
31
+ )
30
32
 
31
33
  if trace
32
34
  trace.meta[:properties] = {
@@ -16,8 +16,11 @@ module Mnemosyne
16
16
  start = ::Mnemosyne::Clock.to_tick(start)
17
17
  finish = ::Mnemosyne::Clock.to_tick(finish)
18
18
 
19
- span = ::Mnemosyne::Span.new 'app.responder.respond',
20
- start: start, finish: finish
19
+ span = ::Mnemosyne::Span.new(
20
+ 'app.responder.respond',
21
+ start:,
22
+ finish:
23
+ )
21
24
 
22
25
  trace << span
23
26
  end
@@ -13,7 +13,7 @@ module Mnemosyne
13
13
  def call(request)
14
14
  if (trace = ::Mnemosyne::Instrumenter.current_trace)
15
15
  meta = {url: request.uri.to_s, method: request.method}
16
- span = ::Mnemosyne::Span.new 'external.http.restify', meta: meta
16
+ span = ::Mnemosyne::Span.new('external.http.restify', meta:)
17
17
 
18
18
  span.start!
19
19
 
@@ -24,7 +24,7 @@ module Mnemosyne
24
24
  raw: job.clone
25
25
  }
26
26
 
27
- span = ::Mnemosyne::Span.new('external.job.sidekiq', meta: meta)
27
+ span = ::Mnemosyne::Span.new('external.job.sidekiq', meta:)
28
28
  span.finish! oneshot: true
29
29
 
30
30
  job['mnemosyne.transaction'] = trace.transaction
@@ -11,8 +11,12 @@ module Mnemosyne
11
11
  start = ::Mnemosyne::Clock.to_tick(start)
12
12
  finish = ::Mnemosyne::Clock.to_tick(finish)
13
13
 
14
- span = ::Mnemosyne::Span.new 'view.render.component.view_component',
15
- start: start, finish: finish, meta: payload
14
+ span = ::Mnemosyne::Span.new(
15
+ 'view.render.component.view_component',
16
+ start:,
17
+ finish:,
18
+ meta: payload
19
+ )
16
20
 
17
21
  trace << span
18
22
  end
@@ -37,12 +37,12 @@ module Mnemosyne
37
37
 
38
38
  def serialize
39
39
  {
40
- uuid: uuid,
41
- name: name,
42
- type: type,
43
- start: start,
40
+ uuid:,
41
+ name:,
42
+ type:,
43
+ start:,
44
44
  stop: finish,
45
- meta: meta
45
+ meta:
46
46
  }
47
47
  end
48
48
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Mnemosyne
4
4
  class Trace < Span
5
- BT_REGEXP = /^((?:[a-zA-Z]:)?[^:]+):(\d+)(?::in `([^']+)')?$/.freeze
5
+ BT_REGEXP = /^((?:[a-zA-Z]:)?[^:]+):(\d+)(?::in `([^']+)')?$/
6
6
 
7
7
  attr_reader :uuid, :transaction, :origin, :span, :errors
8
8
 
@@ -46,13 +46,13 @@ module Mnemosyne
46
46
 
47
47
  def serialize
48
48
  {
49
- uuid: uuid,
50
- origin: origin,
51
- transaction: transaction,
52
- name: name,
53
- start: start,
49
+ uuid:,
50
+ origin:,
51
+ transaction:,
52
+ name:,
53
+ start:,
54
54
  stop: finish,
55
- meta: meta,
55
+ meta:,
56
56
  span: @span.map(&:serialize),
57
57
  errors: @errors.map(&:serialize)
58
58
  }
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Mnemosyne
4
4
  module VERSION
5
- MAJOR = 1
6
- MINOR = 16
5
+ MAJOR = 2
6
+ MINOR = 0
7
7
  PATCH = 0
8
8
  STAGE = nil
9
9
 
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.executables = spec.files.grep(%r{^bin/}) {|f| File.basename(f) }
27
27
  spec.require_paths = %w[lib]
28
28
 
29
- spec.required_ruby_version = '>= 2.7'
30
- spec.add_runtime_dependency 'activesupport', '>= 4'
29
+ spec.required_ruby_version = '>= 3.1'
30
+ spec.add_runtime_dependency 'activesupport', '>= 6.1'
31
31
  spec.add_runtime_dependency 'bunny'
32
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mnemosyne-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Graichen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-24 00:00:00.000000000 Z
11
+ date: 2024-02-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4'
19
+ version: '6.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '4'
26
+ version: '6.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bunny
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -46,7 +46,6 @@ extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
48
  - ".editorconfig"
49
- - ".github/workflows/lint.yml"
50
49
  - ".github/workflows/test.yml"
51
50
  - ".gitignore"
52
51
  - ".markdownlint.yml"
@@ -60,15 +59,13 @@ files:
60
59
  - README.md
61
60
  - Rakefile
62
61
  - gemfiles/core.gemfile
63
- - gemfiles/faraday_09.gemfile
64
62
  - gemfiles/faraday_10.gemfile
65
- - gemfiles/rails_52.gemfile
66
- - gemfiles/rails_60.gemfile
63
+ - gemfiles/faraday_20.gemfile
67
64
  - gemfiles/rails_61.gemfile
68
65
  - gemfiles/rails_70.gemfile
66
+ - gemfiles/rails_71.gemfile
69
67
  - gemfiles/redis_40.gemfile
70
68
  - gemfiles/redis_50.gemfile
71
- - gemfiles/sidekiq_50.gemfile
72
69
  - gemfiles/sidekiq_60.gemfile
73
70
  - gemfiles/sidekiq_70.gemfile
74
71
  - lib/mnemosyne-ruby.rb
@@ -131,14 +128,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
131
128
  requirements:
132
129
  - - ">="
133
130
  - !ruby/object:Gem::Version
134
- version: '2.7'
131
+ version: '3.1'
135
132
  required_rubygems_version: !ruby/object:Gem::Requirement
136
133
  requirements:
137
134
  - - ">="
138
135
  - !ruby/object:Gem::Version
139
136
  version: '0'
140
137
  requirements: []
141
- rubygems_version: 3.4.18
138
+ rubygems_version: 3.5.3
142
139
  signing_key:
143
140
  specification_version: 4
144
141
  summary: Ruby/Rails client for Mnemosyne APM
@@ -1,25 +0,0 @@
1
- name: Lint
2
- on:
3
- - pull_request
4
- - push
5
-
6
- jobs:
7
- rubocop:
8
- name: rubocop
9
- runs-on: ubuntu-22.04
10
-
11
- env:
12
- BUNDLE_WITHOUT: development test
13
-
14
- steps:
15
- - uses: actions/checkout@master
16
- - uses: ruby/setup-ruby@v1
17
- env:
18
- BUNDLE_JOBS: 4
19
- BUNDLE_RETRY: 3
20
- with:
21
- ruby-version: 3.1
22
- bundler-cache: true
23
-
24
- - name: Run rubocop
25
- run: bundle exec rubocop --parallel --color
@@ -1,27 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rake", "~> 13.0"
6
-
7
- group :test do
8
- gem "rspec", "~> 3.6"
9
- gem "timecop", "~> 0.9.1"
10
- gem "faraday"
11
- gem "msgr"
12
- gem "rails", "~> 6.0.0"
13
- gem "redis"
14
- gem "restify"
15
- gem "sidekiq"
16
- gem "sqlite3", "~> 1.4"
17
- gem "webmock"
18
- end
19
-
20
- group :development do
21
- gem "appraisal"
22
- gem "rake-release", "~> 1.3.0"
23
- gem "pry", require: false
24
- gem "pry-byebug", require: false
25
- end
26
-
27
- gemspec path: "../"
@@ -1,27 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rake", "~> 13.0"
6
-
7
- group :test do
8
- gem "rspec", "~> 3.6"
9
- gem "timecop", "~> 0.9.1"
10
- gem "faraday"
11
- gem "msgr"
12
- gem "rails"
13
- gem "redis"
14
- gem "restify"
15
- gem "sidekiq", "~> 5.0"
16
- gem "sqlite3"
17
- gem "webmock"
18
- end
19
-
20
- group :development do
21
- gem "appraisal"
22
- gem "rake-release", "~> 1.3.0"
23
- gem "pry", require: false
24
- gem "pry-byebug", require: false
25
- end
26
-
27
- gemspec path: "../"