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 +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/libhoney/client.rb +21 -1
- data/lib/libhoney/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0867b211b613819cb14a3d4001d4a119d94a889a4aa8090f05f9233309786b63'
|
4
|
+
data.tar.gz: '0810087e42caf6553f088bad7744e650f7061e76c4ea89a5dc6ff1bf334b1b7e'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b3a51a0211491964afa320c12c25c919ac82362f1e42a1dfbbd27f8e6d0c5d09089ed9c4517d32e34dd2d884a9e5891c9878dce73a4668255a413854defe1de
|
7
|
+
data.tar.gz: 98faec4862aabf78f61f3f92c7374ec3e55a15bd517b8f9f04f3909defd56b89feb47dc6268df659463e8f219582985923a212644619027f782ccc90e0ce2c42
|
data/CHANGELOG.md
CHANGED
data/lib/libhoney/client.rb
CHANGED
@@ -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
|
data/lib/libhoney/version.rb
CHANGED
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.
|
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-
|
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.
|
318
|
+
rubygems_version: 3.3.11
|
319
319
|
signing_key:
|
320
320
|
specification_version: 4
|
321
321
|
summary: send data to Honeycomb
|