CustomCollector default 60s interval

15 views
Skip to first unread message

Duane Schultz

unread,
Jun 11, 2020, 12:49:59 AM6/11/20
to Prometheus Developers
I've written a CustomCollector to capture some device information via API calls. I'm registering my CustomCollector() code as follows;

   start_http_server(8000)
    REGISTRY.register(CustomCollector())
    while True:
        time.sleep(1)

The API calls I'm making to generate data are fairly expensive, and I only want to update the information every 5 minutes. I have Prometheus scraping this target at 5 minute intervals - that part is fine.

However, the CustomCollector code is being executed every 60 seconds, regardless of whether there has been a scrape request.

Is this default 60s interval configurable? I've looked through the register code in detail and browsed the client_python code but I haven't found anything significant.

Cheers,
Duane.

Brian Brazil

unread,
Jun 11, 2020, 4:14:16 AM6/11/20
to Duane Schultz, Prometheus Developers
On Thu, 11 Jun 2020 at 05:50, Duane Schultz <duane....@gmail.com> wrote:
I've written a CustomCollector to capture some device information via API calls. I'm registering my CustomCollector() code as follows;

   start_http_server(8000)
    REGISTRY.register(CustomCollector())
    while True:
        time.sleep(1)

The API calls I'm making to generate data are fairly expensive, and I only want to update the information every 5 minutes. I have Prometheus scraping this target at 5 minute intervals - that part is fine.

Note that 2m is the maximum sane scrape interval.
 
However, the CustomCollector code is being executed every 60 seconds, regardless of whether there has been a scrape request.

Is this default 60s interval configurable? I've looked through the register code in detail and browsed the client_python code but I haven't found anything significant.

There's nothing in the Python client that'd do this, I'd presume something else is hitting it over HTTP.

--
Reply all
Reply to author
Forward
0 new messages