Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Clarify datapoint retention docs to match purge behaviour (#3442)

Rich Turnerdd45b9ff3dbe
diff --git a/README.md b/README.md
index 9d936710d..1f06f5faf 100644
--- a/README.md
+++ b/README.md
@@ -70,7 +70,7 @@ Try creating assets, agents, rules, users, realms, etc. using the Manager UI, pl
## Where's the data stored?
Persistent data is stored in a PostgreSQL DB which is stored in the `openremote_postgresql-data` docker volume which is durably stored independently of the running containers (see all with `docker volume ls`).
-Note that historical attribute data is purged daily based on value of `OR_DATA_POINTS_MAX_AGE_DAYS`; this value can also be overridden for individual attributes by using the `dataPointsMaxAgeDays` configuration item.
+Note that historical attribute data is kept indefinitely by default; set `OR_DATA_POINTS_MAX_AGE_WEEKS` to purge data older than the given number of weeks.
See the [Developer Guide](https://docs.openremote.io/docs/developer-guide/system-administration/#backuprestore) for details on making backups of the database.
## OpenTelemetry tracing
diff --git a/manager/src/main/java/org/openremote/manager/datapoint/AssetDatapointService.java b/manager/src/main/java/org/openremote/manager/datapoint/AssetDatapointService.java
index da1650bb7..0dffdb134 100644
--- a/manager/src/main/java/org/openremote/manager/datapoint/AssetDatapointService.java
+++ b/manager/src/main/java/org/openremote/manager/datapoint/AssetDatapointService.java
@@ -64,7 +64,7 @@ import org.postgresql.copy.CopyManager;
/**
* Store and retrieve datapoints for asset attributes and periodically purge data points using
* TimescaleDB's {@code drop_chunks()} with week-based retention aligned to 7-day chunk intervals.
- * Retention defaults to inifinite.
+ * Retention defaults to infinite.
*/
public class AssetDatapointService extends AbstractDatapointService<AssetDatapoint>
implements ProtocolDatapointService {
diff --git a/model/src/main/java/org/openremote/model/value/MetaItemType.java b/model/src/main/java/org/openremote/model/value/MetaItemType.java
index e703a8129..723ed7a10 100644
--- a/model/src/main/java/org/openremote/model/value/MetaItemType.java
+++ b/model/src/main/java/org/openremote/model/value/MetaItemType.java
@@ -97,13 +97,15 @@ public final class MetaItemType {
new MetaItemDescriptor<>("storeDataPoints", ValueType.BOOLEAN);
/**
- * How long to store attribute values in time series database (data older than this will be
- * automatically purged).
+ * Previously set how long to store attribute values in the time series database (data older than
+ * this would have been automatically purged).
*
* @deprecated Per-attribute retention is no longer supported. Purging now uses TimescaleDB
* drop_chunks with a global week-based retention period configured via
- * OR_DATA_POINTS_MAX_AGE_WEEKS. This meta item is retained for backward compatibility but has
- * no effect.
+ * OR_DATA_POINTS_MAX_AGE_WEEKS. For backward compatibility, the largest value of this meta
+ * item across all attributes (rounded up to whole weeks) is used as a minimum for the global
+ * retention period, so it can only extend how long data is kept for all attributes; it never
+ * shortens it and has no effect when purging is disabled.
*/
@Deprecated
public static final MetaItemDescriptor<Integer> DATA_POINTS_MAX_AGE_DAYS =
diff --git a/profile/deploy.yml b/profile/deploy.yml
index a1132a388..ecb9c6649 100644
--- a/profile/deploy.yml
+++ b/profile/deploy.yml
@@ -358,9 +358,9 @@ services:
# relative paths are resolved relative to OR_STORAGE_DIR
OR_KEYCLOAK_GRANT_FILE:
- # Configure the default max age for data points stored in the database (individual attributes can use a custom
- # value by using the DATA_POINTS_MAX_AGE_DAYS AssetMeta item).
- # OR_DATA_POINTS_MAX_AGE_DAYS: 30
+ # Configure the max age in weeks for data points stored in the database; data points are kept indefinitely when
+ # not set. The deprecated OR_DATA_POINTS_MAX_AGE_DAYS is still used (rounded up to weeks) when this is not set.
+ # OR_DATA_POINTS_MAX_AGE_WEEKS: 4
# Configure the limit of data points that can be queried.
# Defaults to 100.000. When set to 0, it disables the limit.