-
Notifications
You must be signed in to change notification settings - Fork 9
fix: send correct time unit when writing Points #384
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -53,7 +53,10 @@ | |||||
| * <li><code>authScheme</code> - authentication scheme</li> | ||||||
| * <li><code>organization</code> - organization to be used for operations</li> | ||||||
| * <li><code>database</code> - database to be used for InfluxDB operations</li> | ||||||
| * <li><code>writePrecision</code> - precision to use when writing points to InfluxDB</li> | ||||||
| * <li><code>writePrecision</code> - precision to use when writing points to InfluxDB. | ||||||
| * This setting is ignored when writing {@link com.influxdb.v3.client.Point}; | ||||||
| * for those writes, the client always sends {@link WritePrecision#NS} | ||||||
| * precision to the server.</li> | ||||||
| * <li><code>defaultTags</code> - defaultTags added when writing points to InfluxDB</li> | ||||||
| * <li><code>gzipThreshold</code> - threshold when gzip compression is used for writing points to InfluxDB</li> | ||||||
| * <li><code>writeNoSync</code> - skip waiting for WAL persistence on write</li> | ||||||
|
|
@@ -548,7 +551,10 @@ public Builder database(@Nullable final String database) { | |||||
| * if no precision is specified in the write API call. | ||||||
| * | ||||||
| * @param writePrecision default precision to use for the timestamp of points | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would just remove a word to avoid a bit confusing contradiction with the sentence that follows after it.
Suggested change
|
||||||
| * if no precision is specified in the write API call | ||||||
| * if no precision is specified in the write API call. | ||||||
| * This setting is ignored when writing {@link com.influxdb.v3.client.Point}; | ||||||
| * for those writes, the client always sends {@link WritePrecision#NS} | ||||||
| * precision to the server. | ||||||
| * @return this | ||||||
| */ | ||||||
| @Nonnull | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -40,7 +40,9 @@ | |||||
| * <ul> | ||||||
| * <li><code>database</code> - specifies the database to be used for InfluxDB operations</li> | ||||||
| * <li><code>organization</code> - specifies the organization to be used for InfluxDB operations</li> | ||||||
| * <li><code>precision</code> - specifies the precision to use for the timestamp of points</li> | ||||||
| * <li><code>precision</code> - specifies the precision to use for timestamps in line protocol records. | ||||||
| * This setting is ignored when writing {@link com.influxdb.v3.client.Point}; for those writes, the client | ||||||
| * always sends {@link WritePrecision#NS} precision to the server.</li> | ||||||
| * <li><code>defaultTags</code> - specifies tags to be added by default to all write operations using points.</li> | ||||||
| * <li><code>tagOrder</code> - specifies preferred tag order for point serialization.</li> | ||||||
| * <li><code>noSync</code> - skip waiting for WAL persistence on write</li> | ||||||
|
|
@@ -124,6 +126,9 @@ public static WriteOptions defaultWriteOptions() { | |||||
| * If it is not specified then use {@link ClientConfig#getDatabase()}. | ||||||
| * @param precision The precision to use for the timestamp of points. | ||||||
| * If it is not specified then use {@link ClientConfig#getWritePrecision()}. | ||||||
| * This setting is ignored when writing {@link com.influxdb.v3.client.Point}; | ||||||
| * for those writes, the client always sends {@link WritePrecision#NS} | ||||||
| * precision to the server. | ||||||
| * @param gzipThreshold The threshold for compressing request body. | ||||||
|
NguyenHoangSon96 marked this conversation as resolved.
|
||||||
| * If it is not specified then use {@link WriteOptions#DEFAULT_GZIP_THRESHOLD}. | ||||||
| */ | ||||||
|
|
@@ -140,6 +145,9 @@ public WriteOptions(@Nullable final String database, | |||||
| * If it is not specified then use {@link ClientConfig#getDatabase()}. | ||||||
| * @param precision The precision to use for the timestamp of points. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would just remove a word to avoid a bit confusing contradiction with the sentence that follows after it.
Suggested change
|
||||||
| * If it is not specified then use {@link ClientConfig#getWritePrecision()}. | ||||||
| * This setting is ignored when writing {@link com.influxdb.v3.client.Point}; | ||||||
| * for those writes, the client always sends {@link WritePrecision#NS} | ||||||
| * precision to the server. | ||||||
| * @param gzipThreshold The threshold for compressing request body. | ||||||
|
NguyenHoangSon96 marked this conversation as resolved.
|
||||||
| * If it is not specified then use {@link WriteOptions#DEFAULT_GZIP_THRESHOLD}. | ||||||
| * @param defaultTags Default tags to be added when writing points. | ||||||
|
|
@@ -158,6 +166,9 @@ public WriteOptions(@Nullable final String database, | |||||
| * If it is not specified then use {@link ClientConfig#getDatabase()}. | ||||||
| * @param precision The precision to use for the timestamp of points. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| * If it is not specified then use {@link ClientConfig#getWritePrecision()}. | ||||||
| * This setting is ignored when writing {@link com.influxdb.v3.client.Point}; | ||||||
| * for those writes, the client always sends {@link WritePrecision#NS} | ||||||
| * precision to the server. | ||||||
| * @param gzipThreshold The threshold for compressing request body. | ||||||
|
Comment on lines
167
to
172
|
||||||
| * If it is not specified then use {@link WriteOptions#DEFAULT_GZIP_THRESHOLD}. | ||||||
| * @param noSync Skip waiting for WAL persistence on write. | ||||||
|
|
@@ -187,6 +198,9 @@ public WriteOptions(@Nullable final Map<String, String> headers) { | |||||
| * If it is not specified then use {@link ClientConfig#getDatabase()}. | ||||||
| * @param precision The precision to use for the timestamp of points. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| * If it is not specified then use {@link ClientConfig#getWritePrecision()}. | ||||||
| * This setting is ignored when writing {@link com.influxdb.v3.client.Point}; | ||||||
| * for those writes, the client always sends {@link WritePrecision#NS} | ||||||
| * precision to the server. | ||||||
| * @param gzipThreshold The threshold for compressing request body. | ||||||
|
Comment on lines
199
to
204
|
||||||
| * If it is not specified then use {@link WriteOptions#DEFAULT_GZIP_THRESHOLD}. | ||||||
| * @param defaultTags Default tags to be added when writing points. | ||||||
|
|
@@ -209,6 +223,9 @@ public WriteOptions(@Nullable final String database, | |||||
| * If it is not specified then use {@link ClientConfig#getDatabase()}. | ||||||
| * @param precision The precision to use for the timestamp of points. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| * If it is not specified then use {@link ClientConfig#getWritePrecision()}. | ||||||
| * This setting is ignored when writing {@link com.influxdb.v3.client.Point}; | ||||||
| * for those writes, the client always sends {@link WritePrecision#NS} | ||||||
| * precision to the server. | ||||||
| * @param gzipThreshold The threshold for compressing request body. | ||||||
|
Comment on lines
224
to
229
|
||||||
| * If it is not specified then use {@link WriteOptions#DEFAULT_GZIP_THRESHOLD}. | ||||||
| * @param noSync Skip waiting for WAL persistence on write. | ||||||
|
|
@@ -234,6 +251,9 @@ public WriteOptions(@Nullable final String database, | |||||
| * If it is not specified then use {@link ClientConfig#getDatabase()}. | ||||||
| * @param precision The precision to use for the timestamp of points. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| * If it is not specified then use {@link ClientConfig#getWritePrecision()}. | ||||||
| * This setting is ignored when writing {@link com.influxdb.v3.client.Point}; | ||||||
| * for those writes, the client always sends {@link WritePrecision#NS} | ||||||
| * precision to the server. | ||||||
| * @param gzipThreshold The threshold for compressing request body. | ||||||
|
NguyenHoangSon96 marked this conversation as resolved.
|
||||||
| * If it is not specified then use {@link WriteOptions#DEFAULT_GZIP_THRESHOLD}. | ||||||
| * @param noSync Skip waiting for WAL persistence on write. | ||||||
|
|
@@ -265,6 +285,9 @@ public WriteOptions(@Nullable final String database, | |||||
| * If it is not specified then use {@link ClientConfig#getDatabase()}. | ||||||
| * @param precision The precision to use for the timestamp of points. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| * If it is not specified then use {@link ClientConfig#getWritePrecision()}. | ||||||
| * This setting is ignored when writing {@link com.influxdb.v3.client.Point}; | ||||||
| * for those writes, the client always sends {@link WritePrecision#NS} | ||||||
| * precision to the server. | ||||||
| * @param gzipThreshold The threshold for compressing request body. | ||||||
|
NguyenHoangSon96 marked this conversation as resolved.
|
||||||
| * If it is not specified then use {@link WriteOptions#DEFAULT_GZIP_THRESHOLD}. | ||||||
| * @param noSync Skip waiting for WAL persistence on write. | ||||||
|
|
@@ -307,6 +330,9 @@ public WriteOptions(@Nullable final String database, | |||||
| * If it is not specified then use {@link ClientConfig#getDatabase()}. | ||||||
| * @param precision The precision to use for the timestamp of points. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| * If it is not specified then use {@link ClientConfig#getWritePrecision()}. | ||||||
| * This setting is ignored when writing {@link com.influxdb.v3.client.Point}; | ||||||
| * for those writes, the client always sends {@link WritePrecision#NS} | ||||||
| * precision to the server. | ||||||
| * @param gzipThreshold The threshold for compressing request body. | ||||||
|
NguyenHoangSon96 marked this conversation as resolved.
|
||||||
| * If it is not specified then use {@link WriteOptions#DEFAULT_GZIP_THRESHOLD}. | ||||||
| * @param noSync Skip waiting for WAL persistence on write. | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -412,7 +412,10 @@ void writePointWithDefaultWriteOptionsCustomConfig() throws Exception { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| client.writePoint(point); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| checkWriteCalled("/api/v3/write_lp", "DB", "second", true, "true", null, true); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // When writing Point, precision sent to the server is always nanosecond | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var expectedPrecision = "nanosecond"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| checkWriteCalled("/api/v3/write_lp", "DB", expectedPrecision, true, "true", null, true); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Test | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -447,7 +450,10 @@ void writePointsWithDefaultWriteOptionsCustomConfig() throws Exception { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| client.writePoints(List.of(point)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| checkWriteCalled("/api/v3/write_lp", "DB", "second", true, "true", null, true); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // When writing Point, precision sent to the server is always nanosecond | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var expectedPrecision = "nanosecond"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| checkWriteCalled("/api/v3/write_lp", "DB", expectedPrecision, true, "true", null, true); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should improve coverage of fixed logic by unit tests.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private void checkWriteCalled(final String expectedPath, final String expectedDB, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just remove a word to avoid a bit confusing contradiction with the sentence that follows after it.