rorvswild 1.6.0 → 1.6.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: b40a18c6bc14739968aabfda67d1ce3b68fbd582ef16b66bc35e636ab1cc4137
4
- data.tar.gz: d90c55f88561d249a723de427ce522e27133cbf2fed8c68639e029b0a7f2a6f1
3
+ metadata.gz: f0d7eae69ceb93804c2297b8fb97a400e09d183eeeb46ac879dc02873ba7f5b0
4
+ data.tar.gz: 0bfe3e2d48fcecd010eeb399ad896d6e4e519073aa6ae0fc160ebcb9e1cf554c
5
5
  SHA512:
6
- metadata.gz: 5ecb2843e5cf8d0556a4b412011d5facb3fdc9a936ab19836758acf3d0fb7de90ccccdad7cb4f599fc3fe9f1bbb39d112b3674a43aec1d1313d5264a643ea58a
7
- data.tar.gz: e4bcb64980a094b6a4743c24d35452fc86fe53f347286272129103a321ac34e15e4ebd3fbb6d7fba24f7a77cc7b920b6b9ce626328baf91a671cb9e3382b09e4
6
+ metadata.gz: 5bf001a094bfa234414b8247c18d57159b734f1a829ef62997cdf66b7265fdc40e9cdad0530ecac8bc108459b202930487f0cad30b610cc4ebd7b00326ef17af
7
+ data.tar.gz: 25ace108524d491befd74c9682c92f2a95e17c4ee4b8e11174143bb29425685074d81923f4cf981e0f0dc313ab7c493731206037d6036d2d74ff633411519ffd
data/README.md CHANGED
@@ -218,30 +218,71 @@ In the case you want a custom logger such as Syslog, you can only do it by initi
218
218
  RorVsWild.start(api_key: "API_KEY", logger: Logger::Syslog.new)
219
219
  ```
220
220
 
221
- #### Server metrics monitoring
221
+ ### Deployment tracking
222
222
 
223
- We are adding server metrics as a beta feature.
224
- It monitors load average, CPU, memory, swap and disk space.
225
- For now, only Linux is supported.
226
- It has to be explicitly enabled with a feature flag :
223
+ Since version 1.6.0, RorVsWild compares performances between each deployment.
224
+ That is convenient to detect quickly a performance deterioration.
225
+
226
+ It is working without any actions from your part if the application is :
227
+
228
+ - Deployed via Capistrano
229
+ - Inside a Git repositoriy
230
+ - Hosted on Heroku if [Dyno metadata](https://devcenter.heroku.com/articles/dyno-metadata) is enabled
231
+ - Hosted on Scalingo
232
+
233
+ Because we are not aware of all cloud hosting providers, there is a generic method to provide these data via the configuration :
227
234
 
228
235
  ```yaml
229
236
  # config/rorvswild.yml
230
237
  production:
231
238
  api_key: API_KEY
232
- features:
233
- - server_metrics
239
+ deployment:
240
+ revision: <%= "Anything that will return the deployment version" %> # Mandatory
241
+ description: <%= "Eventually if you have a description such as a Git message" %>
242
+ author: <%= "Author's name of the deployment" %>
243
+ email: <%= "emailOf@theAuthor.com" %>
234
244
  ```
235
245
 
236
246
  Here is the equivalent if you prefer initialising RorVsWild manually :
237
247
 
238
248
  ```ruby
239
249
  # config/initializers/rorvswild.rb
240
- RorVsWild.start(api_key: "API_KEY", features: ["server_metrics"])
250
+ RorVsWild.start(api_key: "API_KEY", deployment: {
251
+ revision: "Unique version number such as Git commit ID",
252
+ description: "Message such as in Git",
253
+ author: "Deployer's name",
254
+ email: "Deployer's email"
255
+ })
241
256
  ```
242
257
 
258
+ Only the revision is mandatory, but it's better if you are able to provide more information.
259
+
260
+
261
+ #### Server metrics monitoring
262
+
263
+ Since version 1.6.0 RorVsWild monitors server metrics such as load average, CPU, memory, swap and disk space.
264
+ For now, only Linux is supported.
243
265
  The data are available in a server tab beside requests and jobs.
244
266
 
267
+ Metrics are grouped by hostnames.
268
+ Cloud providers give random hostnames which change on every deployment.
269
+ You can manually define them:
270
+
271
+ ```yaml
272
+ # config/rorvswild.yml
273
+ production:
274
+ api_key: API_KEY
275
+ server:
276
+ name: <%= "Some code that return a relevant hostname" %>
277
+ ```
278
+
279
+ Here is the equivalent if you prefer initialising RorVsWild manually :
280
+
281
+ ```ruby
282
+ # config/initializers/rorvswild.rb
283
+ RorVsWild.start(api_key: "API_KEY", server: {name: "host.name"})
284
+ ```
285
+
245
286
  ## Contributing
246
287
 
247
288
  1. Fork it ( https://github.com/[my-github-username]/rorvswild/fork )
@@ -30,6 +30,8 @@ module RorVsWild
30
30
  @client = Client.new(@config)
31
31
  @queue = config[:queue] || Queue.new(client)
32
32
  @locator = RorVsWild::Locator.new
33
+ Host.load_config(config)
34
+ Deployment.load_config(config)
33
35
 
34
36
  RorVsWild.logger.debug("Start RorVsWild #{RorVsWild::VERSION}")
35
37
  setup_plugins
@@ -2,20 +2,30 @@
2
2
 
3
3
  module RorVsWild
4
4
  module Deployment
5
+ def self.load_config(config)
6
+ read
7
+ if hash = config[:deployment]
8
+ @description = hash[:description]
9
+ @revision = hash[:revision]
10
+ @author = hash[:author]
11
+ @email = hash[:email]
12
+ end
13
+ end
14
+
5
15
  def self.revision
6
- read_once && @revision
16
+ @revision
7
17
  end
8
18
 
9
19
  def self.description
10
- read_once && @description
20
+ @description
11
21
  end
12
22
 
13
23
  def self.author
14
- read_once && @author
24
+ @author
15
25
  end
16
26
 
17
27
  def self.email
18
- read_once && @email
28
+ @email
19
29
  end
20
30
 
21
31
  def self.ruby
@@ -38,11 +48,6 @@ module RorVsWild
38
48
  read_from_heroku || read_from_scalingo || read_from_git || read_from_capistrano
39
49
  end
40
50
 
41
- def self.read_once
42
- @already_read || read
43
- @already_read = true
44
- end
45
-
46
51
  private
47
52
 
48
53
  def self.read_from_heroku
@@ -2,6 +2,10 @@
2
2
 
3
3
  module RorVsWild
4
4
  module Host
5
+ def self.load_config(config)
6
+ @name = config.dig(:server, :name)
7
+ end
8
+
5
9
  def self.os
6
10
  @os_description ||= `uname -sr`.strip
7
11
  rescue Exception => ex
@@ -21,7 +25,7 @@ module RorVsWild
21
25
  end
22
26
 
23
27
  def self.name
24
- if gae_instance = ENV["GAE_INSTANCE"] || ENV["CLOUD_RUN_EXECUTION"]
28
+ @name ||= if gae_instance = ENV["GAE_INSTANCE"] || ENV["CLOUD_RUN_EXECUTION"]
25
29
  gae_instance
26
30
  elsif dyno = ENV["DYNO"] # Heroku
27
31
  dyno.start_with?("run.") ? "run.*" :
@@ -4,7 +4,7 @@ module RorVsWild
4
4
 
5
5
  def self.create_rails_config(api_key)
6
6
  if File.directory?("config")
7
- if !File.exists?(PATH)
7
+ if !File.exist?(PATH)
8
8
  File.write(PATH, template(api_key))
9
9
  puts "File #{PATH} has been created. Restart / deploy your app to start collecting data."
10
10
  else
@@ -19,26 +19,34 @@ module RorVsWild
19
19
  <<YAML
20
20
  production:
21
21
  api_key: #{api_key}
22
- # ignore_requests: # Do not monitor the following actions
23
- # - SecretController#index
24
- # ignore_jobs: # Do not monitor the following jobs
25
- # - SecretJob
26
- # ignore_exceptions: # Do not record the following exceptions
27
- # - ActionController::RoutingError # By default to ignore 404
28
- # ignore_plugins:
29
- # - ActionController
30
- # - ActionMailer
31
- # - ActionView
32
- # - ActiveJob
33
- # - ActiveRecord
34
- # - DelayedJob
35
- # - Elasticsearch
36
- # - Mongo
37
- # - NetHttp
38
- # - Redis
39
- # - Resque
40
- # - Sidekiq
41
- # logger: log/rorvswild.log # By default it uses Rails.logger or Logger.new(STDOUT)
22
+ # ignore_requests: # Do not monitor the following actions
23
+ # - SecretController#index
24
+ # ignore_jobs: # Do not monitor the following jobs
25
+ # - SecretJob
26
+ # ignore_exceptions: # Do not record the following exceptions
27
+ # - ActionController::RoutingError # By default to ignore 404
28
+ # ignore_plugins:
29
+ # - ActionController
30
+ # - ActionMailer
31
+ # - ActionView
32
+ # - ActiveJob
33
+ # - ActiveRecord
34
+ # - DelayedJob
35
+ # - Elasticsearch
36
+ # - Mongo
37
+ # - NetHttp
38
+ # - Redis
39
+ # - Resque
40
+ # - Sidekiq
41
+ # logger: log/rorvswild.log # By default it uses Rails.logger or Logger.new(STDOUT)
42
+ # # Deployment tracking is working without any actions from your part if the Rails app
43
+ # # is inside a Git repositoriy, is deployed via Capistrano.
44
+ # # In the other cases, you can provide the following details.
45
+ # deployment:
46
+ # revision: <%= "Anything that will return the deployment version" %> # Mandatory
47
+ # description: <%= "Eventually if you have a description such as a Git message" %>
48
+ # author: <%= "Author's name of the deployment" %>
49
+ # email: <%= "emailOf@theAuthor.com" %>
42
50
  YAML
43
51
  end
44
52
  end
@@ -1,3 +1,3 @@
1
1
  module RorVsWild
2
- VERSION = "1.6.0".freeze
2
+ VERSION = "1.6.1".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rorvswild
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexis Bernard
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-01-27 00:00:00.000000000 Z
12
+ date: 2023-02-07 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Performances and errors insights for rails developers.
15
15
  email: