From a7290f48549698fed946d1fd2b7cb8402ed9a052 Mon Sep 17 00:00:00 2001 From: nieznanysprawiciel Date: Mon, 22 Nov 2021 17:41:26 +0100 Subject: [PATCH] Add metric to count number of calls to accept_invoice with not enough funds (#1700) --- core/payment/src/api/invoices.rs | 2 ++ core/payment/src/service.rs | 1 + 2 files changed, 3 insertions(+) diff --git a/core/payment/src/api/invoices.rs b/core/payment/src/api/invoices.rs index b6c7d3744e..e0777e0568 100644 --- a/core/payment/src/api/invoices.rs +++ b/core/payment/src/api/invoices.rs @@ -394,6 +394,8 @@ async fn accept_invoice( "Not enough funds. Allocated: {} Needed: {}", allocation.remaining_amount, amount_to_pay ); + + counter!("payment.invoices.requestor.not-enough-funds", 1); return response::bad_request(&msg); } diff --git a/core/payment/src/service.rs b/core/payment/src/service.rs index 3bf5df5b99..58fff851ea 100644 --- a/core/payment/src/service.rs +++ b/core/payment/src/service.rs @@ -69,6 +69,7 @@ mod local { counter!("payment.invoices.provider.paid", 0); counter!("payment.invoices.provider.accepted", 0); counter!("payment.invoices.provider.accepted.call", 0); + counter!("payment.invoices.requestor.not-enough-funds", 0); counter!("payment.amount.received", 0, "platform" => "erc20-rinkeby-tglm"); counter!("payment.amount.received", 0, "platform" => "erc20-mainnet-glm");