libhoney 1.14.2 → 1.14.7.pre.beta

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: 3f927781fd9eabe1295401e3c82ff1bac4397fc268161a0f50bbde9265e36043
4
- data.tar.gz: 5de25f0498bdceedaf1d0f70d152d1f636cec859826bfa8415e1bdbfdb8cda7a
3
+ metadata.gz: f6f302a1a7951ee69d8b8c773ffb20515805d5303d74afb5774366339931a104
4
+ data.tar.gz: 22fb789977f2ff616eaef1da85b39d6eed1069d8014312713ace4854e2e89649
5
5
  SHA512:
6
- metadata.gz: 431121e46ae89a3362ede8612f56cf4c6bcbf034389e78751e5a24e39c95bcb2ea364a240c2251f0583363913403d94bc87738ace08c92e28de1f1e11861cdcb
7
- data.tar.gz: d9d64648f34037c8904ae001c2967b6c7a81dad0c46fd7aef0ba95501cf284010b2a5ba2d88ce0dacf020b05929247927eea89c7e45ece216598758e142aaa97
6
+ metadata.gz: 1e324e50bba606bb11c85f8e4525fd92a6f47803e6c44aa2283beff1351aee9f020bc88e32358065948e0824d1ba77404166bde35a8ea6a4a56f66cc96be7125
7
+ data.tar.gz: bae862660dfbc493bb60ec7676d1f13a5b37eee67df17c8ac471c3133081f9799ddb3dd7132452d8b79868d0b2b440568b2a1dbd526c17d4a312676a1064595f
@@ -1,56 +1,63 @@
1
- version: 2.0
1
+ version: 2.1
2
2
 
3
- test_steps: &test_steps
4
- - checkout
5
- - restore_cache:
6
- keys:
7
- - v1-dependencies-{{ checksum "Gemfile.lock" }}
8
- # fallback to using the latest cache if no exact match is found
9
- - v1-dependencies-
10
- - run:
11
- name: install dependencies
12
- command: |
13
- bundle install --jobs=4 --retry=3 --path vendor/bundle
14
- - save_cache:
15
- paths:
16
- - ./vendor/bundle
17
- key: v1-dependencies-{{ checksum "Gemfile.lock" }}
18
- - run:
19
- name: run rubocop
20
- command: bundle exec rake rubocop
21
- - run:
22
- name: run tests
23
- command: bundle exec rake test
3
+ # YAML Anchors to reduce copypasta
24
4
 
25
- # required as all of the jobs need to have a tag filter for some reason
26
- tag_filters: &tag_filters
5
+ # This is necessary for job to run when a tag is created
6
+ filters_always: &filters_always
27
7
  filters:
28
- tags:
29
- only: /.*/
8
+ tags:
9
+ only: /.*/
30
10
 
31
- jobs:
32
- ruby-2.3:
33
- docker:
34
- - image: circleci/ruby:2.3
35
- steps: *test_steps
36
- ruby-2.4:
37
- docker:
38
- - image: circleci/ruby:2.4
39
- steps: *test_steps
40
- ruby-2.5:
41
- docker:
42
- - image: circleci/ruby:2.5
43
- steps: *test_steps
44
- ruby-2.6:
11
+ # Restrict running to only be on tags starting with vNNNN
12
+ filters_publish: &filters_publish
13
+ filters:
14
+ tags:
15
+ only: /^v[0-9].*/
16
+ branches:
17
+ ignore: /.*/
18
+
19
+ matrix_rubyversions: &matrix_rubyversions
20
+ matrix:
21
+ parameters:
22
+ rubyversion: ["2.2", "2.3", "2.4", "2.5", "2.6", "2.7"]
23
+
24
+ # Default version of ruby to use for lint and publishing
25
+ default_rubyversion: &default_rubyversion "2.7"
26
+
27
+ executors:
28
+ ruby:
29
+ parameters:
30
+ rubyversion:
31
+ type: string
32
+ default: *default_rubyversion
45
33
  docker:
46
- - image: circleci/ruby:2.6
47
- steps: *test_steps
48
- publish:
34
+ - image: circleci/ruby:<< parameters.rubyversion >>
35
+ github:
49
36
  docker:
50
- # Just randomly pick one recent ruby version
51
- - image: circleci/ruby:2.6
52
- working_directory: ~/repo
37
+ - image: cibuilds/github:0.13.0
38
+
39
+ commands:
40
+ publish_github:
53
41
  steps:
42
+ - attach_workspace:
43
+ at: ~/
44
+ - run:
45
+ name: "Artifacts being published"
46
+ command: |
47
+ echo "about to publish to tag ${CIRCLE_TAG}"
48
+ ls -l ~/artifacts/*
49
+ - run:
50
+ name: "GHR Draft"
51
+ command: ghr -draft -n ${CIRCLE_TAG} -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ${CIRCLE_TAG} ~/artifacts
52
+ publish_rubygems:
53
+ steps:
54
+ - attach_workspace:
55
+ at: ~/
56
+ - run:
57
+ name: "Artifacts being published"
58
+ command: |
59
+ echo "about to publish to tag ${CIRCLE_TAG}"
60
+ ls -l ~/artifacts/*
54
61
  - checkout
55
62
  - run:
56
63
  name: Setup Rubygems
@@ -58,25 +65,93 @@ jobs:
58
65
  - run:
59
66
  name: Publish to Rubygems
60
67
  command: |
61
- gem build libhoney.gemspec
62
- gem push "libhoney-$(git describe --tags | cut -d "v" -f 2).gem"
68
+ gem push ~/artifacts/*.gem
69
+
70
+ jobs:
71
+ test:
72
+ parameters:
73
+ rubyversion:
74
+ type: string
75
+ default: *default_rubyversion
76
+ executor:
77
+ name: ruby
78
+ rubyversion: "<< parameters.rubyversion >>"
79
+ steps:
80
+ - checkout
81
+ - restore_cache:
82
+ keys:
83
+ - v1-dependencies-{{ checksum "libhoney.gemspec" }}
84
+ # fallback to using the latest cache if no exact match is found
85
+ - v1-dependencies-
86
+ - run:
87
+ name: install dependencies
88
+ command: |
89
+ bundle install --jobs=4 --retry=3 --path vendor/bundle
90
+ - save_cache:
91
+ paths:
92
+ - ./vendor/bundle
93
+ key: v1-dependencies-{{ checksum "libhoney.gemspec" }}
94
+ - run:
95
+ name: run rubocop
96
+ command: bundle exec rake rubocop
97
+ - run:
98
+ name: run tests
99
+ command: bundle exec rake test
100
+
101
+ build_artifacts:
102
+ executor:
103
+ name: ruby
104
+ steps:
105
+ - checkout
106
+ - run: mkdir -p ~/artifacts
107
+ - run: gem build libhoney.gemspec
108
+ - run: cp libhoney-*.gem ~/artifacts/
109
+ - persist_to_workspace:
110
+ root: ~/
111
+ paths:
112
+ - artifacts
113
+ - store_artifacts:
114
+ path: ~/artifacts
115
+
116
+ publish_github:
117
+ executor: github
118
+ steps:
119
+ - publish_github
120
+
121
+ publish_rubygems:
122
+ executor:
123
+ name: ruby
124
+ steps:
125
+ - publish_rubygems
63
126
 
64
127
  workflows:
65
- version: 2
128
+ nightly:
129
+ triggers:
130
+ - schedule:
131
+ cron: "0 0 * * *"
132
+ filters:
133
+ branches:
134
+ only:
135
+ - main
136
+ jobs:
137
+ - test:
138
+ <<: *matrix_rubyversions
66
139
  build:
67
140
  jobs:
68
- - ruby-2.3: *tag_filters
69
- - ruby-2.4: *tag_filters
70
- - ruby-2.5: *tag_filters
71
- - ruby-2.6: *tag_filters
72
- - publish:
141
+ - test:
142
+ <<: *filters_always
143
+ <<: *matrix_rubyversions
144
+ - build_artifacts:
145
+ <<: *filters_always
73
146
  requires:
74
- - ruby-2.3
75
- - ruby-2.4
76
- - ruby-2.5
77
- - ruby-2.6
78
- filters:
79
- tags:
80
- only: /^v.*/
81
- branches:
82
- ignore: /.*/
147
+ - test
148
+ - publish_github:
149
+ <<: *filters_publish
150
+ context: Honeycomb Secrets
151
+ requires:
152
+ - build_artifacts
153
+ - publish_rubygems:
154
+ <<: *filters_publish
155
+ context: Honeycomb Secrets
156
+ requires:
157
+ - build_artifacts
@@ -0,0 +1,12 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 2
6
+ charset = utf-8
7
+ trim_trailing_whitespace = true
8
+ insert_final_newline = true
9
+
10
+ [*.md]
11
+ indent_size = 4
12
+ trim_trailing_whitespace = false
@@ -0,0 +1,5 @@
1
+ # Code owners file.
2
+ # This file controls who is tagged for review for any given pull request.
3
+
4
+ # For anything not explicitly taken by someone else:
5
+ * @honeycombio/integrations-team @martin308
@@ -0,0 +1,7 @@
1
+ # libhoney-rb changelog
2
+
3
+ ### Misc
4
+
5
+ - Added CHANGELOG.md
6
+ - Updates to CI configuration and documentation
7
+ - Updated version management.
data/README.md CHANGED
@@ -4,8 +4,8 @@ Ruby gem for sending events to [Honeycomb](https://www.honeycomb.io), a service
4
4
 
5
5
  Requires Ruby 2.2 or greater.
6
6
 
7
- - [Usage and Examples](https://docs.honeycomb.io/sdk/ruby/)
8
- - [API Reference](https://www.rubydoc.info/gems/libhoney)
7
+ - [Usage and Examples](https://docs.honeycomb.io/sdk/ruby/)
8
+ - [API Reference](https://www.rubydoc.info/gems/libhoney)
9
9
 
10
10
  For tracing support and automatic instrumentation of Rails, Sinatra, Rack, ActiveRecord, and other frameworks, check out our [Beeline for Ruby](https://github.com/honeycombio/beeline-ruby).
11
11
 
@@ -20,8 +20,11 @@ All contributions will be released under the Apache License 2.0.
20
20
  ### Releasing a new version
21
21
 
22
22
  CircleCI will automatically upload tagged releases to Rubygems. To release a new
23
- version, run
23
+ version, update the version using `bump`.
24
+
24
25
  ```
25
- bump patch --tag # Or bump minor --tag, etc.
26
- git push --follow-tags
26
+ bump patch # Or bump minor, etc.
27
27
  ```
28
+
29
+ Then, after the version change has been merged into `main`, follow our usual instructions
30
+ for tagging and updating the github release.
@@ -56,7 +56,7 @@ module Libhoney
56
56
  def clean_string(str)
57
57
  return str if str.encoding == Encoding::UTF_8 && str.valid_encoding?
58
58
 
59
- str.encode(Encoding::UTF_8, ENCODING_OPTIONS)
59
+ str.encode(Encoding::UTF_8, **ENCODING_OPTIONS)
60
60
  end
61
61
  end
62
62
  end
@@ -229,7 +229,7 @@ module Libhoney
229
229
  proxy_config: @proxy_config
230
230
  }
231
231
 
232
- @transmission ||= TransmissionClient.new(transmission_client_params)
232
+ @transmission ||= TransmissionClient.new(**transmission_client_params)
233
233
  end
234
234
 
235
235
  @transmission.add(event)
@@ -121,8 +121,6 @@ module Libhoney
121
121
  #
122
122
  # @return [self] this event.
123
123
  def send_presampled
124
- raise ArgumentError, "No metrics added to event. Won't send empty event." if data.empty?
125
-
126
124
  @libhoney.send_event(self)
127
125
  self
128
126
  end
@@ -40,9 +40,7 @@ module Libhoney
40
40
  end
41
41
 
42
42
  def add(event)
43
- raise ArgumentError, "No APIHost for Honeycomb. Can't send to the Great Unknown." if event.api_host == ''
44
- raise ArgumentError, "No WriteKey specified. Can't send event." if event.writekey == ''
45
- raise ArgumentError, "No Dataset for Honeycomb. Can't send datasetless." if event.dataset == ''
43
+ return unless event_valid(event)
46
44
 
47
45
  begin
48
46
  @batch_queue.enq(event, !@block_on_send)
@@ -53,6 +51,26 @@ module Libhoney
53
51
  ensure_threads_running
54
52
  end
55
53
 
54
+ def event_valid(event)
55
+ invalid = []
56
+ invalid.push('api host') if event.api_host.nil? || event.api_host.empty?
57
+ invalid.push('write key') if event.writekey.nil? || event.writekey.empty?
58
+ invalid.push('dataset') if event.dataset.nil? || event.dataset.empty?
59
+
60
+ unless invalid.empty?
61
+ e = StandardError.new("#{self.class.name}: nil or empty required fields (#{invalid.join(', ')})"\
62
+ '. Will not attempt to send.')
63
+ Response.new(error: e).tap do |error_response|
64
+ error_response.metadata = event.metadata
65
+ enqueue_response(error_response)
66
+ end
67
+
68
+ return false
69
+ end
70
+
71
+ true
72
+ end
73
+
56
74
  def send_loop
57
75
  http_clients = build_http_clients
58
76
 
@@ -139,9 +157,11 @@ module Libhoney
139
157
 
140
158
  loop do
141
159
  begin
142
- while (event = Timeout.timeout(@send_frequency) { @batch_queue.pop })
143
- key = [event.api_host, event.writekey, event.dataset]
144
- batched_events[key] << event
160
+ Thread.handle_interrupt(Timeout::Error => :on_blocking) do
161
+ while (event = Timeout.timeout(@send_frequency) { @batch_queue.pop })
162
+ key = [event.api_host, event.writekey, event.dataset]
163
+ batched_events[key] << event
164
+ end
145
165
  end
146
166
 
147
167
  break
@@ -1,3 +1,3 @@
1
1
  module Libhoney
2
- VERSION = '1.14.2'.freeze
2
+ VERSION = '1.14.7-beta'.freeze
3
3
  end
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.add_development_dependency 'rubocop', '< 0.69'
30
30
  spec.add_development_dependency 'sinatra'
31
31
  spec.add_development_dependency 'sinatra-contrib'
32
- spec.add_development_dependency 'spy'
32
+ spec.add_development_dependency 'spy', '1.0.0'
33
33
  spec.add_development_dependency 'webmock', '~> 3.4'
34
34
  spec.add_development_dependency 'yard'
35
35
  spec.add_development_dependency 'yardstick', '~> 0.9'
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.14.2
4
+ version: 1.14.7.pre.beta
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: 2019-12-10 00:00:00.000000000 Z
11
+ date: 2020-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bump
@@ -112,16 +112,16 @@ dependencies:
112
112
  name: spy
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: 1.0.0
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: '0'
124
+ version: 1.0.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: webmock
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -206,12 +206,14 @@ extra_rdoc_files: []
206
206
  files:
207
207
  - ".circleci/config.yml"
208
208
  - ".circleci/setup-rubygems.sh"
209
+ - ".editorconfig"
210
+ - ".github/CODEOWNERS"
209
211
  - ".gitignore"
210
212
  - ".rubocop.yml"
211
213
  - ".rubocop_todo.yml"
214
+ - CHANGELOG.md
212
215
  - CONTRIBUTORS
213
216
  - Gemfile
214
- - Gemfile.lock
215
217
  - LICENSE
216
218
  - NOTICE
217
219
  - README.md
@@ -247,11 +249,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
247
249
  version: 2.2.0
248
250
  required_rubygems_version: !ruby/object:Gem::Requirement
249
251
  requirements:
250
- - - ">="
252
+ - - ">"
251
253
  - !ruby/object:Gem::Version
252
- version: '0'
254
+ version: 1.3.1
253
255
  requirements: []
254
- rubygems_version: 3.0.3
256
+ rubygems_version: 3.1.4
255
257
  signing_key:
256
258
  specification_version: 4
257
259
  summary: send data to Honeycomb
@@ -1,101 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- libhoney (1.14.2)
5
- addressable (~> 2.0)
6
- http (>= 2.0, < 5.0)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- addressable (2.6.0)
12
- public_suffix (>= 2.0.2, < 4.0)
13
- ast (2.4.0)
14
- backports (3.15.0)
15
- bump (0.8.0)
16
- crack (0.4.3)
17
- safe_yaml (~> 1.0.0)
18
- domain_name (0.5.20190701)
19
- unf (>= 0.0.5, < 1.0.0)
20
- ffi (1.11.3)
21
- ffi-compiler (1.0.1)
22
- ffi (>= 1.0.0)
23
- rake
24
- hashdiff (1.0.0)
25
- http (4.2.0)
26
- addressable (~> 2.3)
27
- http-cookie (~> 1.0)
28
- http-form_data (~> 2.0)
29
- http-parser (~> 1.2.0)
30
- http-cookie (1.0.3)
31
- domain_name (~> 0.5)
32
- http-form_data (2.1.1)
33
- http-parser (1.2.1)
34
- ffi-compiler (>= 1.0, < 2.0)
35
- jaro_winkler (1.5.3)
36
- minitest (5.11.3)
37
- multi_json (1.13.1)
38
- mustermann (1.0.3)
39
- parallel (1.17.0)
40
- parser (2.6.3.0)
41
- ast (~> 2.4.0)
42
- public_suffix (3.1.1)
43
- rack (2.0.7)
44
- rack-protection (2.0.5)
45
- rack
46
- rainbow (3.0.0)
47
- rake (12.3.3)
48
- rubocop (0.68.1)
49
- jaro_winkler (~> 1.5.1)
50
- parallel (~> 1.10)
51
- parser (>= 2.5, != 2.5.1.1)
52
- rainbow (>= 2.2.2, < 4.0)
53
- ruby-progressbar (~> 1.7)
54
- unicode-display_width (>= 1.4.0, < 1.6)
55
- ruby-progressbar (1.10.1)
56
- safe_yaml (1.0.5)
57
- sinatra (2.0.5)
58
- mustermann (~> 1.0)
59
- rack (~> 2.0)
60
- rack-protection (= 2.0.5)
61
- tilt (~> 2.0)
62
- sinatra-contrib (2.0.5)
63
- backports (>= 2.8.2)
64
- multi_json
65
- mustermann (~> 1.0)
66
- rack-protection (= 2.0.5)
67
- sinatra (= 2.0.5)
68
- tilt (>= 1.3, < 3)
69
- spy (1.0.0)
70
- tilt (2.0.9)
71
- unf (0.1.4)
72
- unf_ext
73
- unf_ext (0.0.7.6)
74
- unicode-display_width (1.5.0)
75
- webmock (3.6.2)
76
- addressable (>= 2.3.6)
77
- crack (>= 0.3.2)
78
- hashdiff (>= 0.4.0, < 2.0.0)
79
- yard (0.9.20)
80
- yardstick (0.9.9)
81
- yard (~> 0.8, >= 0.8.7.2)
82
-
83
- PLATFORMS
84
- ruby
85
-
86
- DEPENDENCIES
87
- bump (~> 0.5)
88
- bundler
89
- libhoney!
90
- minitest (~> 5.0)
91
- rake (~> 12.3)
92
- rubocop (< 0.69)
93
- sinatra
94
- sinatra-contrib
95
- spy
96
- webmock (~> 3.4)
97
- yard
98
- yardstick (~> 0.9)
99
-
100
- BUNDLED WITH
101
- 1.17.3