outposts: add expected outpost replica count to metrics

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-09-04 15:56:57 +02:00
parent 37c29a073e
commit b7ef076798

View file

@ -15,7 +15,7 @@ from authentik.core.channels import AuthJsonConsumer
from authentik.outposts.models import OUTPOST_HELLO_INTERVAL, Outpost, OutpostState from authentik.outposts.models import OUTPOST_HELLO_INTERVAL, Outpost, OutpostState
GAUGE_OUTPOSTS_CONNECTED = Gauge( GAUGE_OUTPOSTS_CONNECTED = Gauge(
"authentik_outposts_connected", "Currently connected outposts", ["outpost", "uid"] "authentik_outposts_connected", "Currently connected outposts", ["outpost", "uid", "expected"]
) )
GAUGE_OUTPOSTS_LAST_UPDATE = Gauge( GAUGE_OUTPOSTS_LAST_UPDATE = Gauge(
"authentik_outposts_last_update", "authentik_outposts_last_update",
@ -76,6 +76,7 @@ class OutpostConsumer(AuthJsonConsumer):
GAUGE_OUTPOSTS_CONNECTED.labels( GAUGE_OUTPOSTS_CONNECTED.labels(
outpost=self.outpost.name, outpost=self.outpost.name,
uid=self.last_uid, uid=self.last_uid,
expected=self.outpost.config.kubernetes_replicas,
).dec() ).dec()
LOGGER.debug( LOGGER.debug(
"removed outpost instance from cache", "removed outpost instance from cache",
@ -100,6 +101,7 @@ class OutpostConsumer(AuthJsonConsumer):
GAUGE_OUTPOSTS_CONNECTED.labels( GAUGE_OUTPOSTS_CONNECTED.labels(
outpost=self.outpost.name, outpost=self.outpost.name,
uid=self.last_uid, uid=self.last_uid,
expected=self.outpost.config.kubernetes_replicas,
).inc() ).inc()
LOGGER.debug( LOGGER.debug(
"added outpost instace to cache", "added outpost instace to cache",