There are several API handlers in VictoriaMetrics like /api/v1/labels, but as I can see there is no way to filter one label by another. Let's say I have following structure: Labels{ name, app, namespace, instance } where name is a metric, app is a service name. So I want to get all distinct metric names where app=service1. Can this be done using just VM's HTTP API?
The only idea I have is to get everything via /api/v1/query and perform some sorting and filtering with a lot of logic which seems to me like an AI invention? cause the query will return a huge amount of data even with timestamp not a range.
Can you try to use this example. I think it should solve your problem
curl -XGET -G 'http://localhost8428/api/v1/label/__name__/values --data-urlencode 'match[]={__name__=~".+", app="service1"}'
In that case, the response will be with all metric names which include label value pair like app="service1"
For example, my test request
curl -XGET -G 'http://localhost:8428/api/v1/label/__name__/values --data-urlencode 'match[]={__name__=~".+", job="vmselect"}'
returns something like this
{"status":"success","isPartial":false,"data":["flag","go_cgo_calls_count","go_cpu_count",...,"vm_zstd_block_compress_calls_total","vm_zstd_block_compressed_bytes_total","vm_zstd_block_decompress_calls_total","vm_zstd_block_original_bytes_total","vmselect_request_duration_seconds_bucket","vmselect_request_duration_seconds_count","vmselect_request_duration_seconds_sum"]}
There is all metrics name where is job="vmselect"
label value pair is present