Skip to content

How to delete automatically data of clickhouse shard #50

Answered by apetruhin
secuofme asked this question in Q&A
Discussion options

You must be logged in to vote

@secuofme, please check the TTL setting of the otel_traces table:

SHOW CREATE TABLE otel_traces;
CREATE TABLE default.otel_traces
(
    `Timestamp` DateTime64(9) CODEC(Delta(8), ZSTD(1)),
...
 INDEX idx_duration Duration TYPE minmax GRANULARITY 1
)
ENGINE = MergeTree
PARTITION BY toDate(Timestamp)
ORDER BY (ServiceName, SpanName, toUnixTimestamp(Timestamp), TraceId)
TTL toDateTime(Timestamp) + toIntervalDay(7)
...

Changing opentelemetry-collector.config.exporters.clickhouse.ttl_days doesn't affect the otel_traces table if it already exists.

You can alter the table yourself:

ALTER TABLE otel_traces MODIFY TTL toDateTime(Timestamp) + toIntervalDay(3);

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
1 reply
@secuofme
Comment options

Answer selected by secuofme
Comment options

You must be logged in to vote
5 replies
@secuofme
Comment options

@secuofme
Comment options

@apetruhin
Comment options

@secuofme
Comment options

@apetruhin
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants