Marcelo,
You are correct, I am looking for the (1+1+0+0+1+1)/6 = 67% value.
I tried the count_over_time as you explained above, however if prometheus
isn't collecting on a particular target then the count_over_time value
doesn't count the steps that are absent.  Following your example, I get 5
not 6.
Jennifer


On Wed, Jan 13, 2021 at 10:30 PM 'Marcelo Magallón' via Prometheus Users <
[email protected]> wrote:

> The problem with using avg_over_time for this is that it will ignore
> missing data points.
>
> If I understand Jennifer's request correctly, she's looking for a way to
> start with data like {timestamp, value}, say the following values:
>
> {0, 1}
> {10, 1}
> {20, 0}
> {40, 1}
> {50, 1}
>
> and consider the missing {30, x} as a 0.
>
> so in that example, avg_over_time would return (1+1+0+1+1)/5 = 80% and
> Jennifer wants (1+1+0+0+1+1)/6 = 67%
>
> My understanding of the original question is how to obtain the 6.
>
> The numerator is easy: sum_over_time.
>
> For the denominator the best I can come up with is:
> count_over_time((vector(1))[5m:]), which is a really weird way of asking
> "how many samples should there be in this range?"
>
> Marcelo
>
>
> On Wed, Jan 13, 2021 at 9:19 AM Ben Kochie <[email protected]> wrote:
>
>> If you're looking for a "percent of OK scrapes" you can use:
>>
>> avg_over_time(probe_success[$__range])
>>
>> Then in Grafana, you can select "Percent (0 - 1)" to display the ratio as
>> a percent.
>>
>> probe_success will always be returned by the blackbox_exporter is
>> functioning properly.
>>
>> On Tue, Jan 12, 2021 at 5:26 PM Jennifer K <[email protected]>
>> wrote:
>>
>>> Basically, I'm trying to fix an error that I am having when calculating
>>> the percent.  What i'm seeing:
>>> sometimes the number of "good" scrapes is higher/smaller than the number
>>> of scrapes in [$__range].  I think this is just because sometimes I get one
>>> extra scrape compared to the number [$__range] scrapes and sometimes it's
>>> spot on.  I can't have a dashboard that sometimes shows the right value.
>>> Therefore, trying to make this work and not show values over/under 100
>>> when the value should be 100%. I am trying to "fix" the denominator to be a
>>> value from a rule instead of the [$__range].
>>> to do this I know I have "successful/unsuccessful probes" and "absent
>>> data".  I can quantify the probes using "probe_success" but when adding the
>>> absent function to "probe_success" it doesn't work- I think it has
>>> something to do with the vectors being different which is why I was trying
>>> to use the ignore function.
>>>
>>> so... to answer your question-
>>> I would want to count scrapes over the specified interval to include
>>> absent data as well- basically if my scrape is set to 30s, an interval of 1
>>> hour should return 120 (to include successful/unsuccessful and absent data)
>>> what is the best algorithm to use for that?
>>> Thanks so much!
>>> Jennifer
>>>
>>> On Tue, Jan 12, 2021 at 9:40 AM Julius Volz <[email protected]>
>>> wrote:
>>>
>>>> Do you want to count across scraped instances at *one* point in time,
>>>> or do you want to count scrapes of a / each single instance *over* time?
>>>>
>>>> On Tue, Jan 12, 2021 at 1:10 AM Jennifer K <[email protected]>
>>>> wrote:
>>>>
>>>>> to anyone that can help...
>>>>> I've been trying to a total number of "scrapes" by adding successful,
>>>>> unsuccessful and absent points together
>>>>> this algorithm isn't working- any anyone explain why-
>>>>>
>>>>> (probe_success==bool 0) + (probe_success == bool 1) + ignoring
>>>>> (target) sum without (target) (absent (probe_success))
>>>>>
>>>>> should be simple, but I just can't get it to work- any help would
>>>>> greatly be appreciated.
>>>>> Thanks!
>>>>> Jennifer
>>>>>
>>>>> --
>>>>> 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/a8b8a4a0-59e7-4087-bba6-a54252ebafdcn%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/prometheus-users/a8b8a4a0-59e7-4087-bba6-a54252ebafdcn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>
>>>>
>>>> --
>>>> Julius Volz
>>>> PromLabs - promlabs.com
>>>>
>>> --
>>> 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/CAJ2Bn3q9xEADOb0r_nxOx4fXbGBYRo3tU%2B0nE8AtWD%2BqoiPCzw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/prometheus-users/CAJ2Bn3q9xEADOb0r_nxOx4fXbGBYRo3tU%2B0nE8AtWD%2BqoiPCzw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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/CABbyFmqyphKcJS2eK10CQkzz8t3D3t3LDtbyo%3D4%2BuomygXNC8A%40mail.gmail.com
>> <https://groups.google.com/d/msgid/prometheus-users/CABbyFmqyphKcJS2eK10CQkzz8t3D3t3LDtbyo%3D4%2BuomygXNC8A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> --
> Marcelo Magallón
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Prometheus Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/prometheus-users/B1dFucbIEmw/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/prometheus-users/CABiJYgY%2BcboQcV2r8z%3DueL7pL69X5YiXYmJ2D3KQtaQ2QJ61vg%40mail.gmail.com
> <https://groups.google.com/d/msgid/prometheus-users/CABiJYgY%2BcboQcV2r8z%3DueL7pL69X5YiXYmJ2D3KQtaQ2QJ61vg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAJ2Bn3p1seMKvwEu9EZg_b7yaLQVhLZRe6OSRyiBSPjPb8-Gpg%40mail.gmail.com.

Reply via email to