came up with the following
label_replace(group by (instance) (agent_build_info), "instance", '$1', 
"instance", '(.+):12345')

On Thursday, August 24, 2023 at 3:37:40 PM UTC-4 Richie wrote:

> Brian your suggestions ultimately helped as it introduced me a new 
> concept.  I don't think I conveyed what I wanted properly.   Put another 
> way I was looking for  'a list of unique values for the key "instance".  
> Still not sure if that's the best way to articulate it.
>
> Based on your suggestions this is what I came up with
> group by (instance) (agent_build_info)
>
> Ideally the port ':12345' could be stripped, but what is generated from 
> the above is plenty sufficient.
>
> Thanks for the help.
>
> On Thursday, August 24, 2023 at 2:04:26 PM UTC-4 Brian Candler wrote:
>
>> Aha, I just discovered you can do:
>>
>> count without (instance, job) (agent_build_info)
>> group without (instance, job) (agent_build_info)
>>
>> That should be what you want :-)
>>
>> On Thursday, 24 August 2023 at 18:59:24 UTC+1 Brian Candler wrote:
>>
>>> If you are happy to list all the labels of interest (i.e. everything 
>>> apart from the 'job' and 'instance' labels and any other labels you've 
>>> added yourself):
>>>
>>> count by (goversion,version,branch,revision) (agent_build_info)
>>>
>>> Or you can use "group by" instead of "count by" to get a value of 1 for 
>>> everything (although personally I think the counts are useful!)
>>>
>>> On Thursday, 24 August 2023 at 16:05:17 UTC+1 Richie wrote:
>>>
>>>> or i suppose i could process the results as they come from the api via 
>>>> python
>>>>
>>>> On Thursday, August 24, 2023 at 10:59:18 AM UTC-4 Richie wrote:
>>>>
>>>>> I would like to pull a line by line list of unique instances from 
>>>>> agent_build_info and save it to a file for the purpose of cross checking 
>>>>> via script against a list of known instances that should be monitored 
>>>>> (reporting purposes).
>>>>>
>>>>> so in short is it possible to create a query that equivalent of *select 
>>>>> distinct instance from agent_build_info --(were it a traditional table) *
>>>>> ?
>>>>>
>>>>> -Richie
>>>>>
>>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/ba9bc319-701b-4d67-b72a-1a468876b858n%40googlegroups.com.

Reply via email to