libhoney 2.1.0 → 2.2.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: 87accb91b956f38c24050ebc8931d49041ab02551c394a7447434730eb827f18
4
- data.tar.gz: 899a27302a4e04e2ac50af6f792a8515b252a838bb6b09d9471bf6aab9058cbc
3
+ metadata.gz: '0867b211b613819cb14a3d4001d4a119d94a889a4aa8090f05f9233309786b63'
4
+ data.tar.gz: '0810087e42caf6553f088bad7744e650f7061e76c4ea89a5dc6ff1bf334b1b7e'
5
5
  SHA512:
6
- metadata.gz: 42b5a14b536bdda18f2900e2767c4702dd16e5a441300830c9a6cd7ae15d3e4c7d6b0edb3346bb278f239731b16ca8bc807851d57d3d3ad6da185782a48bf64c
7
- data.tar.gz: 1e764f94ded5a848f6a90197f340d31efbc13b2fa6eae9f7be2444a19b8a8e65165356d68cd76dd51f5ce8910e742db9fd8a49546170b4dafa4d99471445979d
6
+ metadata.gz: 7b3a51a0211491964afa320c12c25c919ac82362f1e42a1dfbbd27f8e6d0c5d09089ed9c4517d32e34dd2d884a9e5891c9878dce73a4668255a413854defe1de
7
+ data.tar.gz: 98faec4862aabf78f61f3f92c7374ec3e55a15bd517b8f9f04f3909defd56b89feb47dc6268df659463e8f219582985923a212644619027f782ccc90e0ce2c42
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [2.2.0] - 2022-04-14
2
+
3
+ ### Added
4
+
5
+ - Add Environment and Services support (#123) | [@MikeGoldsmith](https://github.com/MikeGoldsmith)
6
+
1
7
  ## [2.1.0] - 2022-02-02
2
8
 
3
9
  ### Improvements
@@ -34,6 +34,7 @@ module Libhoney
34
34
  extend Forwardable
35
35
 
36
36
  API_HOST = 'https://api.honeycomb.io/'.freeze
37
+ DEFAULT_DATASET = 'unknown_dataset'.freeze
37
38
 
38
39
  # Instantiates libhoney and prepares it to send events to Honeycomb.
39
40
  #
@@ -81,7 +82,7 @@ module Libhoney
81
82
  @builder = Builder.new(self, nil)
82
83
 
83
84
  @builder.writekey = writekey
84
- @builder.dataset = dataset
85
+ @builder.dataset = get_dataset(dataset, writekey)
85
86
  @builder.sample_rate = sample_rate
86
87
  @builder.api_host = api_host
87
88
 
@@ -275,5 +276,24 @@ module Libhoney
275
276
  rescue URI::Error => e
276
277
  warn "#{self.class.name}: unable to parse proxy_config. Detail: #{e.class}: #{e.message}"
277
278
  end
279
+
280
+ def get_dataset(dataset, write_key)
281
+ return dataset if classic_write_key?(write_key)
282
+
283
+ if dataset.nil? || dataset.empty?
284
+ warn "nil or empty dataset - sending data to '#{DEFAULT_DATASET}'"
285
+ dataset = DEFAULT_DATASET
286
+ end
287
+ trimmed = dataset.strip
288
+ if dataset != trimmed
289
+ warn "dataset contained leading or trailing whitespace - sending data to '#{trimmed}'"
290
+ dataset = trimmed
291
+ end
292
+ dataset
293
+ end
294
+
295
+ def classic_write_key?(write_key)
296
+ write_key.nil? || write_key.length == 32
297
+ end
278
298
  end
279
299
  end
@@ -1,3 +1,3 @@
1
1
  module Libhoney
2
- VERSION = '2.1.0'.freeze
2
+ VERSION = '2.2.0'.freeze
3
3
  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: 2.1.0
4
+ version: 2.2.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: 2022-02-02 00:00:00.000000000 Z
11
+ date: 2022-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bump
@@ -315,7 +315,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
315
315
  - !ruby/object:Gem::Version
316
316
  version: '0'
317
317
  requirements: []
318
- rubygems_version: 3.2.32
318
+ rubygems_version: 3.3.11
319
319
  signing_key:
320
320
  specification_version: 4
321
321
  summary: send data to Honeycomb