PapaPingouin
PapaPingouin

Reputation: 31

Prometheus, how to convert counter to gauge

I’ve a custom metric that change of type in the metric file (mistake from developper).

So I’ve start to scrap metrics as counter, but it is really a gauge. We have change in the metric file, but prometheus continue as it is a counter.

I’ve try to delete serie like this :

remove scrap from config restart prometheus delete serie from api http://localhost:9090/api/v1/admin/tsdb/delete_series?match%5B%5D= 1… http://localhost:9090/api/v1/admin/tsdb/clean_tombstones 1
restart prometheus
→ data empty, but serie name exists add scrap to config restart prometheus
→ new data scrapping, but old counter type and value continue to increment That work fine to clean data, but the serie stay work as a counter (and it has not reset the counter).

I can’t change the serie name (due to application obligations).

Is it a solution to fully remove a serie (values, history, config, type) and recreate it with a new scrap ?

Thanks

Upvotes: 3

Views: 1782

Answers (1)

Bubunyo Nyavor
Bubunyo Nyavor

Reputation: 2570

Wrap your metric with the increase function.

Upvotes: 1

Related Questions