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

error: time outside range when using udp transport and influxdb is configured to microseconds #189

Open
glitterkitty opened this issue Mar 28, 2023 · 1 comment
Labels
Milestone

Comments

@glitterkitty
Copy link

glitterkitty commented Mar 28, 2023

when points get written to influxdb using udp-transport, the lib is hardcoded to use nanosecond timestamps here:

LineProtocol.cxx
146:    return line.append(" ")
147:        .append(std::to_string(std::chrono::duration_cast<std::chrono::nanoseconds>(point.getTimestamp().time_since_epoch()).count()));

in case influxdb is configured to use e.g. microseconds timestamps in influxdb.conf like so:

[udp]
  # InfluxDB precision for timestamps on received points ("" or "n", "u", "ms", "s", "m", "h")
  precision = "u"

, an error is showing in the influxdb logs:

influxd[5104]: ts=2023-03-28T22:39:51.380112Z lvl=info msg="Failed to parse points" log_id=0gras_r0000 service=udp error="unable to parse 'measure t4=13.369999999999999218 1680043191378739991': time outside range -9223372036854775806 - 9223372036854775806"

workaround:

  • do not configure influxdb to anything else than nanoseconds timestamps

expected behaviour:

  • points do get written to db

actual behaviour:

  • points do not get written to db

Used version, compiler and platform:

  • influxdb version: 1.6.7~rc0-1ubuntu0.22.04.1
  • compiler: gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04)
  • platform:
    uname -a: Linux hostname 5.15.0-60-generic 66-Ubuntu SMP Fri Jan 20 14:29:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
    distro: KDE neon 5.26, Release: 22.04, Codename: jammy

example / steps to reproduce:

    
const std::string db_url = "udp://localhost:8089";
auto influxdb_conn = influxdb::InfluxDBFactory::Get(db_url);

try {

    // pump in some values
    for (int var = 0; var < 200; ++var) {
        influxdb_conn->write(influxdb::Point{"measure"}.addField("t4", 73.37) );
        usleep(100);
    }

}  catch(std::exception& e) {
    std::cout << std::endl <<  e.what();
}
  
@offa offa added the feature label Mar 29, 2023
@offa
Copy link
Owner

offa commented Mar 29, 2023

Thanks for the report. This is similar to #86. I'm going to plan this for the next release.

@offa offa added this to the v0.8.0 milestone Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants