From 50d321ab881ca76a658f03ff9f2b5d8747d456ec Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Sat, 1 Jun 2024 18:22:20 +0000 Subject: [PATCH] Add a more generic checked-in-purchase metric --- apps/metrics.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/metrics.py b/apps/metrics.py index 7375a8866..a7fc00091 100644 --- a/apps/metrics.py +++ b/apps/metrics.py @@ -42,6 +42,8 @@ def collect(self): emf_purchases = GaugeMetricFamily( "emf_purchases", "Tickets purchased", labels=["product", "state", "type"] ) + emf_checked_in_purchases = GaugeMetricFamily( + "emf_checked_in_purchases", "Purchases by checkin state", labels=["product", "type", "checked_in"]) emf_payments = GaugeMetricFamily("emf_payments", "Payments received", labels=["provider", "state"]) emf_attendees = GaugeMetricFamily("emf_attendees", "Attendees", labels=["checked_in"]) emf_proposals = GaugeMetricFamily("emf_proposals", "CfP Submissions", labels=["type", "state"]) @@ -60,6 +62,13 @@ def collect(self): Purchase.state, Purchase.type, ) + gauge_groups( + emf_checked_in_purchases, + Purchase.query.join(Product), + Product.name, + Purchase.type, + cast(Purchase.redeemed, String), + ) gauge_groups(emf_payments, Payment.query, Payment.provider, Payment.state) gauge_groups( emf_attendees, @@ -133,6 +142,7 @@ def collect(self): return [ emf_purchases, + emf_checked_in_purchases, emf_payments, emf_attendees, emf_proposals,