Skip to content

Commit

Permalink
Skip empty string because influxdb can't handle it. ref #89
Browse files Browse the repository at this point in the history
  • Loading branch information
repeatedly committed Aug 31, 2018
1 parent 8778f71 commit c281115
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/fluent/plugin/out_influxdb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ def start
end
end

EMPTY_STRING = ''.freeze
FORMATTED_RESULT_FOR_INVALID_RECORD = ''.freeze

def format(tag, time, record)
# TODO: Use tag based chunk separation for more reliability
if record.empty? || record.has_value?(nil)
log.warn "Skip record '#{record}', because either record has no value or at least a value is 'nil' inside the record. "
# nil and '' check should be in influxdb-ruby client...
if record.empty? || record.has_value?(nil) || record.has_value?(EMPTY_STRING)
log.warn "Skip record '#{record}' in '#{tag}', because either record has no value or at least a value is 'nil' inside the record."
FORMATTED_RESULT_FOR_INVALID_RECORD
else
[precision_time(time), record].to_msgpack
Expand Down

0 comments on commit c281115

Please sign in to comment.