yabeda-rails 0.7.2 → 0.8.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: e5a74f3febe6bcdda7d43527a9b9acb71434e58f2abc5518b2a68c609541bf89
4
- data.tar.gz: f223f9a5df2d1a224e77cec0a9e09357eaeccf0532f5a6c4b8859c82ed4ab909
3
+ metadata.gz: 107b2a512068172c19c08b18dc0f452d9ee1794c4894979b1a88c459a8dcf5c5
4
+ data.tar.gz: 686e32000199bc29bb8096d09aa336b4cf67d9cfe789e44b91653467caee5524
5
5
  SHA512:
6
- metadata.gz: 8d2cf3ed506addf2aabcd6bebeaf77fdc80d29ea091a2f8f4d9ef550e3bc74e33a9a4faad6e82ec3ea7f280311a80860f985a6f971fcaa1847b86e7d5907bc95
7
- data.tar.gz: de1ebbcfbfc3e9423a9033b1080426dd0466e665a9485dd13bc5df4bc60b982c049f156ec8499b38cbca3e26a0ffec2dba571b7f252ee7e7daf299e1ff81070c
6
+ metadata.gz: f59dd373f43b40e47b03cecef02ad47ce8fdcf49661430fddf003007f60d69895a26e538d23bd829e664aaa27145789f2a934ed401d6c593ca314ff3271d65d2
7
+ data.tar.gz: 6de6d25b29ef13f07f9a1e008999577c18891ceaede127a99ac541235442ed72f3b74316e6f7b16950169fd5309e6d1fcc86cf2b4999106ff08a46349db27e0b
@@ -0,0 +1,25 @@
1
+ name: Lint
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - '**'
8
+ tags-ignore:
9
+ - 'v*'
10
+
11
+ jobs:
12
+ rubocop:
13
+ # Skip running tests for local pull requests (use push event instead), run only for foreign ones
14
+ if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login != github.event.pull_request.base.repo.owner.login
15
+ name: RuboCop
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@v2
19
+ - uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: "3.1"
22
+ bundler-cache: true
23
+ - name: Lint Ruby code with RuboCop
24
+ run: |
25
+ bundle exec rubocop
@@ -1,4 +1,4 @@
1
- name: Run tests
1
+ name: Tests
2
2
 
3
3
  on:
4
4
  pull_request:
@@ -10,21 +10,29 @@ on:
10
10
 
11
11
  jobs:
12
12
  test:
13
- name: "Run tests"
14
- if: "! contains(toJSON(github.event.commits.latest.message), '[ci skip]')"
13
+ name: 'Rails ${{ matrix.rails }} × Ruby ${{ matrix.ruby }}'
14
+ # Skip running tests for local pull requests (use push event instead), run only for foreign ones
15
+ if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login != github.event.pull_request.base.repo.owner.login
15
16
  runs-on: ubuntu-latest
16
17
  strategy:
17
18
  fail-fast: false
18
19
  matrix:
19
20
  include:
20
- - ruby: 3.0
21
- - ruby: 2.7
22
- - ruby: 2.6
23
- - ruby: 2.5
21
+ - ruby: "3.1"
22
+ rails: "HEAD"
23
+ - ruby: "3.0"
24
+ rails: "7.0"
25
+ - ruby: "2.7"
26
+ rails: "6.1"
27
+ - ruby: "2.6"
28
+ rails: "6.0"
29
+ - ruby: "2.5"
30
+ rails: "5.2"
24
31
  container:
25
32
  image: ruby:${{ matrix.ruby }}
26
33
  env:
27
34
  CI: true
35
+ RAILS_VERSION: ${{ matrix.rails }}
28
36
  steps:
29
37
  - uses: actions/checkout@v2
30
38
  - uses: actions/cache@v2
@@ -41,7 +49,5 @@ jobs:
41
49
  bundle config path vendor/bundle
42
50
  bundle install
43
51
  bundle update
44
- - name: Run Rubocop
45
- run: bundle exec rubocop
46
52
  - name: Run RSpec
47
53
  run: bundle exec rspec
data/.rubocop.yml CHANGED
@@ -41,3 +41,5 @@ Style/TrailingCommaInHashLiteral:
41
41
  Enabled: true
42
42
  EnforcedStyleForMultiline: consistent_comma
43
43
 
44
+ Bundler/DuplicatedGem:
45
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ 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.8.0 - 2022-05-30
9
+
10
+ ### Added
11
+
12
+ - Add ability to expose custom Apdex target value for later use in graphs/alerts. [@Envek][] in [#18](https://github.com/yabeda-rb/yabeda-rails/pull/18)
13
+
14
+ ### Changed
15
+
16
+ - Reduce number of dependencies by depending only on railties instead of the whole Ruby on Rails. [@lautis][] in [#23](https://github.com/yabeda-rb/yabeda-rails/pull/23).
17
+
8
18
  ## 0.7.2 - 2021-03-15
9
19
 
10
20
  ### Fixed
@@ -65,4 +75,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
65
75
 
66
76
  Basic metrics for request durations by controller, action, status, format, and method. ActiveRecord and ActionView timings.
67
77
 
78
+ [@Envek]: https://github.com/Envek "Andrey Novikov"
68
79
  [@liaden]: https://github.com/liaden "Joel Johnson"
80
+ [@lautis]: https://github.com/lautis "Ville Lautanala"
data/Gemfile CHANGED
@@ -7,9 +7,26 @@ 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")
11
+ case rails_version
12
+ when "HEAD"
13
+ git "https://github.com/rails/rails.git" do
14
+ gem "rails"
15
+ gem "activesupport"
16
+ gem "railties"
17
+ end
18
+ else
19
+ rails_version = "~> #{rails_version}.0" if rails_version.match?(/^\d+\.\d+$/)
20
+ gem "rails", rails_version
21
+ gem "activesupport", rails_version
22
+ gem "railties", rails_version
23
+ end
24
+
10
25
  group :development, :test do
11
- gem "pry"
12
- gem "pry-byebug", platform: :mri
26
+ gem "yabeda", "~> 0.11" # Test helpers
27
+ gem "rspec-rails"
28
+
29
+ gem "debug"
13
30
 
14
31
  gem "rubocop", "~> 1.8"
15
32
  gem "rubocop-rspec"
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Yabeda::[Rails]
1
+ # ![Yabeda::Rails](./yabeda-rails-logo.png)
2
2
 
3
3
  Built-in metrics for out-of-the box [Rails] applications monitoring.
4
4
 
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "anyway"
4
+
5
+ module Yabeda
6
+ module Rails
7
+ class Config < ::Anyway::Config
8
+ config_name :yabeda_rails
9
+
10
+ attr_config :apdex_target
11
+ end
12
+ end
13
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Yabeda
4
4
  module Rails
5
- VERSION = "0.7.2"
5
+ VERSION = "0.8.0"
6
6
  end
7
7
  end
data/lib/yabeda/rails.rb CHANGED
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "yabeda"
4
- require "rails"
4
+ require "active_support"
5
+ require "rails/railtie"
5
6
  require "yabeda/rails/railtie"
7
+ require "yabeda/rails/config"
6
8
 
7
9
  module Yabeda
8
10
  # Minimal set of Rails-specific metrics for using with Yabeda
@@ -25,6 +27,8 @@ module Yabeda
25
27
  # rubocop: disable Metrics/MethodLength, Metrics/BlockLength, Metrics/AbcSize
26
28
  def install!
27
29
  Yabeda.configure do
30
+ config = Config.new
31
+
28
32
  group :rails
29
33
 
30
34
  counter :requests_total, comment: "A counter of the total number of HTTP requests rails processed.",
@@ -43,6 +47,12 @@ module Yabeda
43
47
  comment: "A histogram of the activerecord execution time.",
44
48
  tags: %i[controller action status format method]
45
49
 
50
+ if config.apdex_target
51
+ gauge :apdex_target, unit: :seconds,
52
+ comment: "Tolerable time for Apdex (T value: maximum duration of satisfactory request)"
53
+ collect { rails_apdex_target.set({}, config.apdex_target) }
54
+ end
55
+
46
56
  ActiveSupport::Notifications.subscribe "process_action.action_controller" do |*args|
47
57
  event = ActiveSupport::Notifications::Event.new(*args)
48
58
  labels = {
Binary file
data/yabeda-rails.gemspec CHANGED
@@ -24,7 +24,9 @@ Gem::Specification.new do |spec|
24
24
 
25
25
  spec.required_ruby_version = ">= 2.4"
26
26
 
27
- spec.add_dependency "rails"
27
+ spec.add_dependency "activesupport"
28
+ spec.add_dependency "anyway_config", ">= 1.3", "< 3"
29
+ spec.add_dependency "railties"
28
30
  spec.add_dependency "yabeda", "~> 0.8"
29
31
 
30
32
  spec.add_development_dependency "bundler", "~> 2.0"
metadata CHANGED
@@ -1,17 +1,51 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yabeda-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Novikov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-15 00:00:00.000000000 Z
11
+ date: 2022-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rails
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: anyway_config
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '3'
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '1.3'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '3'
47
+ - !ruby/object:Gem::Dependency
48
+ name: railties
15
49
  requirement: !ruby/object:Gem::Requirement
16
50
  requirements:
17
51
  - - ">="
@@ -88,6 +122,7 @@ extensions: []
88
122
  extra_rdoc_files: []
89
123
  files:
90
124
  - ".github/workflows/build-release.yml"
125
+ - ".github/workflows/lint.yml"
91
126
  - ".github/workflows/test.yml"
92
127
  - ".gitignore"
93
128
  - ".rspec"
@@ -100,8 +135,10 @@ files:
100
135
  - bin/console
101
136
  - bin/setup
102
137
  - lib/yabeda/rails.rb
138
+ - lib/yabeda/rails/config.rb
103
139
  - lib/yabeda/rails/railtie.rb
104
140
  - lib/yabeda/rails/version.rb
141
+ - yabeda-rails-logo.png
105
142
  - yabeda-rails.gemspec
106
143
  homepage: https://github.com/yabeda-rb/yabeda-rails
107
144
  licenses:
@@ -122,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
159
  - !ruby/object:Gem::Version
123
160
  version: '0'
124
161
  requirements: []
125
- rubygems_version: 3.1.4
162
+ rubygems_version: 3.1.6
126
163
  signing_key:
127
164
  specification_version: 4
128
165
  summary: Extensible metrics for monitoring Ruby on Rails application