libhoney 1.8.1 → 1.9.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 +4 -4
- data/.travis.yml +1 -0
- data/lib/libhoney/transmission.rb +24 -7
- data/lib/libhoney/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 002dba15d3956c73ef901036b9e0a9ea63e24006f6efe5204764b9a2685d4ae6
|
4
|
+
data.tar.gz: 1b21181cff8da8b5d27ced9fc34122a043fe4c75ec312a816559da18e866057e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7314941eade26ddf596e947926c29e9482106d36a1cd58d6f1ef9ac9ac672f0efaa788c9e455b45446f50521d32e42595a9e70d9cb8573268017a512d83aadc
|
7
|
+
data.tar.gz: 6eef3e11972e7cb4dfc9cc4ffcd31581e0d13e3f3a934ed8fd9bf4f8c69238de49e06d10ae618037d02e0398c10784195a3ada8e8c63078d94ff7f69e2910aaf
|
data/.travis.yml
CHANGED
@@ -48,6 +48,13 @@ module Libhoney
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def send_loop
|
51
|
+
http_clients = Hash.new do |h, api_host|
|
52
|
+
h[api_host] = HTTP.persistent(api_host).headers(
|
53
|
+
'User-Agent' => @user_agent,
|
54
|
+
'Content-Type' => 'application/json',
|
55
|
+
)
|
56
|
+
end
|
57
|
+
|
51
58
|
# eat events until we run out
|
52
59
|
loop {
|
53
60
|
e = @send_queue.pop
|
@@ -56,13 +63,17 @@ module Libhoney
|
|
56
63
|
before = Time.now
|
57
64
|
|
58
65
|
begin
|
59
|
-
|
60
|
-
|
61
|
-
|
66
|
+
http = http_clients[e.api_host]
|
67
|
+
|
68
|
+
resp = http.post('/1/events/'+URI.escape(e.dataset), json: e.data, headers: {
|
62
69
|
'X-Honeycomb-Team' => e.writekey,
|
63
70
|
'X-Honeycomb-SampleRate' => e.sample_rate,
|
64
71
|
'X-Event-Time' => e.timestamp.iso8601(3)
|
65
|
-
)
|
72
|
+
})
|
73
|
+
|
74
|
+
# "You must consume response before sending next request via persistent connection"
|
75
|
+
# https://github.com/httprb/http/wiki/Persistent-Connections-%28keep-alive%29#note-using-persistent-requests-correctly
|
76
|
+
resp.flush
|
66
77
|
|
67
78
|
response = Response.new(:status_code => resp.status)
|
68
79
|
rescue Exception => error
|
@@ -72,16 +83,22 @@ module Libhoney
|
|
72
83
|
# nothing consuming the queue).
|
73
84
|
response = Response.new(:error => error)
|
74
85
|
ensure
|
75
|
-
response
|
76
|
-
|
86
|
+
if response
|
87
|
+
response.duration = Time.now - before
|
88
|
+
response.metadata = e.metadata
|
89
|
+
end
|
77
90
|
end
|
78
91
|
|
79
92
|
begin
|
80
|
-
@responses.enq(response, !@block_on_responses)
|
93
|
+
@responses.enq(response, !@block_on_responses) if response
|
81
94
|
rescue ThreadError
|
82
95
|
# happens if the queue was full and block_on_send = false.
|
83
96
|
end
|
84
97
|
}
|
98
|
+
ensure
|
99
|
+
http_clients.each do |_, http|
|
100
|
+
http.close rescue nil
|
101
|
+
end
|
85
102
|
end
|
86
103
|
|
87
104
|
def close(drain)
|
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.9.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: 2018-
|
11
|
+
date: 2018-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|