Răsfoiți Sursa

Merge pull request #16833 from overleaf/bg-google-spam-add-email-metrics

Include email type and rate-limit status in metrics

GitOrigin-RevId: eb5645e68d9ee3571d04b87b2c0fc09f9caa126a
Brian Gough 2 ani în urmă
părinte
comite
9702b36c64

+ 1 - 1
services/web/app/src/Features/Email/EmailHandler.js

@@ -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) {

+ 5 - 1
services/web/app/src/Features/Email/EmailSender.js

@@ -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(
         {