
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
django-otel-smtp-backend
Advanced tools
Wraps the default Django SMTP Email Backend with trace instrumentation to the OpenTelemetry
Wraps the default Django SMTP Email Backend with trace instrumentation to the OpenTelemetry.
This small package provides a wrapper for the default django.core.mail.backends.smtp.EmailBackend
adapter to provide better tracing instrumentation for OpenTelemetry.
Install, from PyPI, using your package manager:
pip install django-otel-smtp-backend
Change the EMAIL_BACKEND
field on settings.py
file:
EMAIL_BACKEND = "django_otel_smtp_backend.backend.EmailBackend"
EMAIL_HOST = ...
EMAIL_USE_TLS = ...
EMAIL_PORT = ...
EMAIL_USE_SSL = ...
EMAIL_HOST_USER = ...
EMAIL_HOST_PASSWORD = ...
The configuration of OpenTelemetry
is not a subject of this readme.
The traces captured from the EmailBackend
is structured as shown below (the times was taken from a real example):
- send_messages (2.89s)
| - open (1.55s)
| - send_message_item (1.17s)
| - close (168.43ms)
The send_messages()
method from the BaseEmailBackend
receives various e-mails and, in SMTP backend, send one by one using a for-iterator (reference). The send_messages
span is opened when the send_messages()
method is called, the open
span is opened when the connection is opened and close
span is opened when the connection is closed. The send_message_item
span is opened when each e-mail is sent using the SMTP connection.
attribute | description |
---|---|
raised | indicate if the send_messages() method raises a exception. |
stack | stack trace of the raised exception (when raised=True). |
attribute | description |
---|---|
connection_already_open | indicate if the connection is already opened when open() is called. |
connection_opened | indicate if the connection is opened. |
fail_silently | indicate if the used value of fail_silently property. |
raised | indicate if the open() method raises a exception. |
stack | stack trace of the raised exception (when raised=True). |
attribute | description |
---|---|
from_email | the origin email. |
recipients | the destination email's. |
sent | indicate if the email is sent. |
raised | indicate if the method raises a exception. |
stack | stack trace of the raised exception (when raised=True). |
attribute | description |
---|---|
has_connection | indicate if the connection is opened when call close(). |
raised | indicate if the open() method raises a exception. |
stack | stack trace of the raised exception (when raised=True). |
FAQs
Wraps the default Django SMTP Email Backend with trace instrumentation to the OpenTelemetry
We found that django-otel-smtp-backend demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.