Package io.openems.shared.influxdb.proxy
Class InfluxQlProxy
java.lang.Object
io.openems.shared.influxdb.proxy.QueryProxy
io.openems.shared.influxdb.proxy.InfluxQlProxy
Implements queries using InfluxQL, which is reported to be faster than Flux:
https://github.com/influxdata/influxdb/issues/18088.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
static final record
Nested classes/interfaces inherited from class io.openems.shared.influxdb.proxy.QueryProxy
QueryProxy.RandomLimit
-
Field Summary
Fields inherited from class io.openems.shared.influxdb.proxy.QueryProxy
AVAILABLE_SINCE_COLUMN_NAME, AVAILABLE_SINCE_MEASUREMENT, CHANNEL_TAG, queryLimit, tag
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
buildFetchAvailableSinceQuery
(String bucket) protected String
buildFetchFirstValueBefore
(String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime date, Set<ChannelAddress> channels) protected String
buildHistoricDataQuery
(String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels, Resolution resolution) buildHistoricEnergyPerPeriodQuery
(String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels, Resolution resolution) protected String
buildHistoricEnergyPerPeriodQuerySingleValueInDay
(String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels, Resolution resolution) buildHistoricEnergyQuery
(String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels) protected String
buildHistoricEnergyQuerySingleValueInDay
(String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels) queryAvailableSince
(InfluxConnector.InfluxConnection influxConnection, String bucket) Queries the available since fields from the database.SortedMap
<ChannelAddress, com.google.gson.JsonElement> queryFirstValueBefore
(String bucket, InfluxConnector.InfluxConnection influxConnection, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime date, Set<ChannelAddress> channels) Queries the first values before the given date.SortedMap
<ZonedDateTime, SortedMap<ChannelAddress, com.google.gson.JsonElement>> queryHistoricData
(InfluxConnector.InfluxConnection influxConnection, String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels, Resolution resolution) SortedMap
<ChannelAddress, com.google.gson.JsonElement> queryHistoricEnergy
(InfluxConnector.InfluxConnection influxConnection, String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels) SortedMap
<ZonedDateTime, SortedMap<ChannelAddress, com.google.gson.JsonElement>> queryHistoricEnergyPerPeriod
(InfluxConnector.InfluxConnection influxConnection, String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels, Resolution resolution) SortedMap
<ChannelAddress, com.google.gson.JsonElement> queryHistoricEnergySingleValueInDay
(InfluxConnector.InfluxConnection influxConnection, String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels) Queries the historic energy values with a measurement which only has one value saved per day.SortedMap
<ZonedDateTime, SortedMap<ChannelAddress, com.google.gson.JsonElement>> queryRawHistoricEnergyPerPeriodSingleValueInDay
(InfluxConnector.InfluxConnection influxConnection, String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels, Resolution resolution) Queries the raw historic values without calculating the difference between two values also includes the first value before the time range to help calculating the differences.Methods inherited from class io.openems.shared.influxdb.proxy.QueryProxy
assertQueryLimit, flux, from, influxQl, isLimitReached
-
Constructor Details
-
InfluxQlProxy
-
-
Method Details
-
buildHistoricDataQuery
protected String buildHistoricDataQuery(String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels, Resolution resolution) throws OpenemsException - Specified by:
buildHistoricDataQuery
in classQueryProxy
- Throws:
OpenemsException
-
buildHistoricEnergyQuery
public String buildHistoricEnergyQuery(String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels) throws OpenemsException - Specified by:
buildHistoricEnergyQuery
in classQueryProxy
- Throws:
OpenemsException
-
buildHistoricEnergyQuerySingleValueInDay
protected String buildHistoricEnergyQuerySingleValueInDay(String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels) throws OpenemsException - Specified by:
buildHistoricEnergyQuerySingleValueInDay
in classQueryProxy
- Throws:
OpenemsException
-
buildHistoricEnergyPerPeriodQuery
public String buildHistoricEnergyPerPeriodQuery(String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels, Resolution resolution) throws OpenemsException - Specified by:
buildHistoricEnergyPerPeriodQuery
in classQueryProxy
- Throws:
OpenemsException
-
buildHistoricEnergyPerPeriodQuerySingleValueInDay
protected String buildHistoricEnergyPerPeriodQuerySingleValueInDay(String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels, Resolution resolution) throws OpenemsException - Specified by:
buildHistoricEnergyPerPeriodQuerySingleValueInDay
in classQueryProxy
- Throws:
OpenemsException
-
buildFetchAvailableSinceQuery
- Specified by:
buildFetchAvailableSinceQuery
in classQueryProxy
-
buildFetchFirstValueBefore
protected String buildFetchFirstValueBefore(String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime date, Set<ChannelAddress> channels) - Specified by:
buildFetchFirstValueBefore
in classQueryProxy