libhoney 1.0.4 → 1.1.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/README.md +9 -5
- data/lib/libhoney/client.rb +2 -3
- data/lib/libhoney/transmission.rb +23 -7
- data/lib/libhoney/version.rb +1 -1
- data/libhoney.gemspec +3 -1
- metadata +33 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 709e34b6d6a1f0c9c1cd4e14898d4921405fa924
|
4
|
+
data.tar.gz: c8f47ea904509f3b4ba25e54eaeb3bcf530415f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 676446ff6c3daaf0520957b091939e5ab4c8bb174653fa00f4b22f7147795b0cd25f99639672485a68c6356998ac89f41f7864298062dc23cbe926c4a14c0e68
|
7
|
+
data.tar.gz: 789b3e21e993a2fa70750f6c7eb056af092068069fbd740ce0e0f466298a41bcd18de9cb390cff5f1b0b656f819efd71db1a6bb6a15ff32d6129b977d194b638
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# libhoney [](https://travis-ci.org/honeycombio/libhoney-rb) [](https://badge.fury.io/rb/libhoney)
|
2
2
|
|
3
|
-
Ruby gem for sending events to [Honeycomb](https://honeycomb.io). (
|
3
|
+
Ruby gem for sending events to [Honeycomb](https://honeycomb.io). (For more information, see the [documentation](https://honeycomb.io/docs/) and [Ruby SDK guide](https://honeycomb.io/docs/connect/ruby).)
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -10,12 +10,18 @@ To install the stable release:
|
|
10
10
|
gem install libhoney
|
11
11
|
```
|
12
12
|
|
13
|
-
|
13
|
+
or add `libhoney` to your Gemfile:
|
14
14
|
|
15
15
|
```
|
16
|
-
gem 'libhoney'
|
16
|
+
gem 'libhoney'
|
17
|
+
# or, to follow the bleeding edge:
|
18
|
+
#gem 'libhoney', git: 'https://github.com/honeycombio/libhoney-rb.git'
|
17
19
|
```
|
18
20
|
|
21
|
+
## Documentation
|
22
|
+
|
23
|
+
An API reference is available at http://www.rubydoc.info/gems/libhoney
|
24
|
+
|
19
25
|
## Example Usage
|
20
26
|
|
21
27
|
Honeycomb can calculate all sorts of statistics, so send the values you care about and let us crunch the averages, percentiles, lower/upper bounds, cardinality -- whatever you want -- for you.
|
@@ -56,5 +62,3 @@ version, run
|
|
56
62
|
bump patch --tag # Or bump minor --tag, etc.
|
57
63
|
git push --follow-tags
|
58
64
|
```
|
59
|
-
|
60
|
-
Docs are generated via `rdoc` and hosted via the `gh-pages` branch of this repo.
|
data/lib/libhoney/client.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'thread'
|
2
2
|
require 'time'
|
3
3
|
require 'json'
|
4
|
-
require 'http'
|
5
4
|
|
6
5
|
# define a few additions that proxy access through Client's builder. makes Client much tighter.
|
7
6
|
class Class
|
@@ -50,7 +49,7 @@ module Libhoney
|
|
50
49
|
# Instantiates libhoney and prepares it to send events to Honeycomb.
|
51
50
|
#
|
52
51
|
# @param writekey [String] the write key from your honeycomb team
|
53
|
-
# @param dataset [String] the dataset you want
|
52
|
+
# @param dataset [String] the dataset you want
|
54
53
|
# @param sample_rate [Fixnum] cause libhoney to send 1 out of sampleRate events. overrides the libhoney instance's value.
|
55
54
|
# @param api_host [String] the base url to send events to
|
56
55
|
# @param block_on_send [Boolean] if more than pending_work_capacity events are written, block sending further events
|
@@ -69,7 +68,7 @@ module Libhoney
|
|
69
68
|
raise Exception.new('libhoney: max_concurrent_batches must be greater than 0') if max_concurrent_batches < 1
|
70
69
|
raise Exception.new('libhoney: sample rate must be greater than 0') if sample_rate < 1
|
71
70
|
|
72
|
-
raise Exception.new("libhoney: Ruby versions < 2.2 are not supported") if !Gem::Dependency.new("ruby", "~> 2.2").match?("ruby", RUBY_VERSION)
|
71
|
+
raise Exception.new("libhoney: Ruby versions < 2.2 are not supported") if !Gem::Dependency.new("ruby", "~> 2.2").match?("ruby", RUBY_VERSION)
|
73
72
|
@builder = Builder.new(self, nil)
|
74
73
|
@builder.writekey = writekey
|
75
74
|
@builder.dataset = dataset
|
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'libhoney/response'
|
2
|
+
require 'faraday'
|
3
|
+
require 'faraday_middleware'
|
2
4
|
|
3
5
|
module Libhoney
|
4
6
|
# @api private
|
@@ -24,7 +26,7 @@ module Libhoney
|
|
24
26
|
@threads = []
|
25
27
|
@lock = Mutex.new
|
26
28
|
end
|
27
|
-
|
29
|
+
|
28
30
|
def add(event)
|
29
31
|
begin
|
30
32
|
@send_queue.enq(event, !@block_on_send)
|
@@ -47,12 +49,26 @@ module Libhoney
|
|
47
49
|
break if e == nil
|
48
50
|
|
49
51
|
before = Time.now
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
52
|
+
|
53
|
+
conn = Faraday.new(:url => e.api_host) do |faraday|
|
54
|
+
faraday.request :json
|
55
|
+
faraday.adapter :net_http_persistent
|
56
|
+
end
|
57
|
+
|
58
|
+
resp = conn.post do |req|
|
59
|
+
req.url '/1/events/' + e.dataset
|
60
|
+
req.headers = {
|
61
|
+
'User-Agent' => "libhoney-rb/#{VERSION}",
|
62
|
+
'Content-Type' => 'application/json',
|
63
|
+
'X-Honeycomb-Team' => e.writekey,
|
64
|
+
'X-Honeycomb-SampleRate' => e.sample_rate.to_s,
|
65
|
+
'X-Event-Time' => e.timestamp.iso8601
|
66
|
+
}
|
67
|
+
req.body = e.data
|
68
|
+
end
|
69
|
+
|
70
|
+
# TODO handle faraday errors
|
71
|
+
|
56
72
|
after = Time.now
|
57
73
|
|
58
74
|
response = Response.new(:duration => after - before,
|
data/lib/libhoney/version.rb
CHANGED
data/libhoney.gemspec
CHANGED
@@ -29,5 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_development_dependency "minitest", "~> 5.0"
|
30
30
|
spec.add_development_dependency "yardstick", "~> 0.9"
|
31
31
|
spec.add_development_dependency "bump", "~> 0.5"
|
32
|
-
spec.add_dependency "
|
32
|
+
spec.add_dependency "faraday", "~> 0.12"
|
33
|
+
spec.add_dependency "faraday_middleware", "~> 0.12"
|
34
|
+
spec.add_dependency "net-http-persistent", "~> 3.0"
|
33
35
|
end
|
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.0
|
4
|
+
version: 1.1.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-
|
11
|
+
date: 2017-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -95,19 +95,47 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0.5'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: faraday
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '0.12'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '0.12'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: faraday_middleware
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.12'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.12'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: net-http-persistent
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '3.0'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '3.0'
|
111
139
|
description: Ruby gem for sending data to Honeycomb
|
112
140
|
email: support@honeycomb.io
|
113
141
|
executables: []
|