Include email type and rate-limit status in metrics GitOrigin-RevId: eb5645e68d9ee3571d04b87b2c0fc09f9caa126a
@@ -22,7 +22,7 @@ async function sendEmail(emailType, opts) {
opts.html = email.html
opts.text = email.text
opts.subject = email.subject
- await EmailSender.promises.sendEmail(opts)
+ await EmailSender.promises.sendEmail(opts, emailType)
}
function sendDeferredEmail(emailType, opts, delay) {
@@ -66,9 +66,13 @@ function getClient() {
return client
-async function sendEmail(options) {
+async function sendEmail(options, emailType) {
try {
const canContinue = await checkCanSendEmail(options)
+ metrics.inc('email_status', {
+ status: canContinue ? 'sent' : 'rate_limited',
+ path: emailType,
+ })
if (!canContinue) {
logger.debug(
{