How could I trucate data after pull in Java client.

24 views
Skip to first unread message

Hello Wood

unread,
Aug 12, 2022, 4:36:23 AM8/12/22
to Prometheus Users
Hi, I using Prometheus to collect Spring Boot service metrics in Java. But I found a problem that data still exsit after pull, that made the instant data is not correct. 

Like at now there has one label like 'app_version{version=a} 100', then the metrics updated, and add a new label value b, the metrics come to 'app_version{version=a} 50' and 'app_version{version=b} 50'; Then, label a no longer update, and metrics come to 'app_version{version=b} 100'.

When I pull metrics form Spring Boot service, the metrics is 'app_version{version=a} 50' and 'app_version{version=b} 100'. But expect data should be 'app_version{version=b} 100' only. 

How could I fix this issue? Thanks.

Stuart Clark

unread,
Aug 12, 2022, 5:14:11 AM8/12/22
to Hello Wood, Prometheus Users
I think possibly you aren't using labels in the way expected.

Labels are used to "slice & dice" the data, so for example to be able to
see which specific HTTP response code was returned from a web call, etc.

What is the value of the metric app_version supposed to signify?

--
Stuart Clark

Hello Wood

unread,
Aug 14, 2022, 10:47:31 PM8/14/22
to Prometheus Users
Thanks very much.
I query data from anthor metrics system and handle it to prometheus format. Like my comment, the `app_version{version=a} ` is in changing, there will generate new label value and the old label value may not used anymore. But it still in query result.

Brian Candler

unread,
Aug 15, 2022, 3:30:25 AM8/15/22
to Prometheus Users
Each combination of metric name plus set of label names and values defines a new metric (timeseries).

If you change a label, then you're creating a new metric.  Not knowing the Java API, I'd suspect that you have to explicitly delete the old metric.

Reply all
Reply to author
Forward
0 new messages