Skip to content

Commit 26f0013

Browse files
authored
[ez][CH] Fix infra_metrics.cloud.watch_metrics schema: use DateTime64 (#6909)
The timestamp used by cloudwatch has milliseconds, so change the timestamp field to match that Testing: replaced the old table, then ran `python tools/rockset_migration/s32ch.py --clickhouse-table "infra_metrics.cloudwatch_metrics" --stored-data t.json --s3-bucket fbossci-cloudwatch-metrics --s3-prefix ghci-related `
1 parent a87d94b commit 26f0013

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

aws/lambda/clickhouse-replicator-s3/lambda_function.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ def cloudwatch_metrics_adapter(table, bucket, key):
552552
`namespace` LowCardinality(String),
553553
`metric_name` LowCardinality(String),
554554
`dimensions` Map(String, String),
555-
`timestamp` DateTime,
555+
`timestamp` DateTime64,
556556
`value` Tuple(
557557
max Float32,
558558
min Float32,

clickhouse_db_schema/infra_metrics.cloudwatch_metrics/schema.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ CREATE TABLE infra_metrics.cloudwatch_metrics
66
`namespace` LowCardinality(String),
77
`metric_name` LowCardinality(String),
88
`dimensions` Map(String, String),
9-
`timestamp` DateTime,
9+
`timestamp` DateTime64,
1010
`value` Tuple(
1111
max Float32,
1212
min Float32,
@@ -20,5 +20,5 @@ CREATE TABLE infra_metrics.cloudwatch_metrics
2020
ENGINE = SharedMergeTree('/clickhouse/tables/{uuid}/{shard}', '{replica}')
2121
PARTITION BY toYYYYMM(timestamp)
2222
ORDER BY (namespace, metric_name, timestamp, dimensions)
23-
TTL timestamp + toIntervalMonth(12)
23+
TTL toDateTime(timestamp) + toIntervalMonth(12)
2424
SETTINGS index_granularity = 8192

0 commit comments

Comments
 (0)