libhoney 1.4.1 → 1.5.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
  SHA256:
3
- metadata.gz: 73ba17fc70708d8053426b67e2ea8da0d08903867754cf9a7d051fd9cd697574
4
- data.tar.gz: 8ccf1db8d232401dc40ac3a844b3ef09d1880006367fef800817737471ef2369
3
+ metadata.gz: 29ad40e8dcbca0f6fecd415db07673c112775cf9c8e5c57c4c8d483110bab179
4
+ data.tar.gz: e2d40016c340a2220d83ae5f7de8971b637153d2dd5b1b687cd656adb19651e7
5
5
  SHA512:
6
- metadata.gz: 47002251459186d6cae72b0d35fde132925c435b46e3fc6d9de786e64ec3b4871730e1a4214a0b4391f7a49f1c30dbb86afec56dabe28584b729258e26578d68
7
- data.tar.gz: 6c26143b930627497eefdd378aa002335dbb5a32aac3d51332730f4ed95879a249ea028b8f68ae53ff34a4a05e48efba05d3580b926359bb94e7055e0bf74b1b
6
+ metadata.gz: 1ed70a0475fb88e90441f4e3626c12705f3f5a9cf8252f8046b0f2be3acac8806349311af87f43f423f7a41e60af4f14e1c662b0d8654f5c74adade31baca3a4
7
+ data.tar.gz: 86ee5a883863ec5ca594df1e3057c83bba3416340f979e54df5ccbeb98f978862ca00408cc16a5352b8a9394206ed260a5f66546fe5e7345a3cf149b29fc0fe5
data/README.md CHANGED
@@ -57,6 +57,8 @@ honeycomb.send_now({
57
57
  honeycomb.close
58
58
  ```
59
59
 
60
+ Check out the documentation for [`Libhoney::Client`](http://www.rubydoc.info/gems/libhoney/Libhoney/Client) for more detailed API documentation.
61
+
60
62
  You can find a more complete example demonstrating usage in [`example/fact.rb`](example/fact.rb)
61
63
 
62
64
  ## Testing instrumented code
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'yard'
2
3
 
3
4
  require "rake/testtask"
4
5
  Rake::TestTask.new(:test) do |t|
@@ -7,6 +8,8 @@ Rake::TestTask.new(:test) do |t|
7
8
  t.test_files = FileList['test/**/*_test.rb']
8
9
  end
9
10
 
11
+ YARD::Rake::YardocTask.new(:doc)
12
+
10
13
  require "yardstick/rake/measurement"
11
14
  Yardstick::Rake::Measurement.new do |measurement|
12
15
  measurement.output = "measurement/report.txt"
@@ -60,6 +60,7 @@ module Libhoney
60
60
  dataset: '',
61
61
  sample_rate: 1,
62
62
  api_host: 'https://api.honeycomb.io/',
63
+ user_agent_addition: nil,
63
64
  transmission: nil,
64
65
  block_on_send: false,
65
66
  block_on_responses: false,
@@ -78,6 +79,8 @@ module Libhoney
78
79
  @builder.sample_rate = sample_rate
79
80
  @builder.api_host = api_host
80
81
 
82
+ @user_agent_addition = user_agent_addition
83
+
81
84
  @block_on_send = block_on_send
82
85
  @block_on_responses = block_on_responses
83
86
  @max_batch_size = max_batch_size
@@ -145,7 +148,7 @@ module Libhoney
145
148
  # @param fn [#call] function that will be called to generate the value whenever an event is created.
146
149
  # @return [self] this libhoney instance.
147
150
  # @example
148
- # honey.addDynamicField("active_threads", Proc.new { Thread.list.select {|thread| thread.status == "run"}.count })
151
+ # honey.add_dynamic_field("active_threads", Proc.new { Thread.list.select {|thread| thread.status == "run"}.count })
149
152
  def add_dynamic_field(name, fn)
150
153
  @builder.add_dynamic_field(name, fn)
151
154
  self
@@ -155,10 +158,10 @@ module Libhoney
155
158
  #
156
159
  # @param data [Hash<String=>any>] optional field->value mapping to add to the event sent.
157
160
  # @return [self] this libhoney instance.
158
- # @example empty sendNow
159
- # honey.sendNow() # sends just the data that has been added via add/add_field/add_dynamic_field.
161
+ # @example empty send_now
162
+ # honey.send_now() # sends just the data that has been added via add/add_field/add_dynamic_field.
160
163
  # @example adding data at send-time
161
- # honey.sendNow {
164
+ # honey.send_now {
162
165
  # additionalField: value
163
166
  # }
164
167
  #/
@@ -183,7 +186,8 @@ module Libhoney
183
186
  :pending_work_capacity => @pending_work_capacity,
184
187
  :responses => @responses,
185
188
  :block_on_send => @block_on_send,
186
- :block_on_responses => @block_on_responses)
189
+ :block_on_responses => @block_on_responses,
190
+ :user_agent_addition => @user_agent_addition)
187
191
  end
188
192
  }
189
193
 
@@ -9,7 +9,8 @@ module Libhoney
9
9
  pending_work_capacity: 0,
10
10
  responses: 0,
11
11
  block_on_send: 0,
12
- block_on_responses: 0)
12
+ block_on_responses: 0,
13
+ user_agent_addition: nil)
13
14
 
14
15
  @responses = responses
15
16
  @block_on_send = block_on_send
@@ -19,6 +20,8 @@ module Libhoney
19
20
  @max_concurrent_batches = max_concurrent_batches
20
21
  @pending_work_capacity = pending_work_capacity
21
22
 
23
+ @user_agent = build_user_agent(user_agent_addition).freeze
24
+
22
25
  # use a SizedQueue so the producer will block on adding to the send_queue when @block_on_send is true
23
26
  @send_queue = SizedQueue.new(@pending_work_capacity)
24
27
  @threads = []
@@ -54,7 +57,7 @@ module Libhoney
54
57
 
55
58
  begin
56
59
  resp = HTTP.headers(
57
- 'User-Agent' => "libhoney-rb/#{VERSION}",
60
+ 'User-Agent' => @user_agent,
58
61
  'Content-Type' => 'application/json',
59
62
  'X-Honeycomb-Team' => e.writekey,
60
63
  'X-Honeycomb-SampleRate' => e.sample_rate,
@@ -97,5 +100,12 @@ module Libhoney
97
100
 
98
101
  0
99
102
  end
103
+
104
+ private
105
+ def build_user_agent(user_agent_addition)
106
+ ua = "libhoney-rb/#{VERSION}"
107
+ ua << " #{user_agent_addition}" if user_agent_addition
108
+ ua
109
+ end
100
110
  end
101
111
  end
@@ -1,3 +1,3 @@
1
1
  module Libhoney
2
- VERSION = "1.4.1"
2
+ VERSION = "1.5.0"
3
3
  end
data/libhoney.gemspec CHANGED
@@ -27,6 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency "rake", "~> 10.0"
28
28
  spec.add_development_dependency "webmock", "~> 2.1"
29
29
  spec.add_development_dependency "minitest", "~> 5.0"
30
+ spec.add_development_dependency "yard"
30
31
  spec.add_development_dependency "yardstick", "~> 0.9"
31
32
  spec.add_development_dependency "bump", "~> 0.5"
32
33
  spec.add_dependency "http", "~> 2.0"
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.1
4
+ version: 1.5.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-12-04 00:00:00.000000000 Z
11
+ date: 2018-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '5.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: yard
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: yardstick
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -152,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
166
  version: '0'
153
167
  requirements: []
154
168
  rubyforge_project:
155
- rubygems_version: 2.7.3
169
+ rubygems_version: 2.7.6
156
170
  signing_key:
157
171
  specification_version: 4
158
172
  summary: send data to Honeycomb