-
Notifications
You must be signed in to change notification settings - Fork 132
Closed
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Milestone
Description
Proposal:
The Flux already has the elapsed function. But the Flux DSL is missing this function.
Current behavior:
There is no such function in the com.influxdb.query.dsl.Flux class.
Desired behavior:
I should be able to use the elapsed function, something like this:
Flux flux = Flux
.from("telegraf")
.groupBy("_measurement")
.elaspsed(); // the default unit is 1sAlternatives considered:
I can't see any alternatives.
Use case:
I am using this while I am building queries:
public static class ElapsedFunction extends AbstractParametrizedFlux {
public ElapsedFunction(final Flux source) {
super(source);
}
@NotNull
@Override
protected String operatorName() {
return "elapsed";
}
public ElapsedFunction withUnit(final Long amount,
@Nullable final ChronoUnit unit) {
this.withPropertyValue("unit", amount, unit);
return this;
}
}
final Flux query = Flux
.from(INFLUX_DB_CONTAINER.getBucket())
.withBucket(INFLUX_DB_CONTAINER.getBucket())
.range().withStart(Instant.now(clock).minus(1, ChronoUnit.HOURS)).withStop(Instant.now(clock).plus(1, ChronoUnit.HOURS))
.filter(Restrictions.measurement().equal("measurement"))
.filter(Restrictions.tag("someTag").equal("someValue"))
.groupBy("_value")
.function(ElapsedFunction.class).withUnit(1L, ChronoUnit.NANOS)
.group()
.quantile().withColumn("elapsed").withQuantile(0.9999f)YuriyZembekov
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers