roo_on_rails 1.19.0 → 1.20.0

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
- SHA1:
3
- metadata.gz: 70e6ae53825362d05a01b32b115700151a67c521
4
- data.tar.gz: 62533bd3d864845ac6d12ba9ffd0542f97c1190b
2
+ SHA256:
3
+ metadata.gz: b4613e4f2d71a1b6105071d8a1c283f97d89e0bb740165bc87088c26b403881b
4
+ data.tar.gz: c13b32bd6d0bbe8fc47858352becf81ac684ba7f7f082e33145c54284a6f9b5c
5
5
  SHA512:
6
- metadata.gz: 64657f21e77a5fc055491a7e82f7b3d8ee13018a515a5ff94089a57551d0d8571049069ba27b2528aca5894efa0c3d185f6a54d03eb5d2411379ccd425ae669a
7
- data.tar.gz: 62550c09f3256819deb5208581e557a51cd7d9526227a2cd7eb71211254e5d02028d9a7eacaa668693c35f2f0d82fa564ef40f3dfeed98d403e517ecc8bfab0e
6
+ metadata.gz: 05dad7f1435d8d051d80df90b54dce24c447a468dbcb35090ddac4f962c1026d0059b1364f8a9219834e4e4f2c5b4cf5e3054a63061a950e3f433c44dfedb772
7
+ data.tar.gz: 2f9304451d8320f02e59d80febff8a1f3065dc688f4f56d99ed502588004338341855b8aa5218eb82e2cc75ab4506d4578454ff00e8dc1345e5e47074208e9f7
data/CHANGELOG.md CHANGED
@@ -1,16 +1,22 @@
1
- # HEAD
1
+ # v1.20.0 (2018-03-27)
2
2
 
3
- _A description of your awesome changes here!_
3
+ Features:
4
4
 
5
- # v1.19.0 (2018-01-23)
5
+ - Add Hopper compatibility for DataDog integration (#90)
6
6
 
7
7
  Bug fix:
8
8
 
9
- - Avoid New Relic initialization warning by following Rails initializer behaviour
9
+ - Set log level when instantiating logger; this avoids always outputting an initial "debug" line (#89)
10
+
11
+ # v1.19.0 (2018-01-23)
12
+
13
+ Bug fixes:
14
+
15
+ - Avoid New Relic initialization warning by following Rails initializer behaviour (#88)
10
16
 
11
17
  Features:
12
18
 
13
- - Allow disabling New Relic synchronous startup by setting `NEW_RELIC_SYNC_STARTUP=false`
19
+ - Allow disabling New Relic synchronous startup by setting `NEW_RELIC_SYNC_STARTUP=false` (#88)
14
20
 
15
21
  # v1.18.0 (2018-01-11)
16
22
 
@@ -27,14 +33,14 @@ Features:
27
33
 
28
34
  # v1.16.2 (2017-12-15)
29
35
 
30
- Bug fix:
36
+ Bug fixes:
31
37
 
32
38
  - It's possible to set an invalid log level and crash on boot (#84)
33
39
  - Do not disable ActiveRecord connection reaping by default; set default behaviour to Rails' default behaviour. (#85)
34
40
 
35
41
  # v1.16.1 (2017-11-20)
36
42
 
37
- Bug fix:
43
+ Bug fixes:
38
44
 
39
45
  - Auto-load roo identity if configured, prevent failing in CI (#83)
40
46
 
@@ -44,7 +50,7 @@ Features:
44
50
 
45
51
  - Allow SSL enforcement to be disabled via `ROO_ON_RAILS_DISABLE_SSL_ENFORCEMENT` environment variable (#82)
46
52
 
47
- Bug fix:
53
+ Bug fixes:
48
54
 
49
55
  - Ensure we can distinguish between environments' identity services (#81)
50
56
 
@@ -63,7 +69,7 @@ Bug Fix:
63
69
 
64
70
  # v1.13.1 (2017-10-18)
65
71
 
66
- Bug fix:
72
+ Bug fixes:
67
73
 
68
74
  - Fixes issue when `service_name` is null in `require_api_key` (#74)
69
75
 
@@ -74,7 +80,7 @@ Features:
74
80
  - Provide `ROUTEMASTER_VERIFY_SSL` environment variable to disable
75
81
  routemaster-client's SSL verification. (#68)
76
82
 
77
- Bug fix:
83
+ Bug fixes:
78
84
 
79
85
  - Fixes issue with `fix` command of the service setup scripts for papertrail (#66)
80
86
  - Fixes issue with API authentication concern where service name was incorrect (#71)
data/README.md CHANGED
@@ -278,31 +278,29 @@ This is automatically configured when running `roo_on_rails harness`.
278
278
 
279
279
  #### Custom application metrics
280
280
 
281
- Sending custom metrics to Datadog through Statsd requires an agent running in
282
- each dyno.
283
- You need to add the buildpack
284
- [`heroku-buildpack-datadog`](https://github.com/deliveroo/heroku-buildpack-datadog).
281
+ Sending custom metrics to Datadog through Statsd requires an agent running in each dyno or container. For Heroku you need to add the buildpack [`heroku-buildpack-datadog`](https://github.com/deliveroo/heroku-buildpack-datadog).
285
282
 
286
283
  Once this is done, you can send metrics with e.g.:
287
284
 
288
285
  ```ruby
289
- RooOnRails.statsd.increment('my.metric', tags: 'tag:value')
286
+ RooOnRails.statsd.increment('my.metric', tags: ['tag:value'])
290
287
  ```
291
288
 
292
- Tags `env:{name}`, `source:{dyno}`, and `app:{name}` will automatically be added
293
- to all your metrics.
294
-
295
- The following environment variables are being used. The default values are fine
296
- except for `STATSD_ENV` which should be set.
297
-
298
- - `STATSD_ENV`
299
- - `STATSD_HOST`
300
- - `STATSD_PORT`
301
-
302
- These extra required variables are automatically set by Heroku:
303
-
304
- - `DYNO`
305
- - `HEROKU_APP_NAME`
289
+ The following tags will automatically be added to all your metrics and their value depends on the environment variables listed below, in order of priority:
290
+
291
+ * `env:{name}`
292
+ * `STATDS_ENV` optional and to be set manually (e.g. `staging`);
293
+ * `HOPPER_ECS_CLUSTER_NAME` automatically set by Hopper (e.g. `staging`);
294
+ * Defaults to `unknown`.
295
+ * `source:{name}`
296
+ * `DYNO` – automatically set by Heroku (e.g. `web.3`);
297
+ * `HOSTNAME` – automatically set by Hopper (e.g. `876c57c17207`);
298
+ * Defaults to `unknown`.
299
+ * `app:{name}`
300
+ * `STATSD_APP_NAME` – optional and to be set manually (e.g. `notifications-staging`);
301
+ * `HEROKU_APP_NAME` – automatically set by Heroku (e.g. `roo-notifications-staging`);
302
+ * `HOPPER_APP_NAME`+`HOPPER_ECS_CLUSTER_NAME` – automatically set by Hopper (e.g. `notifications-staging`);
303
+ * Defaults to `unknown`.
306
304
 
307
305
  ### Routemaster Client
308
306
 
@@ -4,16 +4,19 @@ module RooOnRails
4
4
  initializer 'roo_on_rails.logging.before', before: :initialize_logger do
5
5
  require 'roo_on_rails/logger'
6
6
  Rails.logger = config.logger = RooOnRails::Logger.new
7
- Rails.logger.debug 'initializer roo_on_rails.logging.before'
8
- end
9
-
10
- initializer 'roo_on_rails.logging.after', after: :initialize_logger do
11
7
  # It is not possible to set log_level to an invalid value without some
12
8
  # deliberate gymnastics (the setter will raise an error), and Rails
13
9
  # defaults this to `debug`, so we don't need to guard against nil /
14
10
  # invalidity
15
11
  log_level = Rails.configuration.log_level
16
12
 
13
+ Rails.logger.set_log_level(default: log_level)
14
+ Rails.logger.debug 'initializer roo_on_rails.logging.before'
15
+ end
16
+
17
+ initializer 'roo_on_rails.logging.after', after: :initialize_logger do
18
+ log_level = Rails.configuration.log_level
19
+
17
20
  Rails.logger.set_log_level(default: log_level)
18
21
  Rails.logger.debug 'initializer roo_on_rails.logging.after'
19
22
  end
@@ -23,11 +23,30 @@ module RooOnRails
23
23
 
24
24
  def tags
25
25
  [
26
- "env:#{ENV.fetch('STATSD_ENV', 'unknown')}",
27
- "source:#{ENV.fetch('DYNO', 'unknown')}",
28
- "app:#{ENV.fetch('HEROKU_APP_NAME', 'unknown')}"
26
+ "env:#{env_name}",
27
+ "source:#{source_name}",
28
+ "app:#{app_name}"
29
29
  ]
30
30
  end
31
+
32
+ def env_name
33
+ ENV['STATSD_ENV'] || ENV['HOPPER_ECS_CLUSTER_NAME'] || 'unknown'
34
+ end
35
+
36
+ def source_name
37
+ ENV['DYNO'] || ENV['HOSTNAME'] || 'unknown'
38
+ end
39
+
40
+ def app_name
41
+ ENV['STATSD_APP_NAME'] || ENV['HEROKU_APP_NAME'] || hopper_app_name || 'unknown'
42
+ end
43
+
44
+ def hopper_app_name
45
+ app_name = ENV['HOPPER_APP_NAME']
46
+ cluster_name = ENV['HOPPER_ECS_CLUSTER_NAME']
47
+ return unless app_name && cluster_name
48
+ [app_name, cluster_name].join('-')
49
+ end
31
50
  end
32
51
 
33
52
  def self.statsd
@@ -1,3 +1,3 @@
1
1
  module RooOnRails
2
- VERSION = '1.19.0'.freeze
2
+ VERSION = '1.20.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roo_on_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.19.0
4
+ version: 1.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien Letessier
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-23 00:00:00.000000000 Z
11
+ date: 2018-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv-rails
@@ -501,7 +501,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
501
501
  version: '0'
502
502
  requirements: []
503
503
  rubyforge_project:
504
- rubygems_version: 2.6.11
504
+ rubygems_version: 2.7.6
505
505
  signing_key:
506
506
  specification_version: 4
507
507
  summary: Scaffolding for building services