mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-25 02:00:10 +02:00
Merge pull request #16833 from overleaf/bg-google-spam-add-email-metrics
Include email type and rate-limit status in metrics GitOrigin-RevId: eb5645e68d9ee3571d04b87b2c0fc09f9caa126a
This commit is contained in:
@@ -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(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user