yabeda-rails 0.2.0 → 0.7.1

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: 33b19f37d8fc8d0ee84bed04a0f13658901ab18ac5e1d1c9db5db5f8fdea981d
4
- data.tar.gz: 3a6007be6f1e141264d05a0966cb5e43db5f0849b382122b88758f6b64337fa6
3
+ metadata.gz: 7c4f9d9b4773c74b1ec6227a70b8799f817ce4d5e053b368e6136fb82a51df4f
4
+ data.tar.gz: 9353bc44438ce046037fb9a459fbd95395a56e01349fa3fba4c35deaac02a262
5
5
  SHA512:
6
- metadata.gz: ae3d4bb58b49bff48dc3d49638f26ee24b7371689e82918fb0a5666c4f82e109e74922973add0bfac6f6b78f4c6c5a4abf834b78b764461c014e13c55f902cff
7
- data.tar.gz: 99ada92e2f220c78e4051d92a1b3bd0fad9c39414c4a24d5959ce9c199e3e6aede953f18d2c9f6f3cb27ff2e98f169bea0bb356043e97e155b10091527bbd669
6
+ metadata.gz: be508869519495bf6ed889ab9fcd2285299d8d791e32d77835c0e3a073be5351055c24f831bca665a9683f76c9036969cb58021afe0ac530e1a1268309f6240f
7
+ data.tar.gz: cada1bfb298d4a29322375d16719c1d52c95944b42434260be1cca6a8b6d4c7db2bb73e95a9e49118188ba6f1a58d0701806be6e63b0de5aec350ece877f2ce8
@@ -1,5 +1,5 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.5.1
5
- before_install: gem install bundler -v 1.16.1
4
+ - 2.7.1
5
+ before_install: gem install bundler -v 2.0
@@ -5,6 +5,36 @@ 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.7.1 - 2020-10-02
9
+
10
+ ### Changed
11
+
12
+ - Explicitly require previously removed railtie to fix case when it doesn't get required in `yabeda` gem (if `yabeda` is required before `rails`). See [yabeda-rb/yabeda#15](https://github.com/yabeda-rb/yabeda/issues/15). @Envek
13
+
14
+ ## 0.7.0 - 2020-08-21
15
+
16
+ ### Removed
17
+
18
+ - Railtie to configure Yabeda – it is moved into Yabeda itself. Increase required Yabeda version to keep behavior for users who require only `yabeda-rails` in their Gemfiles. @Envek
19
+
20
+ ## 0.6.0 - 2020-08-06
21
+
22
+ ### Added
23
+
24
+ - Ability to add default/custom tags to metrics from controllers. @raivil in [#13](https://github.com/yabeda-rb/yabeda-rails/pull/13)
25
+
26
+ ## 0.5.0 - 2020-03-27
27
+
28
+ ### Added
29
+
30
+ - Support for Unicorn application server. @vast in [#9](https://github.com/yabeda-rb/yabeda-rails/pull/9)
31
+
32
+ ## 0.4.0 - 2020-01-28
33
+
34
+ ### Changed
35
+
36
+ - Configure Yabeda after application initialization as since 0.4.0 Yabeda requires to call configuration logic explicitly. @Envek
37
+
8
38
  ## 0.2.0 - 2020-01-14
9
39
 
10
40
  ### Changed
data/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # Yabeda::[Rails]
2
2
 
3
- Built-in metrics for out-of-the box [Rails] applications monitoring
3
+ Built-in metrics for out-of-the box [Rails] applications monitoring.
4
4
 
5
- if your monitoring system already collects Rails metrics (e.g. NewRelic) then you don't need this gem.
5
+ If your monitoring system already collects Rails metrics (e.g. NewRelic) then most probably you don't need this gem.
6
+
7
+ Sample Grafana dashboard ID: [11668](https://grafana.com/grafana/dashboards/11668)
6
8
 
7
9
  ## Installation
8
10
 
@@ -20,7 +22,7 @@ And then execute:
20
22
 
21
23
  ### Registering metrics on server process start
22
24
 
23
- Currently, yabeda-rails automatically registers rails metrics when a server is started via `rails server` or `puma -C config/puma.rb`. However, other application servers or launching via `rackup` aren't supported at the moment.
25
+ Currently, yabeda-rails automatically registers rails metrics when a server is started via `rails server`, `puma -C config/puma.rb` or `unicorn -c`. However, other application servers or launching via `rackup` aren't supported at the moment.
24
26
 
25
27
  A possible workaround is to detect server process and manually activate yabeda-rails in an initializer:
26
28
 
@@ -32,7 +34,7 @@ if your_app_server_process? # Your logic here
32
34
  end
33
35
  ```
34
36
 
35
- You always can add support for your app server to [lib/yabeda/rails/railtie.rb](). Pull Requests are always welcome!
37
+ You always can add support for your app server to [lib/yabeda/rails/railtie.rb](lib/yabeda/rails/railtie.rb). Pull Requests are always welcome!
36
38
 
37
39
 
38
40
  ## Metrics
@@ -55,6 +57,26 @@ You always can add support for your app server to [lib/yabeda/rails/railtie.rb](
55
57
  end
56
58
  ```
57
59
 
60
+ ## Custom tags
61
+
62
+ You can add additional tags to the existing metrics by adding custom payload to your controller.
63
+
64
+ ```ruby
65
+ # This block is optional but some adapters (like Prometheus) requires that all tags should be declared in advance
66
+ Yabeda.configure do
67
+ default_tag :importance, nil
68
+ end
69
+
70
+ class ApplicationController < ActionController::Base
71
+ def append_info_to_payload(payload)
72
+ super
73
+ payload[:importance] = extract_importance(params)
74
+ end
75
+ end
76
+ ```
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
+
79
+
58
80
  ## Development
59
81
 
60
82
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -47,7 +47,7 @@ module Yabeda
47
47
  status: event.payload[:status],
48
48
  format: event.payload[:format],
49
49
  method: event.payload[:method].downcase,
50
- }
50
+ }.merge!(event.payload.slice(*Yabeda.default_tags.keys))
51
51
 
52
52
  rails_requests_total.increment(labels)
53
53
  rails_request_duration.measure(labels, Yabeda::Rails.ms2s(event.duration))
@@ -1,5 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # Explicitly require yabeda's railtie in case if its require was skipped there.
4
+ # See https://github.com/yabeda-rb/yabeda/issues/15
5
+ require "yabeda/railtie"
6
+
3
7
  module Yabeda
4
8
  module Rails
5
9
  class Railtie < ::Rails::Railtie # :nodoc:
@@ -11,10 +15,12 @@ module Yabeda
11
15
  ::Rails.const_defined?('Puma::CLI')
12
16
  end
13
17
 
14
- config.after_initialize do
15
- next unless rails_server? || puma_server?
18
+ def unicorn_server?
19
+ ::Rails.const_defined?("Unicorn::Launcher")
20
+ end
16
21
 
17
- ::Yabeda::Rails.install!
22
+ initializer "yabeda-rails.metrics" do
23
+ ::Yabeda::Rails.install! if rails_server? || puma_server? || unicorn_server?
18
24
  end
19
25
  end
20
26
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Yabeda
4
4
  module Rails
5
- VERSION = "0.2.0"
5
+ VERSION = "0.7.1"
6
6
  end
7
7
  end
@@ -22,10 +22,10 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ["lib"]
24
24
 
25
- spec.add_dependency "yabeda", "~> 0.2"
25
+ spec.add_dependency "yabeda", "~> 0.8"
26
26
  spec.add_dependency "rails"
27
27
 
28
- spec.add_development_dependency "bundler", "~> 1.16"
29
- spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "bundler", "~> 2.0"
29
+ spec.add_development_dependency "rake", "~> 13.0"
30
30
  spec.add_development_dependency "rspec", "~> 3.0"
31
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yabeda-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Novikov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-14 00:00:00.000000000 Z
11
+ date: 2020-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yabeda
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.2'
19
+ version: '0.8'
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: '0.2'
26
+ version: '0.8'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,28 +44,28 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.16'
47
+ version: '2.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.16'
54
+ version: '2.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: '13.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: '13.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0'
123
123
  requirements: []
124
- rubygems_version: 3.0.3
124
+ rubygems_version: 3.1.2
125
125
  signing_key:
126
126
  specification_version: 4
127
127
  summary: Extensible metrics for monitoring Ruby on Rails application