How to delete specific metrics
G-regL opened this issue · 2 comments
Hi there,
I recently wanted to delete a set of metrics which I was no longer using because I had rewritten their path with carbon-c-relay (telegraf.foo.bar.baz
became telegraf.foo.bam.baz
), but I suddenly realized I don't know how to do that with Clickhouse as the Graphite backend.
With go-carbon or the stock Graphite tools, it's as simple as deleting folders/files on disk, but with Clickhouse I'm not sure how to do it.
I figured issuing some ALTER TABLE
queries like below would clear out the metrics I didn't want, and any new ones would re-populate.
ALTER TABLE default.graphite_reverse DELETE Where like(Path,'%.telegraf');
ALTER TABLE default.graphite_index DELETE Where like(Path,'telegraf.%');
However, I now see that while graphite_reverse
has the new data I'd expect to see, graphite_index
doesn't have the entries required to query the system for the metrics in quesion.
I manually created some entries in graphite_index
for a few of the levels, and those paths now work, but I can't very well do it for all of them, since I have no idea when new ones will show up.
INSERT INTO graphite_index
VALUES
(toDate('1970-02-12'), 20001, 'telegraf.', toUInt32(now())),
(toDate('1970-02-12'), 20002, 'telegraf.foo.', toUInt32(now())),
(toDate('1970-02-12'), 20003, 'telegraf.foo.bam.', toUInt32(now())),
(toDate('1970-02-12'), 20004, 'telegraf.foo.bam.baz.', toUInt32(now()))
Shouldn't carbon-clickhouse
be re-populating the index with any new metrics seen, or have I just hit my first Graphite/Carbon/Clickhouse snag?
Shouldn't carbon-clickhouse be re-populating the index with any new metrics seen, or have I just hit my first Graphite/Carbon/Clickhouse snag?
Metric will be uploaded to clickhouse again after cache of index table is expired (12h by default). You can force cache cleanup with the USR1 signal