Skip to content

Commit 1d5ce6f

Browse files
committed
v0.1.1
1 parent 820427f commit 1d5ce6f

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# Telemetry::Metrics::Parser Changelog
22

3+
## v0.1.1
4+
* Adding more rspec tests for shellwords
5+
* Adding in **opts to from_line_protocol method
6+
* Changing line protocol parser to use shellwords logic by default
7+
38
## v0.1.0
49
Initial Version

lib/telemetry/metrics/parser.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
module Telemetry
55
module Metrics
66
module Parser
7-
def from_line_protocol(line)
8-
Telemetry::Metrics::Parser::LineProtocol.parse(line)
7+
def from_line_protocol(line, **opts)
8+
Telemetry::Metrics::Parser::LineProtocol.parse(line, **opts)
99
end
1010
module_function :from_line_protocol
1111

lib/telemetry/metrics/parser/line_protocol.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ module Parser
77
module LineProtocol
88
extend Telemetry::NumberHelper
99

10-
def parse(line, use_shellwords: false)
10+
def parse(line, use_shellwords: true)
1111
if use_shellwords
12-
raw_tags, raw_fields, timestamp = Shellwords.split(line)
12+
raw_tags, raw_fields, timestamp = Shellwords.split(line.strip)
1313
else
14-
raw_tags, raw_fields, timestamp = line.split
14+
raw_tags, raw_fields, timestamp = line.strip.split
1515
end
1616

1717
{
@@ -33,6 +33,8 @@ def get_measurement(line)
3333

3434
def split_string_to_hash(raw_string)
3535
results = {}
36+
return results if raw_string.nil?
37+
3638
raw_string.split(',').each do |string|
3739
next unless string.include? '='
3840

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Telemetry
22
module Metrics
33
module Parser
4-
VERSION = '0.1.0'.freeze
4+
VERSION = '0.1.1'.freeze
55
end
66
end
77
end

0 commit comments

Comments
 (0)