lhc 9.3.1 → 9.4.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 +5 -5
- data/docs/interceptors/monitoring.md +8 -0
- data/lib/lhc/interceptors/monitoring.rb +2 -2
- data/lib/lhc/version.rb +1 -1
- data/spec/interceptors/monitoring/main_spec.rb +15 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2716d5e639b506ed4d3b10782a61a8c326463b5941e1b33ba9c5759ea51e9566
|
4
|
+
data.tar.gz: 535d64143094e6b005ae9f0c161fb9d046c610778d3204d4024c4cf3b4d54451
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
@@ -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.
|
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-
|
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
|
377
|
+
rubygems_version: 2.7.6
|
378
378
|
signing_key:
|
379
379
|
specification_version: 4
|
380
380
|
summary: LocalHttpClient
|