Skip to content

Commit

Permalink
v0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Esity committed Jul 22, 2021
1 parent 820427f commit 1d5ce6f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Telemetry::Metrics::Parser Changelog

## v0.1.1
* Adding more rspec tests for shellwords
* Adding in **opts to from_line_protocol method
* Changing line protocol parser to use shellwords logic by default

## v0.1.0
Initial Version
4 changes: 2 additions & 2 deletions lib/telemetry/metrics/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
module Telemetry
module Metrics
module Parser
def from_line_protocol(line)
Telemetry::Metrics::Parser::LineProtocol.parse(line)
def from_line_protocol(line, **opts)
Telemetry::Metrics::Parser::LineProtocol.parse(line, **opts)
end
module_function :from_line_protocol

Expand Down
8 changes: 5 additions & 3 deletions lib/telemetry/metrics/parser/line_protocol.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ module Parser
module LineProtocol
extend Telemetry::NumberHelper

def parse(line, use_shellwords: false)
def parse(line, use_shellwords: true)
if use_shellwords
raw_tags, raw_fields, timestamp = Shellwords.split(line)
raw_tags, raw_fields, timestamp = Shellwords.split(line.strip)
else
raw_tags, raw_fields, timestamp = line.split
raw_tags, raw_fields, timestamp = line.strip.split
end

{
Expand All @@ -33,6 +33,8 @@ def get_measurement(line)

def split_string_to_hash(raw_string)
results = {}
return results if raw_string.nil?

raw_string.split(',').each do |string|
next unless string.include? '='

Expand Down
2 changes: 1 addition & 1 deletion lib/telemetry/metrics/parser/version.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Telemetry
module Metrics
module Parser
VERSION = '0.1.0'.freeze
VERSION = '0.1.1'.freeze
end
end
end

0 comments on commit 1d5ce6f

Please sign in to comment.