Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

django-otel-smtp-backend

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

django-otel-smtp-backend

Wraps the default Django SMTP Email Backend with trace instrumentation to the OpenTelemetry

  • 0.0.4
  • PyPI
  • Socket score

Maintainers
1

Wraps the default Django SMTP Email Backend with trace instrumentation to the OpenTelemetry.

PyPI - Version License

Description

This small package provides a wrapper for the default django.core.mail.backends.smtp.EmailBackend adapter to provide better tracing instrumentation for OpenTelemetry.

Dependencies

  • django >= 4.2
  • opentelemetry-api

Usage

Installation

Install, from PyPI, using your package manager:

pip install django-otel-smtp-backend

Configuration

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.

OpenTelemetry

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.

Span Attributes

send_messages
attributedescription
raisedindicate if the send_messages() method raises a exception.
stackstack trace of the raised exception (when raised=True).
open
attributedescription
connection_already_openindicate if the connection is already opened when open() is called.
connection_openedindicate if the connection is opened.
fail_silentlyindicate if the used value of fail_silently property.
raisedindicate if the open() method raises a exception.
stackstack trace of the raised exception (when raised=True).
send_message_item
attributedescription
from_emailthe origin email.
recipientsthe destination email's.
sentindicate if the email is sent.
raisedindicate if the method raises a exception.
stackstack trace of the raised exception (when raised=True).
close
attributedescription
has_connectionindicate if the connection is opened when call close().
raisedindicate if the open() method raises a exception.
stackstack trace of the raised exception (when raised=True).

Keywords

FAQs


Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc