Skip to content

Inconsistent handling of retention policies in single vs batch points #373

Open
@nebehr

Description

@nebehr

There is no way to write single points to a default retention policy in case it is not named "autogen". The following code will fail:

InfluxDB influxDB = influxDB.setDatabase("mydb");
influxDB.write(Point.measurement("msmt").tag("tag", "x").addField("field", 42).build());

Expected behaviour is to omit retention policy in the queries to InfluxDB if user did not explicitly specified it.

On the other hand, BatchPoints do support default retention policy but if any other RP is to be used, it has to be set on BatchPoints separately and the value set upon the client initialization is ignored:

InfluxDB influxDB = influxDB.setDatabase("mydb").setRetentionPolicy("non_default_rp");
influxDB.write(BatchPoints.database("mydb").tag("tag", "x").addField("field", 42).build());
  • points from the batch get written to the default RP. Perhaps it makes sense to make a getter for BatchPoints.Builder in InfluxDB - this way database and retention policy would be automatically populated from the client instance.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions