Skip to content

Commit

Permalink
Common: Reformat rewrite for check-expired-dids
Browse files Browse the repository at this point in the history
  • Loading branch information
voetberg committed Aug 6, 2024
1 parent c5a6bb7 commit 60ec26a
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions common/check_expired_dids
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,24 @@ OK, WARNING, CRITICAL, UNKNOWN = 0, 1, 2, 3
if __name__ == "__main__":
try:
session = get_session()
with PrometheusPusher() as manager:
statement = select(
func.count()
).select_from(
models.DataIdentifier
).where(
and_(
models.DataIdentifier.expired_at != null(),
models.DataIdentifier.expired_at < datetime.utcnow()
)
statement = select(
func.count()
).select_from(
models.DataIdentifier
).where(
and_(
models.DataIdentifier.expired_at != null(),
models.DataIdentifier.expired_at < datetime.utcnow()
)
expired_dids = session.execute(statement).scalar_one()

)
expired_dids = session.execute(statement).scalar_one()
print(expired_dids)

with PrometheusPusher() as manager:
(manager.gauge(
'expired_dids.total',
documentation="All expired dids")
.set(expired_dids))

"expired_dids.total",
documentation="All expired dids")
.set(expired_dids))
except Exception:
print(traceback.format_exc())
sys.exit(UNKNOWN)
Expand Down

0 comments on commit 60ec26a

Please sign in to comment.