Skip to content

Database name setting does not support sprintf formating  #82

@gdolata

Description

@gdolata

First db variable gets sprintf-ed in line 179.

buffer_receive(event_hash, event.sprintf(@db))
end # def receive
def flush(events, database, teardown = false)
@logger.debug? and @logger.debug("Flushing #{events.size} events to #{database} - Teardown? #{teardown}")
dowrite(events, database)
end # def flush

But then original "@db", rather than sprintf-ed "database" variable is used in line 190.

def dowrite(events, database)
begin
@influxdbClient.write_points(events, @time_precision, @retention_policy, @db )
rescue InfluxDB::AuthenticationError => ae
@logger.warn("Authentication Error while writing to InfluxDB", :exception => ae)
rescue InfluxDB::ConnectionError => ce
@logger.warn("Connection Error while writing to InfluxDB", :exception => ce)
rescue Exception => e
@logger.warn("Non recoverable exception while writing to InfluxDB", :exception => e)
end
end

Correct code should look like this.

  def dowrite(events, database)
    begin
        @influxdbClient.write_points(events, @time_precision, @retention_policy, database  )
    rescue InfluxDB::AuthenticationError => ae
        @logger.warn("Authentication Error while writing to InfluxDB", :exception => ae)
    rescue InfluxDB::ConnectionError => ce 
        @logger.warn("Connection Error while writing to InfluxDB", :exception => ce)
    rescue Exception => e
        @logger.warn("Non recoverable exception while writing to InfluxDB", :exception => e)
    end
  end

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions