Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong timestamps with mongodb plugin #175

Closed
Pomyk opened this issue Sep 9, 2015 · 7 comments
Closed

Wrong timestamps with mongodb plugin #175

Pomyk opened this issue Sep 9, 2015 · 7 comments
Labels
bug unexpected problem or unintended behavior

Comments

@Pomyk
Copy link

Pomyk commented Sep 9, 2015

I have set the precision to seconds. Mongodb plugin writes timestamp in nanoseconds without respecting the precision.
Influxdb then reads this and gets year 2111 (that causes some strange behavior - a new WAL after every write).

@sparrc
Copy link
Contributor

sparrc commented Sep 9, 2015

You'll need to be more specific, things to include:

  1. operating system
  2. config file
  3. version number
  4. debug output

My first guess is that there is something wrong with your system's clock, I don't know how else to explain year 2111

@sparrc
Copy link
Contributor

sparrc commented Sep 10, 2015

I still don't understand the part about year 2111, but I have found a bug in setting the precision for the plugin gathering in certain situations. I will have a fix for that soon.

@sparrc sparrc closed this as completed in 81f4aa9 Sep 10, 2015
@Pomyk
Copy link
Author

Pomyk commented Sep 11, 2015

Thanks for the quick response, but that didn't fix it unfortunately.
os - CentOS 7
relevant config part is:

  [agent]
    precision = "s"
  [mongodb]

influx and telegraf compiled from master
output from influxd: https://gist.github.com/Pomyk/d7c707ec9432dda8cdb3

From the Line protocol docs:

"Timestamps are assumed to be in nanoseconds unless a precision value is passed in the query string."

Telegraf passes precision=s in params, but data from mongodb plugin has timestamps encoded in nanoseconds. Influxdb reads ns and multiplies by 1000000 so the timestamp overflows and the date becomes random.

@sparrc
Copy link
Contributor

sparrc commented Sep 11, 2015

Okay, thanks for the info, I'll have to look into this next week. Can you please provide the debug telegraf output? and also the output of telegraf -version (if this doesn't return anything, include the commit from which you built.)

@sparrc sparrc reopened this Sep 11, 2015
@Pomyk
Copy link
Author

Pomyk commented Sep 14, 2015

Version v0.1.8-11-gd8482cc
Debug output: https://gist.github.com/Pomyk/a2929f84882b65b28622

@sparrc sparrc added bug unexpected problem or unintended behavior and removed Need More Info labels Sep 14, 2015
@sparrc
Copy link
Contributor

sparrc commented Sep 14, 2015

I've reproduced this, working on a fix now

@sparrc
Copy link
Contributor

sparrc commented Sep 15, 2015

@Pomyk wow this turned into a rabbit-hole, and actually looks like it is a bug in influxfb. I have a PR up against the InfluxDB client code (influxdata/influxdb#4099) to fix this and will have a separate PR for telegraf sometime tomorrow.

sparrc added a commit that referenced this issue Sep 16, 2015
Currently adding with time is broken, because InfluxDB does not support
using precision for timestamp truncation both with and without
timestamps. This will be re-enabled once we fix InfluxDB to use the
precision argument for truncation in all cases, and a "unit" argument
in the line-protocol for adding points with non-nanosecond stamps

Fixes #175
@sparrc sparrc closed this as completed in 733ba07 Sep 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants