alephant-publisher-request 0.2.3 → 0.2.4
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f411d0b50c156b922f9581591a1777a4a120de1
|
4
|
+
data.tar.gz: 23dd861bee5021240e7a072017e27981d21730be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0373c84e5b5d0f41f98f25f490bf22084e84ea92809dc3c65c0b8e30eeb4bd1e7140bdc332eed29863e1a4d5cd920d65500dcaad9e60fd3780663ed93f4657df
|
7
|
+
data.tar.gz: 1a7d98601e6ebffe3b1fbe63c33aa2ecb49891d4efd54c9f70aafc8b2e9c11d10bcdcb8dd4eff602bebc8adc5d3fe48f6ac41aee82f4b95f3b5cc609ea49b2e1
|
@@ -16,16 +16,16 @@ module Alephant
|
|
16
16
|
def get(uri)
|
17
17
|
JSON::parse(request(uri).body, :symbolize_names => true)
|
18
18
|
rescue Faraday::ConnectionFailed => e
|
19
|
-
log_error_with_metric(e, '
|
19
|
+
log_error_with_metric(e, 'Connection#request', uri, "PublisherRequestConnectionConnectionFailed")
|
20
20
|
raise ConnectionFailed
|
21
21
|
rescue InvalidApiStatus => e
|
22
|
-
log_error_with_metric(e, '
|
22
|
+
log_error_with_metric(e, 'Connection#request', uri, "PublisherRequestConnectionInvalidStatus#{e.status}")
|
23
23
|
raise e
|
24
24
|
rescue JSON::ParserError => e
|
25
|
-
log_error_with_metric(e, '
|
25
|
+
log_error_with_metric(e, 'Connection#get', uri, "PublisherRequestConnectionInvalidApiResponse")
|
26
26
|
raise InvalidApiResponse, "JSON parsing error: #{response.body}"
|
27
27
|
rescue StandardError => e
|
28
|
-
log_error_with_metric(e, '
|
28
|
+
log_error_with_metric(e, 'Connection#get', uri, "PublisherRequestConnectionApiError")
|
29
29
|
raise ApiError, e.message
|
30
30
|
end
|
31
31
|
|
@@ -33,13 +33,13 @@ module Alephant
|
|
33
33
|
|
34
34
|
def request(uri)
|
35
35
|
before = Time.new
|
36
|
-
logger.info "Publisher::Request::
|
36
|
+
logger.info "Publisher::Request::Connection#request: uri: #{uri}"
|
37
37
|
|
38
38
|
driver.get(uri).tap do |response|
|
39
39
|
response_time = Time.new - before
|
40
|
-
logger.metric(:name => "
|
41
|
-
logger.info "Publisher::Request::
|
42
|
-
logger.info "Publisher::Request::
|
40
|
+
logger.metric(:name => "PublisherRequestConnectionRequestHTTPTime", :unit => 'Seconds', :value => response_time)
|
41
|
+
logger.info "Publisher::Request::Connection#request: API response time: #{response_time}"
|
42
|
+
logger.info "Publisher::Request::Connection#request: status returned: #{response.status} for #{uri}"
|
43
43
|
raise InvalidApiStatus, response.status unless response.status == 200
|
44
44
|
end
|
45
45
|
end
|