Skip to content

Commit

Permalink
fix(chstorage): set TTL field
Browse files Browse the repository at this point in the history
  • Loading branch information
ernado committed Dec 17, 2024
1 parent 2e9d9f9 commit 22ac590
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/chstorage/_golden/schema.logs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ ENGINE = MergeTree
PARTITION BY toYYYYMMDD(timestamp)
ORDER BY (`severity_number`, `service_namespace`, `service_name`, `resource`, `timestamp`)
PRIMARY KEY (`severity_number`, `service_namespace`, `service_name`, `resource`)
TTL toDateTime(`timestamp`) + toIntervalSecond(259200)
1 change: 1 addition & 0 deletions internal/chstorage/_golden/schema.metrics_points.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ ENGINE = MergeTree
PARTITION BY toYYYYMMDD(timestamp)
ORDER BY (`name_normalized`, `mapping`, `resource`, `attribute`, `timestamp`)
PRIMARY KEY (`name_normalized`, `mapping`, `resource`, `attribute`)
TTL toDateTime(`timestamp`) + toIntervalSecond(259200)
1 change: 1 addition & 0 deletions internal/chstorage/_golden/schema.traces_spans.sql
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ CREATE TABLE IF NOT EXISTS `traces_spans`
ENGINE = MergeTree
ORDER BY (`service_namespace`, `service_name`, `resource`, `start`)
PRIMARY KEY (`service_namespace`, `service_name`, `resource`)
TTL toDateTime(`start`) + toIntervalSecond(259200)
1 change: 1 addition & 0 deletions internal/chstorage/columns_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func (c *logColumns) DDL() ddl.Table {
PartitionBy: "toYYYYMMDD(timestamp)",
PrimaryKey: []string{"severity_number", "service_namespace", "service_name", "resource"},
OrderBy: []string{"severity_number", "service_namespace", "service_name", "resource", "timestamp"},
TTL: ddl.TTL{Field: "timestamp"},
Indexes: []ddl.Index{
{
Name: "idx_trace_id",
Expand Down
1 change: 1 addition & 0 deletions internal/chstorage/columns_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func (c *pointColumns) DDL() ddl.Table {
PartitionBy: "toYYYYMMDD(timestamp)",
PrimaryKey: []string{"name_normalized", "mapping", "resource", "attribute"},
OrderBy: []string{"name_normalized", "mapping", "resource", "attribute", "timestamp"},
TTL: ddl.TTL{Field: "timestamp"},
Indexes: []ddl.Index{
{
Name: "idx_ts",
Expand Down
1 change: 1 addition & 0 deletions internal/chstorage/columns_traces.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ func (c *spanColumns) DDL() ddl.Table {
Engine: "MergeTree",
PrimaryKey: []string{"service_namespace", "service_name", "resource"},
OrderBy: []string{"service_namespace", "service_name", "resource", "start"},
TTL: ddl.TTL{Field: "start"},
Indexes: []ddl.Index{
{
Name: "idx_trace_id",
Expand Down

0 comments on commit 22ac590

Please sign in to comment.