libhoney 1.0.0 → 1.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9ee74ef74255d89969a6fa143e1b9f28aabf3b32
4
- data.tar.gz: 5f9659817e94933e8138396315092d36196b00c4
3
+ metadata.gz: 26970710f84624c24124fb3610ff33d1f3869474
4
+ data.tar.gz: a665425df122795e8aa25599931e9950551672f3
5
5
  SHA512:
6
- metadata.gz: 1ef9aba4d5ed49c28741ed995575177dc831972ea756c18392ef42e6c30a468988481543e01dacb4a58582bb280f84a968ba6e834b470b6af5ec42d79a9001ec
7
- data.tar.gz: a46d2468b7f38ff6fd2c7f934ca913415ff5b4aef8670ab66d70e8e8414269483818d61c043692e000cff1ba4e5ece43fd92e6b9328fd643006419f3641da353
6
+ metadata.gz: 0b497556547823d888f302a2942e5a2a3fa761b729fbe70fbb516f8786c759cd680c56ba3725112395192d1bafbbfacbd57a850c8b4ddcd67d35fe1f4e94361e
7
+ data.tar.gz: 6051ebf88baf99c30f635ac7f9906f35d53dfbb99445e2dc362f7fe3e6b5eff189c621e601debcb2f44f8f87fa23e773de0367df24ce50088a1296469eb434b6
data/.travis.yml CHANGED
@@ -1,3 +1,11 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.2
4
+ deploy:
5
+ provider: rubygems
6
+ api_key:
7
+ secure: vtuGhZ4wujoJKVUdg5+sW6LbwWjiRQwTtA/2YFHPv+1guJNHyLcRJLAxZ9S4AVibjMqm38Qfh6GkK8rJCgur4wvO4EJoxp3qq7xOEAt02Lvg2KKtJ7ge6cQ0f5c8sIQ8emB2U5XFu4G5PARKAdtqlNxWWDwU9WbCZWxiDd9oCiX8/b8xt08GTlk7roI3tZGtpoa1Ca3u6bdJWAilGZQSwslx3mjnnZeLGTWsDEfLffjzt1aX+F2z3W1tUv7PGBPZLqfvsSh11ZnOV7o38VFbMwmAKcTcc6bYT4eUr1EYVpncGgw+zyi1X5BwBdRDXHKCJXclqhM+2q6dPpg32lzowksXS7DT8AdmwiybG05mvw7oAZM8DNCZ5Yf98MxOFKgIE5aE1XG31La7+e5llJA5SA3MKjd24FgnX1t71K0jcmAfJiHBWMEW8QnRfvM4gdlq6hViM6Adxh1htjRVtBVIE3SXwMfBiG6iLFx6BCIyK9kTKhzFWdqz0eQJkVCvjGpv18R6BOFem+cMKNrFIUGrc4nHRHstJ26kicVD8TSd1ja5mOfjHN5NXabEpx0nKtG6eFGGNyRaxh4lUKQ175wtnYyAlyoHG8g4Ya2o1NGDOHgjOCoz9SLy0BEyCl/gormwTJI7M2aDAoHtp68Yr8/oojhWxzkXr7HPSwqysbbNaDw=
8
+ gem: libhoney
9
+ on:
10
+ tags: true
11
+ repo: honeycombio/libhoney-rb
data/CONTRIBUTORS CHANGED
@@ -1,2 +1,3 @@
1
1
  Tim Spencer <tspencer@hungry.com>
2
- Chris Toshok <toshok@honeycomb.io>
2
+ Chris Toshok <toshok@honeycomb.io>
3
+ Jamie Osler <j.osler@gmail.com>
data/NOTICE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright (c) 2016-Present Honeycomb, Hound Technology, Inc. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
data/README.md CHANGED
@@ -1,16 +1,7 @@
1
- libhoney
2
- ========
3
- Ruby gem for sending events to http://honeycomb.io from within your ruby code.
1
+ # libhoney [![Build Status](https://travis-ci.org/honeycombio/libhoney-rb.svg?branch=master)](https://travis-ci.org/honeycombio/libhoney-rb) [![Gem Version](https://badge.fury.io/rb/libhoney.svg)](https://badge.fury.io/rb/libhoney)
4
2
 
5
- [![Build Status](https://travis-ci.com/honeycombio/libhoney-rb.svg?token=pycxQxHKSNdG7LiWg3Nt&branch=master)](https://travis-ci.com/honeycombio/libhoney-rb)
6
3
 
7
- ## Summary
8
-
9
- libhoney is written to ease the process of sending data to Honeycomb from within
10
- your ruby code.
11
-
12
- For an overview of how to use a honeycomb library, see our documentation at
13
- https://honeycomb.io/docs/send-data/sdks/
4
+ Ruby gem for sending events to [Honeycomb](https://honeycomb.io). (See here for more information about [using Honeycomb](https://honeycomb.io/intro/) and [its libraries](https://honeycomb.io/docs/send-data/sdks).)
14
5
 
15
6
  ## Installation
16
7
 
@@ -27,25 +18,28 @@ gem 'libhoney', :git => 'http://github.com/honeycombio/libhoney-rb.git'
27
18
  ```
28
19
 
29
20
  ## Example Usage
21
+
22
+ 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.
23
+
30
24
  ```ruby
31
25
  require 'libhoney'
32
26
 
33
- # create a client instance
34
- honey = Libhoney::Client.new(:writekey => "your writekey",
35
- :dataset => "your dataset")
27
+ # Create a client instance
28
+ honeycomb = Libhoney::Client.new(:writekey => "YOUR_WRITE_KEY",
29
+ :dataset => "honeycomb-ruby-example")
36
30
 
37
- # create an event and add fields to it
38
- event = honey.event
39
- event.add_field("duration_ms", 153.12)
40
- event.add_field("method", "get")
41
- # send the event
42
- event.send
31
+ honeycomb.send_now({
32
+ duration_ms: 153.12,
33
+ method: "get",
34
+ hostname: "appserver15",
35
+ payload_length: 27
36
+ })
43
37
 
44
- # when all done, call close
45
- honey.close
38
+ # Call close to flush any pending calls to Honeycomb
39
+ honeycomb.close
46
40
  ```
47
41
 
48
- You can find a more complete example demonstrating usage in `example/fact.rb`
42
+ You can find a more complete example demonstrating usage in [`example/fact.rb`](example/fact.rb)
49
43
 
50
44
  ## Contributions
51
45
 
@@ -55,3 +49,12 @@ CONTRIBUTORS file!
55
49
 
56
50
  All contributions will be released under the Apache License 2.0.
57
51
 
52
+
53
+ ### Releasing a new version
54
+
55
+ Travis will automatically upload tagged releases to Rubygems. To release a new
56
+ version, run
57
+ ```
58
+ bump patch --tag # Or bump minor --tag, etc.
59
+ git push --follow-tags
60
+ ```
data/example/fact.rb CHANGED
@@ -13,6 +13,8 @@ def factorial(n)
13
13
  return n * factorial(n - 1)
14
14
  end
15
15
 
16
+ # run factorial. libh_builder comes with some fields already populated
17
+ # (namely, "version", "num_threads", and "range")
16
18
  def run_fact(low, high, libh_builder)
17
19
  for i in low..high do
18
20
  ev = libh_builder.event
@@ -27,9 +29,7 @@ def run_fact(low, high, libh_builder)
27
29
  end
28
30
 
29
31
  def read_responses(resp_queue)
30
- loop do
31
- resp = resp_queue.pop()
32
- break if resp == nil
32
+ while resp = resp_queue.pop()
33
33
  puts "sending event with metadata #{resp.metadata} took #{resp.duration*1000}ms and got response code #{resp.status_code}"
34
34
  end
35
35
  end
@@ -42,11 +42,16 @@ libhoney = Libhoney::Client.new(:writekey => writekey,
42
42
  resps = libhoney.responses()
43
43
  Thread.new do
44
44
  begin
45
+ # attach fields to top-level instance
45
46
  libhoney.add_field("version", "3.4.5")
46
47
  libhoney.add_dynamic_field("num_threads", Proc.new { Thread.list.select {|thread| thread.status == "run"}.count })
48
+
49
+ # sends an event with "version", "num_threads", and "status" fields
47
50
  libhoney.send_now({:status => "starting run"})
48
51
  run_fact(1, 20, libhoney.builder({:range => "low"}))
49
52
  run_fact(31, 40, libhoney.builder({:range => "high"}))
53
+
54
+ # sends an event with "version", "num_threads", and "status" fields
50
55
  libhoney.send_now({:status => "ending run"})
51
56
  libhoney.close(true)
52
57
  rescue Exception => e
@@ -81,6 +81,7 @@ module Libhoney
81
81
  # discard if sampling rate says so
82
82
  if @libhoney.should_drop(self.sample_rate)
83
83
  @libhoney.send_dropped_response(self, "event dropped due to sampling")
84
+ return
84
85
  end
85
86
 
86
87
  self.send_presampled()
@@ -1,3 +1,3 @@
1
1
  module Libhoney
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.2"
3
3
  end
data/libhoney.gemspec CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  spec.files = ['lib/libhoney.rb', 'lib/libhoney/version.rb']
15
15
  spec.homepage = 'https://github.com/honeycombio/libhoney-rb'
16
16
  spec.license = 'Apache-2.0'
17
-
17
+
18
18
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
19
  f.match(%r{^(test|spec|features)/})
20
20
  end
@@ -29,5 +29,6 @@ Gem::Specification.new do |spec|
29
29
  spec.add_development_dependency "webmock", "~> 2.1"
30
30
  spec.add_development_dependency "minitest", "~> 5.0"
31
31
  spec.add_development_dependency "yardstick", "~> 0.9"
32
+ spec.add_development_dependency "bump", "~> 0.5"
32
33
  spec.add_dependency "http", "~> 2.0"
33
34
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libhoney
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Honeycomb.io Team
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.9'
83
+ - !ruby/object:Gem::Dependency
84
+ name: bump
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.5'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.5'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: http
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -105,6 +119,7 @@ files:
105
119
  - CONTRIBUTORS
106
120
  - Gemfile
107
121
  - LICENSE
122
+ - NOTICE
108
123
  - README.md
109
124
  - Rakefile
110
125
  - example/fact.rb