Reg: query on api/v1/label/<name>/values

13 views
Skip to first unread message

RAJESH DASARI

unread,
Apr 26, 2020, 12:12:15 AM4/26/20
to promethe...@googlegroups.com
Hi,

We have a custom exporter which exports the interface counters and we
labelled all the interfaces with "port", in our environment we
add/delete some interfaces and vlans at runtime.


we query for the number of ports by using this command(curl
http://localhost:9090/api/v1/label/port/values), we use this ports as
reference for querying the metrics . But This command is listing the
ports which are removed from the system and exporter is also not
dumping any metrics for these ports. I see the old port values are
also retained .

Could you please suggest how to refresh port values or any other
better approach to find the current ports which the exporter is
collecting stats .


Thanks,
Rajesh Dasari.

Stuart Clark

unread,
Apr 26, 2020, 3:22:16 AM4/26/20
to RAJESH DASARI, promethe...@googlegroups.com
If you are just wanting current data, maybe use the query API instead?

--
Stuart Clark

Brian Candler

unread,
Apr 26, 2020, 4:50:55 AM4/26/20
to Prometheus Users
/api/v1/label/port/values returns data for old timeseries because:

(1) those timeseries do exist in the database - even though they might not have a value at the current instant - and you might want to draw graphs of them.
(2) you might have some active and some inactive timeseries both with the same label="value"

If you want to find all label values for active series only, then you can make an instant query for a specific metric and look at the labels returned:
/api/v1/query?query=foo

Just remember that if a particular endpoint has a glitch and is missed in a scrape, you won't see its labels.
Reply all
Reply to author
Forward
0 new messages