mirror of
https://github.com/simple-login/app.git
synced 2025-09-06 06:34:20 +08:00
Add main sentry trace to email handler
This commit is contained in:
parent
76f72a0b17
commit
fc12e5204d
1 changed files with 27 additions and 25 deletions
|
@ -2383,7 +2383,6 @@ class MailHandler:
|
||||||
return status.E404
|
return status.E404
|
||||||
|
|
||||||
@newrelic.agent.background_task()
|
@newrelic.agent.background_task()
|
||||||
@sentry_sdk.trace
|
|
||||||
def _handle(self, envelope: Envelope, msg: Message):
|
def _handle(self, envelope: Envelope, msg: Message):
|
||||||
start = time.time()
|
start = time.time()
|
||||||
|
|
||||||
|
@ -2403,6 +2402,7 @@ class MailHandler:
|
||||||
|
|
||||||
send_version_event("email_handler")
|
send_version_event("email_handler")
|
||||||
with create_light_app().app_context():
|
with create_light_app().app_context():
|
||||||
|
with sentry_sdk.start_transaction(op="email-handler", name="Process email"):
|
||||||
return_status = handle(envelope, msg)
|
return_status = handle(envelope, msg)
|
||||||
elapsed = time.time() - start
|
elapsed = time.time() - start
|
||||||
# Only bounce messages if the return-path passes the spf check. Otherwise black-hole it.
|
# Only bounce messages if the return-path passes the spf check. Otherwise black-hole it.
|
||||||
|
@ -2426,7 +2426,9 @@ class MailHandler:
|
||||||
)
|
)
|
||||||
|
|
||||||
SpamdResult.send_to_new_relic(msg)
|
SpamdResult.send_to_new_relic(msg)
|
||||||
newrelic.agent.record_custom_metric("Custom/email_handler_time", elapsed)
|
newrelic.agent.record_custom_metric(
|
||||||
|
"Custom/email_handler_time", elapsed
|
||||||
|
)
|
||||||
newrelic.agent.record_custom_metric("Custom/number_incoming_email", 1)
|
newrelic.agent.record_custom_metric("Custom/number_incoming_email", 1)
|
||||||
return return_status
|
return return_status
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue