Unfortunately, the timeout can't be longer than the scrape interval,
firstly because this would require overlapping scrapes, and secondly the
results could be returned out-of-order: e.g.
xx:yy:00 scrape 1: takes 25 seconds, gives result at xx:yy:25
xx:yy:15 scrape 2: takes 5 seconds, gives result at xx:yy:20
> If I run two blackbox_probes in parallel with scrape_interval: 30s and
scrape_timeout: 30s this will work but both probes will start more or less
at the same time.
Actually I think you'll find they'd be evenly spread out over the scrape
interval - try it.
For example, make a single scrape job with a 60 second scrape interval, and
list the same target 4 times - but make sure you apply some distinct label
to each instance, so that they generate 4 separate timeseries. You can
then look at the raw timestamps in the database to check the actual scrape
times: easiest way is by using the PromQL web interface and supplying a
range vector query, like probe_success{instance="foo"}[5m]. This has to be
in table view, not graph view. Don't mix any other targets into that
scrape job, because they'll be spread together.
Alternatively, KISS: use a 15 second scrape interval, and simply accept
that "scrape failed" = "took longer than 15 seconds". Does it really matter
whether it was 20 seconds or 25 seconds? Can you get that information from
somewhere else if needed, e.g. web server logs?
On Tuesday 9 January 2024 at 10:04:42 UTC Alexander Wilke wrote:
> Hello,
> I want to use blackbox_exporter and http prober to login to an API.
>
> My goal is to do the login every 15s which could be
>
> xx:yy:00
> xx:yy:15
> xx:yy:30
> xx:yy:45
>
> I could solve this with scrape_interval: 15s.
> But in addition I want to allow a scrape timeout of 30s which is longer
> than the scrape_timeout.
>
> If I run two blackbox_probes in parallel with scrape_interval: 30s and
> scrape_timeout: 30s this will work but both probes will start more or less
> at the same time.
>
> xx:yy:00
> xx:yy:30
>
> The idea behind tha is:
> In general the API response for login is very fast. For whatever reason
> sometimes it takes 30s or more. I do not want the probe to just fail after
> 15s but want to see and understand how long a login request takes.
>
> If I abort a long lasting request or do a parellel login this may work
> very fast. So it is probably not a problem with the API in general but with
> specific user session or other unknown circumstances. So I want many scrape
> intervals but the imeout sometimes needs to be higher OR I need several
> blackbox_probes which do not start at the same time but are spread equally.
>
> Any ideas?
> Is this possible with prometheus 2.48.1 and blackbox_exporter 0.24.0 ?
>
>
>
>
--
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/a938d881-9a06-4b3c-b8b4-9495ea18f480n%40googlegroups.com.