monitor gifts

patron-gift
Thibault Duplessis 2021-06-05 15:04:45 +02:00
parent 3ac7448211
commit 4762285f8a
2 changed files with 9 additions and 3 deletions

View File

@ -411,9 +411,14 @@ object mon {
val percent = gauge("plan.percent").withoutTags()
object charge {
def first(service: String) = counter("plan.charge.first").withTag("service", service)
def countryCents(country: String, currency: java.util.Currency, service: String) =
def countryCents(country: String, currency: java.util.Currency, service: String, gift: Boolean) =
histogram("plan.charge.country.cents").withTags(
Map("country" -> country, "currency" -> currency.getCurrencyCode, "service" -> service)
Map(
"country" -> country,
"currency" -> currency.getCurrencyCode,
"service" -> service,
"gift" -> gift
)
)
}
}

View File

@ -424,7 +424,8 @@ final class PlanApi(
.countryCents(
country = country.fold("unknown")(_.code),
currency = charge.money.currency,
service = charge.serviceName
service = charge.serviceName,
gift = charge.giftTo.isDefined
)
.record(charge.usd.cents)
charge.userId ?? { userId =>