Adding in some metrics around clair sec scan.
This commit is contained in:
parent
2c637fe5ce
commit
edd9dcd7f6
4 changed files with 56 additions and 16 deletions
|
@ -1,10 +1,13 @@
|
|||
import logging
|
||||
import time
|
||||
import features
|
||||
|
||||
from app import app, metric_queue
|
||||
from data.database import UseThenDisconnect
|
||||
from data import model
|
||||
from data.model.image import total_image_count, get_count_of_images_eligible_for_scan
|
||||
from util.locking import GlobalLock, LockNotAcquiredException
|
||||
from workers.securityworker import unscanned_images_gauge, images_gauge
|
||||
from workers.worker import Worker
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -40,6 +43,13 @@ class GlobalPrometheusStatsWorker(Worker):
|
|||
metric_queue.org_count.Set(model.organization.get_active_org_count())
|
||||
metric_queue.robot_count.Set(model.user.get_robot_count())
|
||||
|
||||
if features.SECURITY_SCANNER:
|
||||
# Clair repo counts.
|
||||
unscanned_images_gauge.set(
|
||||
get_count_of_images_eligible_for_scan(app.config.get('SECURITY_SCANNER_ENGINE_VERSION_TARGET', 2))
|
||||
)
|
||||
images_gauge.set(total_image_count())
|
||||
|
||||
|
||||
def main():
|
||||
logging.config.fileConfig('conf/logging_debug.conf', disable_existing_loggers=False)
|
||||
|
|
Reference in a new issue