libhoney 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/libhoney/transmission.rb +37 -22
- data/lib/libhoney/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3090756dce154f139d8a4c5598ba7a64be9c95e6
|
4
|
+
data.tar.gz: 6ad36413896edd22a0175026cd5519d27c4389a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c76eb3a559bb39e98f86e99369314a649012e651d2e0b576726089ce16646107a24b56504823c62948dfe2b60d6792aad24ab784a966b8a4d65f109c52ae4571
|
7
|
+
data.tar.gz: 23940a295a83f270a249d9a7d6278fbccd71f9998dd59abf1151f33956794fe3fe4c417ce24cbef7c450930c9bda4e24364664cb3a6205e2bf892369de591a64
|
@@ -50,30 +50,21 @@ module Libhoney
|
|
50
50
|
|
51
51
|
before = Time.now
|
52
52
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
}
|
67
|
-
req.body = e.data
|
53
|
+
begin
|
54
|
+
resp = do_send(e)
|
55
|
+
|
56
|
+
response = Response.new(:status_code => resp.status)
|
57
|
+
rescue Exception => error
|
58
|
+
# catch a broader swath of exceptions than is usually good practice,
|
59
|
+
# because this is effectively the top-level exception handler for the
|
60
|
+
# sender threads, and we don't want those threads to die (leaving
|
61
|
+
# nothing consuming the queue).
|
62
|
+
response = Response.new(:error => error)
|
63
|
+
ensure
|
64
|
+
response.duration = Time.now - before
|
65
|
+
response.metadata = e.metadata
|
68
66
|
end
|
69
67
|
|
70
|
-
# TODO handle faraday errors
|
71
|
-
|
72
|
-
after = Time.now
|
73
|
-
|
74
|
-
response = Response.new(:duration => after - before,
|
75
|
-
:status_code => resp.status,
|
76
|
-
:metadata => e.metadata)
|
77
68
|
begin
|
78
69
|
@responses.enq(response, !@block_on_responses)
|
79
70
|
rescue ThreadError
|
@@ -98,5 +89,29 @@ module Libhoney
|
|
98
89
|
|
99
90
|
0
|
100
91
|
end
|
92
|
+
|
93
|
+
private
|
94
|
+
def do_send(event)
|
95
|
+
conn = Faraday.new(:url => event.api_host) do |faraday|
|
96
|
+
faraday.request :json
|
97
|
+
faraday.adapter :net_http_persistent
|
98
|
+
end
|
99
|
+
|
100
|
+
resp = conn.post do |req|
|
101
|
+
req.url '/1/events/' + event.dataset
|
102
|
+
req.headers = {
|
103
|
+
'User-Agent' => "libhoney-rb/#{VERSION}",
|
104
|
+
'Content-Type' => 'application/json',
|
105
|
+
'X-Honeycomb-Team' => event.writekey,
|
106
|
+
'X-Honeycomb-SampleRate' => event.sample_rate.to_s,
|
107
|
+
'X-Event-Time' => event.timestamp.iso8601
|
108
|
+
}
|
109
|
+
req.body = event.data
|
110
|
+
end
|
111
|
+
|
112
|
+
# TODO handle faraday errors
|
113
|
+
|
114
|
+
resp
|
115
|
+
end
|
101
116
|
end
|
102
117
|
end
|
data/lib/libhoney/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libhoney
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Honeycomb.io Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|