libhoney 1.2.0 → 1.3.0

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: 3090756dce154f139d8a4c5598ba7a64be9c95e6
4
- data.tar.gz: 6ad36413896edd22a0175026cd5519d27c4389a6
3
+ metadata.gz: f2cf1e77e8482cd06429c7e210cc717122ad03cd
4
+ data.tar.gz: 75f37bc9c6c84234bedfe8a8810e7d137c10f3bd
5
5
  SHA512:
6
- metadata.gz: c76eb3a559bb39e98f86e99369314a649012e651d2e0b576726089ce16646107a24b56504823c62948dfe2b60d6792aad24ab784a966b8a4d65f109c52ae4571
7
- data.tar.gz: 23940a295a83f270a249d9a7d6278fbccd71f9998dd59abf1151f33956794fe3fe4c417ce24cbef7c450930c9bda4e24364664cb3a6205e2bf892369de591a64
6
+ metadata.gz: 55fdc94f50404e263926b6593df41e00f44a62f29fdf9b6c320cea8eafcd630ff1c50bbbb6195a7a038378155d5b5e87e850e367dfb3dbb9ad953d58c8774332
7
+ data.tar.gz: b4363dec9e178006cd3e37813f62469f651942750389cb5040c28660899609ba4909d55dd725a6f28f60b0193b225ba8c807288bbaf76ed856c3efc9995c3461
data/.travis.yml CHANGED
@@ -1,6 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.2
4
+ - 2.3
5
+ - 2.4
4
6
  deploy:
5
7
  provider: rubygems
6
8
  api_key:
data/README.md CHANGED
@@ -18,6 +18,15 @@ gem 'libhoney'
18
18
  #gem 'libhoney', git: 'https://github.com/honeycombio/libhoney-rb.git'
19
19
  ```
20
20
 
21
+ This gem has some native dependencies, so if you see an error along the lines of "Failed to build gem native extension", you may need to install the Ruby development headers and a C++ compiler. e.g. on Ubuntu:
22
+
23
+ ```
24
+ sudo apt-get install build-essential ruby-dev
25
+ ```
26
+
27
+ Note that libhoney requires Ruby 2.2 or greater.
28
+
29
+
21
30
  ## Documentation
22
31
 
23
32
  An API reference is available at http://www.rubydoc.info/gems/libhoney
@@ -30,8 +39,12 @@ Honeycomb can calculate all sorts of statistics, so send the values you care abo
30
39
  require 'libhoney'
31
40
 
32
41
  # Create a client instance
33
- honeycomb = Libhoney::Client.new(:writekey => "YOUR_WRITE_KEY",
34
- :dataset => "honeycomb-ruby-example")
42
+ honeycomb = Libhoney::Client.new(
43
+ # Use an environment variable to set your write key with something like
44
+ # `:writekey => ENV["HONEYCOMB_WRITEKEY"]`
45
+ :writekey => "YOUR_WRITE_KEY",
46
+ :dataset => "honeycomb-ruby-example"
47
+ )
35
48
 
36
49
  honeycomb.send_now({
37
50
  duration_ms: 153.12,
@@ -1,6 +1,7 @@
1
1
  require 'thread'
2
2
  require 'time'
3
3
  require 'json'
4
+ require 'http'
4
5
 
5
6
  # define a few additions that proxy access through Client's builder. makes Client much tighter.
6
7
  class Class
@@ -1,6 +1,4 @@
1
1
  require 'libhoney/response'
2
- require 'faraday'
3
- require 'faraday_middleware'
4
2
 
5
3
  module Libhoney
6
4
  # @api private
@@ -51,7 +49,13 @@ module Libhoney
51
49
  before = Time.now
52
50
 
53
51
  begin
54
- resp = do_send(e)
52
+ resp = HTTP.headers(
53
+ 'User-Agent' => "libhoney-rb/#{VERSION}",
54
+ 'Content-Type' => 'application/json',
55
+ 'X-Honeycomb-Team' => e.writekey,
56
+ 'X-Honeycomb-SampleRate' => e.sample_rate,
57
+ 'X-Event-Time' => e.timestamp.iso8601
58
+ ).post(URI.join(e.api_host, '/1/events/', e.dataset), :json => e.data)
55
59
 
56
60
  response = Response.new(:status_code => resp.status)
57
61
  rescue Exception => error
@@ -89,29 +93,5 @@ module Libhoney
89
93
 
90
94
  0
91
95
  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
116
96
  end
117
97
  end
@@ -1,3 +1,3 @@
1
1
  module Libhoney
2
- VERSION = "1.2.0"
2
+ VERSION = "1.3.0"
3
3
  end
data/libhoney.gemspec CHANGED
@@ -29,7 +29,5 @@ 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 "faraday", "~> 0.12"
33
- spec.add_dependency "faraday_middleware", "~> 0.12"
34
- spec.add_dependency "net-http-persistent", "~> 3.0"
32
+ spec.add_dependency "http", "~> 2.0"
35
33
  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.2.0
4
+ version: 1.3.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-30 00:00:00.000000000 Z
11
+ date: 2017-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -95,47 +95,19 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0.5'
97
97
  - !ruby/object:Gem::Dependency
98
- name: faraday
98
+ name: http
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0.12'
103
+ version: '2.0'
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: '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'
110
+ version: '2.0'
139
111
  description: Ruby gem for sending data to Honeycomb
140
112
  email: support@honeycomb.io
141
113
  executables: []
@@ -179,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
151
  version: '0'
180
152
  requirements: []
181
153
  rubyforge_project:
182
- rubygems_version: 2.4.5
154
+ rubygems_version: 2.6.13
183
155
  signing_key:
184
156
  specification_version: 4
185
157
  summary: send data to Honeycomb