yabeda-activerecord 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83bb6125e110b70693f45275374a147ce852728cc61aa9c7470d3a6252a4280e
4
- data.tar.gz: eda2a52714b38359ce75d8cbd947050ae5853919c87bc1d3603899a56031bab6
3
+ metadata.gz: b49f592394f0358ff0f7c4267874f15b2e50798f3d99152e4edfab3c874b048f
4
+ data.tar.gz: 8002dbd0d31d7899673aa3d1aeab9679d291b3fc14797130b115c7404bff14e5
5
5
  SHA512:
6
- metadata.gz: e6b7fef1515cd4df6327c0ca8261e6a9797a1c1a4909549b6fb472d0f05c895e568b32bab6a999ec9905c61e1a1f14623769f9568d9f7c3a1d6aaa08c28d521f
7
- data.tar.gz: 5d1a28c0a1399c1129c37411e7e03f29d747c5a43731f9997c6d657198a8d77ee31212f0c07f4835a9c0322c41bba632a770cd242a1dc5bf4b635504f38194e6
6
+ metadata.gz: dbf64a07defdbff7153c359a9d083e247cef902c93549d6d170ff9b34f45190cfae9193af279ad6e21e9ccad1e451fab8c170d9582b6ae2e0098551204b902a3
7
+ data.tar.gz: 27f007e1ccd9207de03313d80c2a2d267a773227985d84b7e8435d93dd436a553773987c6d152b57d5510b326ea04b22734e1e044e8d477ee4879521568a7fba
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## Unreleased
2
2
 
3
+ ## 0.1.2 - 2025-10-15
4
+
5
+ ### Added
6
+
7
+ - Ability to configure histogram bucket sizes for the `query_duration` metric. [#6](https://github.com/yabeda-rb/yabeda-activerecord/pull/6) by [@ryan-dyer-sp][]
8
+
3
9
  ## 0.1.1 - 2023-12-13
4
10
 
5
11
  ### Fixed
@@ -12,3 +18,4 @@
12
18
 
13
19
  [@Envek]: https://github.com/Envek/ "Andrey Novikov"
14
20
  [@intrip]: https://github.com/intrip "Jacopo Beschi"
21
+ [@ryan-dyer-sp]: https://github.com/ryan-dyer-sp "Ryan"
data/Gemfile CHANGED
@@ -27,7 +27,11 @@ else
27
27
  gem "activerecord", activerecord_version
28
28
  end
29
29
 
30
- gem "sqlite3"
30
+ if activerecord_version.match(/\d+\.\d+/)&.then(&Gem::Version.method(:new))&.< Gem::Version.new("8.0")
31
+ gem "sqlite3", "~> 1.4"
32
+ else
33
+ gem "sqlite3", "~> 2.0"
34
+ end
31
35
 
32
36
  gem "rake", "~> 13.0"
33
37
 
@@ -36,3 +40,5 @@ gem "rspec", "~> 3.0"
36
40
  gem "rubocop", "~> 1.30"
37
41
 
38
42
  gem "debug"
43
+
44
+ gem "anyway_config", ">= 1.3", "< 3.0"
data/README.md CHANGED
@@ -22,6 +22,14 @@ Launch/restart your application and that's it: metrics are being collected.
22
22
 
23
23
  To expose metrics Don't forget to also add one of [Yabeda adapters](https://github.com/yabeda-rb/yabeda#available-monitoring-system-adapters) to your Gemfile.
24
24
 
25
+ ## Configuration
26
+
27
+ Configuration is handled by [anyway_config] gem. With it you can load settings from environment variables (upcased and prefixed with `YABEDA_ACTIVERECORD_`), YAML files, and other sources. See [anyway_config] docs for details.
28
+
29
+ | Config key | Type | Default | Description |
30
+ | -----------| ----- | ------- | ------------------------------------------- |
31
+ | `buckets` | array | [] | Set buckets to be used by histogram metrics |
32
+
25
33
  ## Metrics
26
34
 
27
35
  ### Query performance
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "anyway"
4
+
5
+ module Yabeda
6
+ module ActiveRecord
7
+ # yabeda-activerecord configuration
8
+ class Config < ::Anyway::Config
9
+ config_name :yabeda_activerecord
10
+
11
+ attr_config :buckets
12
+ end
13
+ end
14
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Yabeda
4
4
  module ActiveRecord
5
- VERSION = "0.1.1"
5
+ VERSION = "0.1.2"
6
6
  end
7
7
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "yabeda"
4
4
  require "active_record"
5
+ require "yabeda/active_record/config"
5
6
 
6
7
  require_relative "active_record/version"
7
8
 
@@ -17,11 +18,14 @@ module Yabeda
17
18
 
18
19
  # rubocop: disable Layout/LineLength
19
20
  Yabeda.configure do
21
+ config = ::Yabeda::ActiveRecord::Config.new
22
+ buckets = config.buckets || LONG_RUNNING_QUERY_RUNTIME_BUCKETS
23
+
20
24
  group :activerecord do
21
25
  counter :queries_total, tags: %i[config kind cached async],
22
26
  comment: "Total number of SQL queries issued by application via ActiveRecord"
23
27
  histogram :query_duration, tags: %i[config kind cached async],
24
- unit: :seconds, buckets: LONG_RUNNING_QUERY_RUNTIME_BUCKETS,
28
+ unit: :seconds, buckets: buckets,
25
29
  comment: "Duration of SQL queries generated by ActiveRecord"
26
30
 
27
31
  gauge :connection_pool_size,
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yabeda-activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Novikov
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2023-12-13 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activerecord
@@ -24,6 +23,26 @@ dependencies:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
25
  version: '6.0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: anyway_config
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '1.3'
33
+ - - "<"
34
+ - !ruby/object:Gem::Version
35
+ version: '3.0'
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '1.3'
43
+ - - "<"
44
+ - !ruby/object:Gem::Version
45
+ version: '3.0'
27
46
  - !ruby/object:Gem::Dependency
28
47
  name: yabeda
29
48
  requirement: !ruby/object:Gem::Requirement
@@ -52,11 +71,11 @@ files:
52
71
  - ".rubocop.yml"
53
72
  - CHANGELOG.md
54
73
  - Gemfile
55
- - Gemfile.lock
56
74
  - LICENSE.txt
57
75
  - README.md
58
76
  - Rakefile
59
77
  - lib/yabeda/active_record.rb
78
+ - lib/yabeda/active_record/config.rb
60
79
  - lib/yabeda/active_record/version.rb
61
80
  - lib/yabeda/activerecord.rb
62
81
  - sig/yabeda/activerecord.rbs
@@ -69,7 +88,6 @@ metadata:
69
88
  homepage_uri: https://github.com/yabeda-rb/yabeda-activerecord
70
89
  source_code_uri: https://github.com/yabeda-rb/yabeda-activerecord
71
90
  changelog_uri: https://github.com/yabeda-rb/yabeda-activerecord/blob/master/CHANGELOG.md
72
- post_install_message:
73
91
  rdoc_options: []
74
92
  require_paths:
75
93
  - lib
@@ -84,8 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
102
  - !ruby/object:Gem::Version
85
103
  version: '0'
86
104
  requirements: []
87
- rubygems_version: 3.1.6
88
- signing_key:
105
+ rubygems_version: 3.6.9
89
106
  specification_version: 4
90
107
  summary: 'Yabeda plugin to collect ActiveRecord metrics: query performance, connection
91
108
  pool stats, etc.'
data/Gemfile.lock DELETED
@@ -1,95 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- yabeda-activerecord (0.1.1)
5
- activerecord (>= 6.0)
6
- yabeda (~> 0.6)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- activemodel (7.0.3)
12
- activesupport (= 7.0.3)
13
- activerecord (7.0.3)
14
- activemodel (= 7.0.3)
15
- activesupport (= 7.0.3)
16
- activesupport (7.0.3)
17
- concurrent-ruby (~> 1.0, >= 1.0.2)
18
- i18n (>= 1.6, < 2)
19
- minitest (>= 5.1)
20
- tzinfo (~> 2.0)
21
- anyway_config (2.3.0)
22
- ruby-next-core (>= 0.14.0)
23
- ast (2.4.2)
24
- concurrent-ruby (1.1.10)
25
- debug (1.5.0)
26
- irb (>= 1.3.6)
27
- reline (>= 0.2.7)
28
- diff-lcs (1.5.0)
29
- dry-initializer (3.1.1)
30
- i18n (1.10.0)
31
- concurrent-ruby (~> 1.0)
32
- io-console (0.5.11)
33
- irb (1.4.1)
34
- reline (>= 0.3.0)
35
- minitest (5.15.0)
36
- parallel (1.22.1)
37
- parser (3.1.2.0)
38
- ast (~> 2.4.1)
39
- rainbow (3.1.1)
40
- rake (13.0.6)
41
- regexp_parser (2.4.0)
42
- reline (0.3.1)
43
- io-console (~> 0.5)
44
- rexml (3.2.5)
45
- rspec (3.11.0)
46
- rspec-core (~> 3.11.0)
47
- rspec-expectations (~> 3.11.0)
48
- rspec-mocks (~> 3.11.0)
49
- rspec-core (3.11.0)
50
- rspec-support (~> 3.11.0)
51
- rspec-expectations (3.11.0)
52
- diff-lcs (>= 1.2.0, < 2.0)
53
- rspec-support (~> 3.11.0)
54
- rspec-mocks (3.11.1)
55
- diff-lcs (>= 1.2.0, < 2.0)
56
- rspec-support (~> 3.11.0)
57
- rspec-support (3.11.0)
58
- rubocop (1.30.0)
59
- parallel (~> 1.10)
60
- parser (>= 3.1.0.0)
61
- rainbow (>= 2.2.2, < 4.0)
62
- regexp_parser (>= 1.8, < 3.0)
63
- rexml (>= 3.2.5, < 4.0)
64
- rubocop-ast (>= 1.18.0, < 2.0)
65
- ruby-progressbar (~> 1.7)
66
- unicode-display_width (>= 1.4.0, < 3.0)
67
- rubocop-ast (1.18.0)
68
- parser (>= 3.1.1.0)
69
- ruby-next-core (0.15.1)
70
- ruby-progressbar (1.11.0)
71
- sqlite3 (1.4.2)
72
- tzinfo (2.0.4)
73
- concurrent-ruby (~> 1.0)
74
- unicode-display_width (2.1.0)
75
- yabeda (0.11.0)
76
- anyway_config (>= 1.0, < 3)
77
- concurrent-ruby
78
- dry-initializer
79
-
80
- PLATFORMS
81
- ruby
82
- x86_64-linux
83
-
84
- DEPENDENCIES
85
- activerecord (~> 7.0)
86
- debug
87
- rake (~> 13.0)
88
- rspec (~> 3.0)
89
- rubocop (~> 1.30)
90
- sqlite3
91
- yabeda (~> 0.11)
92
- yabeda-activerecord!
93
-
94
- BUNDLED WITH
95
- 2.3.14