in rc2 version error: fluent-logger for nodejs (set milliseconds:1):report error:error="undefined method `nsec' for 1488276994397.0:Float\nDid you mean? inspect
linxuanwei opened this issue · 10 comments
I use fluent-logger nodejs.
var config = {
host: 'localhost',
port: 24224,
timeout: 3.0,
milliseconds: 1
};
when I write log to influxdb through fluent(support milliseconds? support nodejs?)
error came:
2017-02-28 10:16:37 +0000 [error]: #0 unexpected error on reading data host="172.17.0.1" port=33606 error_class=NoMethodError error="undefined method `nsec' for 1488276994397.0:Float\nDid you mean? inspect"
2017-02-28 10:16:37 +0000 [error]: #0 suppressed same stacktrace
49131-08-17 16:48:06.000000000 +0000 test: {"level":"info","message":"newdada:"}
2017-02-28 10:18:49 +0000 [warn]: #0 emit transaction failed: error_class=NoMethodError error="undefined method `nsec' for 1488277126086.0:Float\nDid you mean? inspect" tag="test"
when i use:
var config = {
host: 'localhost',
port: 24224,
timeout: 3.0};
I works and no error .
`var winston = require('winston');
var config = {
//host: '10.9.20.79',
host: 'localhost',
port: 24224,
timeout: 3.0,
milliseconds: 1
};
var tag = 'test';
var fluentTransport = require('fluent-logger').support.winstonTransport();
var logger = new (winston.Logger)({
transports: [new fluentTransport(tag, config), new (winston.transports.Console)()]
});
logger.log('info', 'some_data');`
fluentd doesn't support Float type time unit.
fluentd accepts only Integer second precision time or EventTime nano precision time.
I do nothing ,just use fluent-logger to send a log.
In fluent-logger source codes:
**` if (typeof time !== "number") {
time = Math.floor((time ? time.getTime() : Date.now()) / this._timeResolution);
}
var packet = [tag, time, data];**`
fluent-logger use Integer not Float type.
why is Float error? where auto convert Integer type to Float in source codes?
`var winston = require('winston');
var config = {
//host: '10.9.20.79',
host: 'localhost',
port: 24224,
timeout: 3.0,
milliseconds: 1
};
var tag = 'test';
var fluentTransport = require('fluent-logger').support.winstonTransport();
var logger = new (winston.Logger)({
transports: [new fluentTransport(tag, config), new (winston.transports.Console)()]
});
logger.log('info', 'some_data');`
there are all my test codes .
fluend write 'some_data' to influxdb.
but report Float Type Error.
I really do nothing....
@repeatedly
If I remove 'milliseconds' option, all is ok.
@repeatedly
I use fluentd v0.14 and fluent-plugin-influxdb v 1.0.0.rc2
I fixed the bug in fluent-plugin-influxdb-1.0.0.rc2/lib/fluent/plugin/out_influxdb.rb
make "fluent-plugin-influxdb" support float
def precision_time(time) # nsec is supported from v0.14 if time.is_a?Float nstime = (time * (10 ** 9)).to_i else nstime = time * (10 ** 9) + (time.is_a?(Integer) ? 0 : time.nsec) end @time_precise.call(nstime) end