lhc 9.3.1 → 9.4.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: c3f92e8dd5634d8c872c163c93cab915fec1e1db
4
- data.tar.gz: 5e063d4778bb14549190bd34f2912a2d52b029e0
2
+ SHA256:
3
+ metadata.gz: 2716d5e639b506ed4d3b10782a61a8c326463b5941e1b33ba9c5759ea51e9566
4
+ data.tar.gz: 535d64143094e6b005ae9f0c161fb9d046c610778d3204d4024c4cf3b4d54451
5
5
  SHA512:
6
- metadata.gz: 8eeb31b81d5bf54d4fec86f620669bb7c3c4440faeeadcc583eea3264e059d517adbeac66828b169db44affaeb288d4b4eae8859df7d1254988a8efbe1526706
7
- data.tar.gz: c67c6a0a53dcbf1b0d13c6c664946826564f29d067ef11ed574bd23f7ecaaf182fd5777c59f8503909a02767933c71ffe1e4dd6e805968608306ba2fc2dc9376
6
+ metadata.gz: c0471c962b62778ba637ae90ef90671c88510c6f4c9ad5e10024dae82f00266edb1d88fdd10395c6e8bd6dbca2da98c2717ccff09a79d0db05afa09eef6307f5
7
+ data.tar.gz: c2ef427484136c827a507d30964c0db9b32174286324db1ba13a6b3c4d180b09b496ea720c9da092c8ecfce2e71dd6dd774b351078957482d3267caae7889a39
@@ -14,6 +14,14 @@ You also have to configure statsd in order to have the monitoring interceptor re
14
14
  LHC::Monitoring.statsd = <your-instance-of-statsd>
15
15
  ```
16
16
 
17
+ ### Environment
18
+
19
+ By default, the monitoring interceptor uses Rails.env to determine the environment. In case you want to configure that, use:
20
+
21
+ ```ruby
22
+ LHC::Monitoring.env = ENV['DEPLOYMENT_TYPE'] || Rails.env
23
+ ```
24
+
17
25
  ## What it tracks
18
26
 
19
27
  It tracks request attempts with `before_request` and `after_request` (counts).
@@ -7,7 +7,7 @@ class LHC::Monitoring < LHC::Interceptor
7
7
 
8
8
  include ActiveSupport::Configurable
9
9
 
10
- config_accessor :statsd
10
+ config_accessor :statsd, :env
11
11
 
12
12
  def before_request
13
13
  return unless statsd
@@ -39,7 +39,7 @@ class LHC::Monitoring < LHC::Interceptor
39
39
  key = [
40
40
  'lhc',
41
41
  Rails.application.class.parent_name.underscore,
42
- Rails.env,
42
+ LHC::Monitoring.env || Rails.env,
43
43
  URI.parse(url).host.gsub(/\./, '_'),
44
44
  request.method
45
45
  ]
data/lib/lhc/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module LHC
2
- VERSION ||= '9.3.1'
2
+ VERSION ||= '9.4.0'
3
3
  end
@@ -77,4 +77,19 @@ describe LHC::Monitoring do
77
77
  LHC.get(:local)
78
78
  end
79
79
  end
80
+
81
+ context 'with configured environment' do
82
+ before do
83
+ LHC::Monitoring.env = 'beta'
84
+ end
85
+
86
+ it 'uses the configured env' do
87
+ stub
88
+ expect(Statsd).to receive(:count).with('lhc.dummy.beta.local_ch.get.before_request', 1)
89
+ expect(Statsd).to receive(:count).with('lhc.dummy.beta.local_ch.get.after_request', 1)
90
+ expect(Statsd).to receive(:count).with('lhc.dummy.beta.local_ch.get.count', 1)
91
+ expect(Statsd).to receive(:count).with('lhc.dummy.beta.local_ch.get.200', 1)
92
+ LHC.get(:local)
93
+ end
94
+ end
80
95
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lhc
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.3.1
4
+ version: 9.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - https://github.com/local-ch/lhc/contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-19 00:00:00.000000000 Z
11
+ date: 2018-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -374,7 +374,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
374
374
  requirements:
375
375
  - Ruby >= 2.0.0
376
376
  rubyforge_project:
377
- rubygems_version: 2.6.14
377
+ rubygems_version: 2.7.6
378
378
  signing_key:
379
379
  specification_version: 4
380
380
  summary: LocalHttpClient