Remove images count (which is horribly slow in InnoDB) and add a max gauge

This commit is contained in:
Joseph Schorr 2017-02-23 17:21:17 -05:00
parent 0003022549
commit 407341fe96
2 changed files with 4 additions and 5 deletions

View file

@ -21,8 +21,8 @@ INDEXING_INTERVAL = 30
logger = logging.getLogger(__name__)
unscanned_images_gauge = prometheus.create_gauge('unscanned_images',
'Number of images that clair needs to scan.')
images_gauge = prometheus.create_gauge('all_images', 'Total number of images that clair can scan.')
max_unscanned_images_gauge = prometheus.create_gauge('max_unscanned_image_id',
'Max ID of the unscanned images.')
class SecurityWorker(Worker):
def __init__(self):
@ -49,6 +49,8 @@ class SecurityWorker(Worker):
if max_id is None:
return
max_unscanned_images_gauge.Set(max_id)
with UseThenDisconnect(app.config):
to_scan_generator = yield_random_entries(
batch_query,