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

Add possibility to let InfluxDB handle the timestamp itself #349

Closed
wasnertobias opened this issue Jul 5, 2017 · 4 comments
Closed

Add possibility to let InfluxDB handle the timestamp itself #349

wasnertobias opened this issue Jul 5, 2017 · 4 comments

Comments

@wasnertobias
Copy link
Contributor

wasnertobias commented Jul 5, 2017

Due to a bad support of accurate timestamps (especially in older Java versions) I would love to let InfluxDB handle the timestamps by itself.

A point is uniquely identified by the measurement name, tag set, and timestamp. If you submit a new point with the same measurement, tag set, and timestamp as an existing point, the field set becomes the union of the old field set and the new field set, where any ties go to the new field set. This is the intended behavior.

read more

As I have several data-points in a single measurement per second and it is not very recommended to have a unique-id in a tag (performance reasons) I would like to have an accurate timestamp. Otherwise I would loose data!

In the method build of Point I found the following behavior:

        if(this.time != null) {
            point.setTime(this.time);
            point.setPrecision(this.precision);
        } else {
            point.setTime(Long.valueOf(System.currentTimeMillis()));
            point.setPrecision(TimeUnit.MILLISECONDS);
        }

So, if no time is provided for a certain point this library does not what I want it to do. I can't find any simple way to let InfluxDB handle the timestamp using this library?

@majst01
Copy link
Collaborator

majst01 commented Jul 5, 2017

#312 is addressing this issue, i liked the approach, but the current author is not able to fix merge conflicts. So if you are interested you can catch up there.

@fmachado
Copy link
Contributor

fmachado commented Jul 5, 2017

The line protocol states that "Timestamp" is optional.
@majst01, dropping the else block mentioned above and adjusting org.influxdb.dto.Point.formatedTime(StringBuilder) seems to be enough to fix this issue.

Am I missing something?

@wasnertobias
Copy link
Contributor Author

@majst01 Why should there be a need to update the Java-version of this lib? I think you got me wrong.

I just want to act according to the documentation which says, that whilst writing data it is optional to provide a timestamp.
read more

@wasnertobias
Copy link
Contributor Author

Working on a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants