yabeda-rails 0.9.0 → 0.10.0

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: 57391802b01a1ba8d7957b6aa3a41ebda6fcf3663587fd1cfdb87dcda3735ac7
4
- data.tar.gz: 13db9080e69a1dc4d110ee49f38610990b1c025c3bbc1d1151ec43cd67ed2520
3
+ metadata.gz: e922a45967dbc75c255c7bf6453e796e13157be68ba0c0c6813e8eb80633db8f
4
+ data.tar.gz: f4bf58df8b7a6904f40a4e47c7fdeab0756ffbab4f59910e90dab01f77e47886
5
5
  SHA512:
6
- metadata.gz: 2e7fc9992fa76b68825e1ff0f35073fee8f18e8bee4fe564de15d6ed7a38ae0e17617c061594760ae92585866f214798635c2866264f25963e588ffc7bb1eba0
7
- data.tar.gz: 478201adab47ddb487f12d5ec61fe55fc02b86d3bc779fe088d9bca7a13568468c310ac4dd46497e5a222e1eeeb604da43a5b0b1d270b22cffe0bc5cb559f318
6
+ metadata.gz: 256b563227886fadd1def58675cd7160e2ffadd8b1b7dd0951bdc203b7a3c0f97e298fde9640c4006187e9a202db8267498a8d2185a3f0b4100f77782555aa94
7
+ data.tar.gz: 62c3b89bf1fd7f7bb48a5bfeddd63f1d9cf86540db6b49d80075b00b94116471db59d6c7577554e4aff84f8063eacb094839c6789264cb380a6d0f585022cf1f
@@ -15,10 +15,10 @@ jobs:
15
15
  name: RuboCop
16
16
  runs-on: ubuntu-latest
17
17
  steps:
18
- - uses: actions/checkout@v2
18
+ - uses: actions/checkout@v4
19
19
  - uses: ruby/setup-ruby@v1
20
20
  with:
21
- ruby-version: "3.1"
21
+ ruby-version: "3.4"
22
22
  bundler-cache: true
23
23
  - name: Lint Ruby code with RuboCop
24
24
  run: |
@@ -1,4 +1,4 @@
1
- name: Build and release gem to RubyGems
1
+ name: Build and release gem
2
2
 
3
3
  on:
4
4
  push:
@@ -8,13 +8,17 @@ on:
8
8
  jobs:
9
9
  release:
10
10
  runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: write
13
+ id-token: write
14
+ packages: write
11
15
  steps:
12
- - uses: actions/checkout@v2
16
+ - uses: actions/checkout@v4
13
17
  with:
14
18
  fetch-depth: 0 # Fetch current tag as annotated. See https://github.com/actions/checkout/issues/290
15
19
  - uses: ruby/setup-ruby@v1
16
20
  with:
17
- ruby-version: 2.7
21
+ ruby-version: "3.4"
18
22
  - name: "Extract data from tag: version, message, body"
19
23
  id: tag
20
24
  run: |
@@ -75,8 +79,8 @@ jobs:
75
79
  GEM_HOST_API_KEY: Bearer ${{ secrets.GITHUB_TOKEN }}
76
80
  run: |
77
81
  gem push yabeda-rails-${{ steps.tag.outputs.version }}.gem --host https://rubygems.pkg.github.com/${{ github.repository_owner }}
82
+ - name: Configure RubyGems Credentials
83
+ uses: rubygems/configure-rubygems-credentials@main
78
84
  - name: Publish to RubyGems
79
- env:
80
- GEM_HOST_API_KEY: "${{ secrets.RUBYGEMS_API_KEY }}"
81
85
  run: |
82
86
  gem push yabeda-rails-${{ steps.tag.outputs.version }}.gem
@@ -14,36 +14,34 @@ jobs:
14
14
  # Skip running tests for local pull requests (use push event instead), run only for foreign ones
15
15
  if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login != github.event.pull_request.base.repo.owner.login
16
16
  runs-on: ubuntu-latest
17
+ continue-on-error: ${{ matrix.optional || false }}
17
18
  strategy:
18
19
  fail-fast: false
19
20
  matrix:
20
21
  include:
21
- - ruby: "3.2"
22
+ - ruby: "head"
22
23
  rails: "HEAD"
24
+ optional: true
25
+ - ruby: "3.4"
26
+ rails: "8.0"
27
+ - ruby: "3.3"
28
+ rails: "7.2"
29
+ - ruby: "3.2"
30
+ rails: "7.1"
23
31
  - ruby: "3.1"
24
32
  rails: "7.0"
25
33
  - ruby: "3.0"
26
34
  rails: "6.1"
27
35
  - ruby: "2.7"
28
36
  rails: "6.0"
29
- container:
30
- image: ruby:${{ matrix.ruby }}
31
- env:
32
- CI: true
33
- RAILS_VERSION: ${{ matrix.rails }}
37
+ env:
38
+ CI: true
39
+ RAILS_VERSION: ${{ matrix.rails }}
34
40
  steps:
35
- - uses: actions/checkout@v2
36
- - uses: actions/cache@v2
41
+ - uses: actions/checkout@v4
42
+ - uses: ruby/setup-ruby@v1
37
43
  with:
38
- path: vendor/bundle
39
- key: bundle-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}-${{ hashFiles('**/Gemfile') }}
40
- restore-keys: |
41
- bundle-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}-${{ hashFiles('**/Gemfile') }}
42
- bundle-${{ matrix.ruby }}-
43
- - name: Bundle install
44
- run: |
45
- bundle config path vendor/bundle
46
- bundle install
47
- bundle update
44
+ ruby-version: ${{ matrix.ruby }}
45
+ bundler-cache: true
48
46
  - name: Run RSpec
49
47
  run: bundle exec rspec
data/CHANGELOG.md CHANGED
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6
6
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## 0.10.0 - 2025-09-09
9
+
10
+ ### Added
11
+
12
+ - Add Passenger server to auto register list [@mabrikan][] in [#28](https://github.com/yabeda-rb/yabeda-rails/pull/28)
13
+ - Allow defining default_tags only for rails group [@magec][] in [#30](https://github.com/yabeda-rb/yabeda-rails/pull/30)
14
+ - Ability to customize the bucket sizing for histograms [@skateman][] in [#32](https://github.com/yabeda-rb/yabeda-rails/pull/32)
15
+ - Ability to ignore certain controller#actions [@zzip][] in [#33](https://github.com/yabeda-rb/yabeda-rails/pull/33)
16
+
8
17
  ## 0.9.0 - 2023-08-03
9
18
 
10
19
  ### Added
@@ -96,3 +105,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
96
105
  [@lautis]: https://github.com/lautis "Ville Lautanala"
97
106
  [@dks17]: https://github.com/dks17 "Konstantin"
98
107
  [@lewispb]: https://github.com/lewispb "Lewis Buckley"
108
+ [@mabrikan]: https://github.com/mabrikan "Musaed Albrikan"
109
+ [@magec]: https://github.com/magec "Jose Fernández"
110
+ [@skateman]: https://github.com/skateman "Halász Dávid"
111
+ [@zzip]: https://github.com/zzip "Dale Hofkens"
data/Gemfile CHANGED
@@ -7,7 +7,7 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
7
7
  # Specify your gem's dependencies in yabeda-rails.gemspec
8
8
  gemspec
9
9
 
10
- rails_version = ENV.fetch("RAILS_VERSION", "~> 7.0")
10
+ rails_version = ENV.fetch("RAILS_VERSION", "~> 8.0")
11
11
  case rails_version
12
12
  when "HEAD"
13
13
  git "https://github.com/rails/rails.git" do
data/README.md CHANGED
@@ -76,6 +76,15 @@ end
76
76
  ```
77
77
  `append_info_to_payload` is a method from [ActionController::Instrumentation](https://api.rubyonrails.org/classes/ActionController/Instrumentation.html#method-i-append_info_to_payload)
78
78
 
79
+ ## Configuration
80
+
81
+ Configuration is handled by [anyway_config] gem. With it you can load settings from environment variables (upcased and prefixed with `YABEDA_RAILS_`), YAML files, and other sources. See [anyway_config] docs for details.
82
+
83
+ | Config key | Type | Default | Description |
84
+ | ---------------------- | ------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
85
+ | `apdex_target` | integer | nil | Tolerable time for Apdex in seconds, exposed as gauge if set. |
86
+ | `controller_name_case` | symbol | :snake | Defines whether controller name is reported in camel case (:camel) or snake case (:snake). |
87
+ | `ignore_actions` | array | [] | array of controller#action strings that should be ignored, controller should be in camel case, example `['HealthCheck::HealthCheckController#index']` |
79
88
 
80
89
  ## Development
81
90
 
@@ -9,7 +9,9 @@ module Yabeda
9
9
  config_name :yabeda_rails
10
10
 
11
11
  attr_config :apdex_target
12
+ attr_config :buckets
12
13
  attr_config controller_name_case: :snake
14
+ attr_config ignore_actions: []
13
15
  end
14
16
  end
15
17
  end
@@ -13,7 +13,7 @@ module Yabeda
13
13
  format: format,
14
14
  method: method,
15
15
  }
16
- labels.merge(payload.slice(*Yabeda.default_tags.keys - labels.keys))
16
+ labels.merge(payload.slice(*(Yabeda.default_tags.keys + Yabeda.rails.default_tags.keys) - labels.keys))
17
17
  end
18
18
  end
19
19
 
@@ -29,6 +29,10 @@ module Yabeda
29
29
  ms2s payload[:db_runtime]
30
30
  end
31
31
 
32
+ def controller_action
33
+ "#{payload[:controller]}##{payload[:action]}"
34
+ end
35
+
32
36
  private
33
37
 
34
38
  def controller
@@ -19,8 +19,12 @@ module Yabeda
19
19
  ::Rails.const_defined?("Unicorn::Launcher")
20
20
  end
21
21
 
22
+ def passenger_server?
23
+ ::Rails.const_defined?("PhusionPassenger")
24
+ end
25
+
22
26
  initializer "yabeda-rails.metrics" do
23
- ::Yabeda::Rails.install! if rails_server? || puma_server? || unicorn_server?
27
+ ::Yabeda::Rails.install! if rails_server? || puma_server? || unicorn_server? || passenger_server?
24
28
  end
25
29
  end
26
30
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Yabeda
4
4
  module Rails
5
- VERSION = "0.9.0"
5
+ VERSION = "0.10.0"
6
6
  end
7
7
  end
data/lib/yabeda/rails.rb CHANGED
@@ -29,6 +29,7 @@ module Yabeda
29
29
  def install!
30
30
  Yabeda.configure do
31
31
  config = ::Yabeda::Rails.config
32
+ buckets = config.buckets || LONG_RUNNING_REQUEST_BUCKETS
32
33
 
33
34
  group :rails
34
35
 
@@ -37,14 +38,14 @@ module Yabeda
37
38
 
38
39
  histogram :request_duration, tags: %i[controller action status format method],
39
40
  unit: :seconds,
40
- buckets: LONG_RUNNING_REQUEST_BUCKETS,
41
+ buckets: buckets,
41
42
  comment: "A histogram of the response latency."
42
43
 
43
- histogram :view_runtime, unit: :seconds, buckets: LONG_RUNNING_REQUEST_BUCKETS,
44
+ histogram :view_runtime, unit: :seconds, buckets: buckets,
44
45
  comment: "A histogram of the view rendering time.",
45
46
  tags: %i[controller action status format method]
46
47
 
47
- histogram :db_runtime, unit: :seconds, buckets: LONG_RUNNING_REQUEST_BUCKETS,
48
+ histogram :db_runtime, unit: :seconds, buckets: buckets,
48
49
  comment: "A histogram of the activerecord execution time.",
49
50
  tags: %i[controller action status format method]
50
51
 
@@ -57,6 +58,8 @@ module Yabeda
57
58
  ActiveSupport::Notifications.subscribe "process_action.action_controller" do |*args|
58
59
  event = Yabeda::Rails::Event.new(*args)
59
60
 
61
+ next if event.controller_action.in?(config.ignore_actions)
62
+
60
63
  rails_requests_total.increment(event.labels)
61
64
  rails_request_duration.measure(event.labels, event.duration)
62
65
  rails_view_runtime.measure(event.labels, event.view_runtime)
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yabeda-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Novikov
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2023-08-03 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: activesupport
@@ -121,8 +120,8 @@ executables: []
121
120
  extensions: []
122
121
  extra_rdoc_files: []
123
122
  files:
124
- - ".github/workflows/build-release.yml"
125
123
  - ".github/workflows/lint.yml"
124
+ - ".github/workflows/release.yml"
126
125
  - ".github/workflows/test.yml"
127
126
  - ".gitignore"
128
127
  - ".rspec"
@@ -145,7 +144,6 @@ homepage: https://github.com/yabeda-rb/yabeda-rails
145
144
  licenses:
146
145
  - MIT
147
146
  metadata: {}
148
- post_install_message:
149
147
  rdoc_options: []
150
148
  require_paths:
151
149
  - lib
@@ -160,8 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
158
  - !ruby/object:Gem::Version
161
159
  version: '0'
162
160
  requirements: []
163
- rubygems_version: 3.1.6
164
- signing_key:
161
+ rubygems_version: 3.6.9
165
162
  specification_version: 4
166
163
  summary: Extensible metrics for monitoring Ruby on Rails application
167
164
  test_files: []