Name | django-otel-smtp-backend JSON |
Version |
0.0.4
JSON |
| download |
home_page | None |
Summary | Wraps the default Django SMTP Email Backend with trace instrumentation to the OpenTelemetry |
upload_time | 2024-07-23 20:30:50 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | MIT License Copyright (c) 2024 Instituto Inventare Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
django
email
mail
smtp
open-telemetry
telemetry
otel
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
<p align="center">
Wraps the default Django SMTP Email Backend with trace instrumentation to the OpenTelemetry.
</p>
<p align="center">
<a href="https://pypi.org/project/django-otel-smtp-backend/" target="_blank"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/django-otel-smtp-backend"/></a>
<a href="https://github.com/inventare/django-otel-smtp-backend/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/github/license/inventare/django-otel-smtp-backend"/></a>
</p>
## 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:
```sh
pip install django-otel-smtp-backend
```
### Configuration
Change the `EMAIL_BACKEND` field on `settings.py` file:
```python
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](https://github.com/django/django/blob/main/django/core/mail/backends/smtp.py#L120)). 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
| attribute | description |
| ----------------- | ---------------------------------------------------------- |
| raised | indicate if the send_messages() method raises a exception. |
| stack | stack trace of the raised exception (when raised=True). |
#### open
| 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). |
#### send_message_item
| 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). |
#### close
| 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). |
Raw data
{
"_id": null,
"home_page": null,
"name": "django-otel-smtp-backend",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "Eduardo Oliveira <eduardo_y05@outlook.com>",
"keywords": "django, email, mail, smtp, open-telemetry, telemetry, otel",
"author": null,
"author_email": "Eduardo Oliveira <eduardo_y05@outlook.com>",
"download_url": "https://files.pythonhosted.org/packages/66/5f/4cbbc56fb14508a5074b3671a3bd07a7d7e358ec4da6b7b9247094d6f13c/django_otel_smtp_backend-0.0.4.tar.gz",
"platform": null,
"description": "<p align=\"center\">\n Wraps the default Django SMTP Email Backend with trace instrumentation to the OpenTelemetry.\n</p>\n\n<p align=\"center\">\n<a href=\"https://pypi.org/project/django-otel-smtp-backend/\" target=\"_blank\"><img alt=\"PyPI - Version\" src=\"https://img.shields.io/pypi/v/django-otel-smtp-backend\"/></a>\n<a href=\"https://github.com/inventare/django-otel-smtp-backend/blob/main/LICENSE\"><img alt=\"License\" src=\"https://img.shields.io/github/license/inventare/django-otel-smtp-backend\"/></a>\n</p>\n\n## Description\n\nThis small package provides a wrapper for the default `django.core.mail.backends.smtp.EmailBackend` adapter to provide better tracing instrumentation for OpenTelemetry.\n\n## Dependencies\n\n- django >= 4.2\n- opentelemetry-api\n\n## Usage\n\n### Installation\n\nInstall, from PyPI, using your package manager:\n\n```sh\npip install django-otel-smtp-backend\n```\n\n### Configuration\n\nChange the `EMAIL_BACKEND` field on `settings.py` file:\n\n```python\nEMAIL_BACKEND = \"django_otel_smtp_backend.backend.EmailBackend\"\nEMAIL_HOST = ...\nEMAIL_USE_TLS = ...\nEMAIL_PORT = ...\nEMAIL_USE_SSL = ...\nEMAIL_HOST_USER = ...\nEMAIL_HOST_PASSWORD = ...\n```\n\nThe configuration of `OpenTelemetry` is not a subject of this readme.\n\n## OpenTelemetry\n\nThe traces captured from the `EmailBackend` is structured as shown below (the times was taken from a real example):\n\n```\n - send_messages (2.89s)\n | - open (1.55s)\n | - send_message_item (1.17s)\n | - close (168.43ms)\n```\n\nThe `send_messages()` method from the `BaseEmailBackend` receives various e-mails and, in SMTP backend, send one by one using a for-iterator ([reference](https://github.com/django/django/blob/main/django/core/mail/backends/smtp.py#L120)). 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.\n\n### Span Attributes\n\n#### send_messages\n\n| attribute | description |\n| ----------------- | ---------------------------------------------------------- |\n| raised | indicate if the send_messages() method raises a exception. |\n| stack | stack trace of the raised exception (when raised=True). |\n\n#### open\n\n| attribute | description |\n| ----------------------- | ------------------------------------------------------------------- |\n| connection_already_open | indicate if the connection is already opened when open() is called. |\n| connection_opened | indicate if the connection is opened. |\n| fail_silently | indicate if the used value of fail_silently property. |\n| raised | indicate if the open() method raises a exception. |\n| stack | stack trace of the raised exception (when raised=True). |\n\n#### send_message_item\n\n| attribute | description |\n| ----------------------- | ------------------------------------------------------------------- |\n| from_email | the origin email. |\n| recipients | the destination email's. |\n| sent | indicate if the email is sent. |\n| raised | indicate if the method raises a exception. |\n| stack | stack trace of the raised exception (when raised=True). |\n\n#### close\n\n| attribute | description |\n| ----------------------- | ------------------------------------------------------------------- |\n| has_connection | indicate if the connection is opened when call close(). |\n| raised | indicate if the open() method raises a exception. |\n| stack | stack trace of the raised exception (when raised=True). |\n\n\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 Instituto Inventare Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "Wraps the default Django SMTP Email Backend with trace instrumentation to the OpenTelemetry",
"version": "0.0.4",
"project_urls": {
"documentation": "https://github.com/inventare/django-otel-smtp-backend",
"homepage": "https://github.com/inventare/django-otel-smtp-backend"
},
"split_keywords": [
"django",
" email",
" mail",
" smtp",
" open-telemetry",
" telemetry",
" otel"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "349c956b3b65c7ad22c95c3e4a3ae69d9eb78ebc73c63a2cd4568944d77da6b5",
"md5": "6186d7ab4c70f814e0eb7bbed3ed0b71",
"sha256": "c2865ee8366473a0a27c7de582ac86c51cb4e6aa2d4cbd49b97af6364e02c6aa"
},
"downloads": -1,
"filename": "django_otel_smtp_backend-0.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6186d7ab4c70f814e0eb7bbed3ed0b71",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 5420,
"upload_time": "2024-07-23T20:30:49",
"upload_time_iso_8601": "2024-07-23T20:30:49.128256Z",
"url": "https://files.pythonhosted.org/packages/34/9c/956b3b65c7ad22c95c3e4a3ae69d9eb78ebc73c63a2cd4568944d77da6b5/django_otel_smtp_backend-0.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "665f4cbbc56fb14508a5074b3671a3bd07a7d7e358ec4da6b7b9247094d6f13c",
"md5": "d6b7d2d74c5ee399be4128ed7336bab9",
"sha256": "d28d4e2925ad1b490b8531ad701eed80fb5758818254928b6df15ef0d51334f5"
},
"downloads": -1,
"filename": "django_otel_smtp_backend-0.0.4.tar.gz",
"has_sig": false,
"md5_digest": "d6b7d2d74c5ee399be4128ed7336bab9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 4660,
"upload_time": "2024-07-23T20:30:50",
"upload_time_iso_8601": "2024-07-23T20:30:50.511184Z",
"url": "https://files.pythonhosted.org/packages/66/5f/4cbbc56fb14508a5074b3671a3bd07a7d7e358ec4da6b7b9247094d6f13c/django_otel_smtp_backend-0.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-23 20:30:50",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "inventare",
"github_project": "django-otel-smtp-backend",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "django-otel-smtp-backend"
}