You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[+] support variable partition intervals in postgres sink (#1012)
* [+] allow to specify interval for Postgres partitioning
`admin.ensure_partition_metric_dbname_time()` acccepts now
partition_period interval. The naming format is 'YYYYMMDD' for intervals
bigger than 1 day and 'YYYYMMDD_HH24' for hour-based intervals.
The function finds the last available partition bound and creates
new partition based on it. So it's possible to use mixed length
partitions, possibly with scheduler based on monitored source and/or
metrics.
* Add new `PartitionInterval` cli parameter.
* Use `PartitionInterval` parameter in `EnsureMetricDbnameTime()`
* Mention `--partition-interval` in docs.
* Add validation logic for `PartitionInterval`
* Add test for `PartitionInterval` validation
* Test actual partitions creation
* Add example usage of `--partition-interval` in docs.
---------
Co-authored-by: Pavlo Golub <pavlo.golub@gmail.com>
Copy file name to clipboardExpand all lines: internal/sinks/cmdopts.go
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,7 @@ import "time"
6
6
typeCmdOptsstruct {
7
7
Sinks []string`long:"sink" mapstructure:"sink" description:"URI where metrics will be stored, can be used multiple times" env:"PW_SINK"`
8
8
BatchingDelay time.Duration`long:"batching-delay" mapstructure:"batching-delay" description:"Sink-specific batching flush delay; may be ignored by some sinks" default:"950ms" env:"PW_BATCHING_DELAY"`
9
+
PartitionIntervalstring`long:"partition-interval" mapstructure:"partition-interval" description:"Time range for PostgreSQL sink table partitions. Must be a valid PostgreSQL interval expression." default:"1 week" env:"PW_PARTITION_INTERVAL"`
9
10
Retentionstring`long:"retention" mapstructure:"retention" description:"If set, metrics older than that will be deleted" default:"14 days" env:"PW_RETENTION"`
10
11
RealDbnameFieldstring`long:"real-dbname-field" mapstructure:"real-dbname-field" description:"Tag key for real database name" env:"PW_REAL_DBNAME_FIELD" default:"real_dbname"`
11
12
SystemIdentifierFieldstring`long:"system-identifier-field" mapstructure:"system-identifier-field" description:"Tag key for system identifier value" env:"PW_SYSTEM_IDENTIFIER_FIELD" default:"sys_id"`
0 commit comments