feat: Provide metrics for failed donations, after webhook receipt but before telling CiviCRM
As per the conversation in #116 (closed) (and other related conversations elsewhere), it was determined that metrics being generated by failed transactions were insufficient for keeping tabs on card testing and similar bad user behavior.
This MR adds the metric donate_vendor_transaction_count
to tordonate.prometheus
and gives it the labels status
, type
and vendor
. Whenever donate-neo
receives a webhook, validates it, and determines that it contains specific information about the fate of the attempted donation, we now increment donate_vendor_transaction_count
and describe the event using the labels.
Here is some sample output from localhost/metrics
:
# HELP donate_vendor_transaction_count_total Number of transactions processed by vendor
# TYPE donate_vendor_transaction_count_total counter
donate_vendor_transaction_count_total{status="success",type="single",vendor="stripe"} 1.0
donate_vendor_transaction_count_total{status="failure",type="single",vendor="stripe"} 2.0
Closes #116 (closed).