Name | thoth-common JSON |
Version |
0.36.6
JSON |
| download |
home_page | |
Summary | Shared code logic in the project Thoth. |
upload_time | 2022-10-31 14:04:21 |
maintainer | |
docs_url | None |
author | Fridolin Pokorny |
requires_python | |
license | GPLv3+ |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
Thoth Common
------------
.. image:: https://img.shields.io/github/v/tag/thoth-station/common?style=plastic
:target: https://github.com/thoth-station/common/releases
:alt: GitHub tag (latest by date)
.. image:: https://img.shields.io/pypi/v/thoth-common?style=plastic
:target: https://pypi.org/project/thoth-common
:alt: PyPI - Module Version
.. image:: https://img.shields.io/pypi/l/thoth-common?style=plastic
:target: https://pypi.org/project/thoth-common
:alt: PyPI - License
.. image:: https://img.shields.io/pypi/dm/thoth-common?style=plastic
:target: https://pypi.org/project/thoth-common
:alt: PyPI - Downloads
A library used in project `Thoth <https://thoth-station.ninja>`_. It's aim is
to provide core utilities for logger setup, manipulation with datetimes and
similar handy helpers. Namely, you can find:
* operations used for cluster object management (e.g. obtaining logs of pods)
* operations used for scheduling workload using Argo Workflows
* Thoth's configuration abstraction used for serialization/deserialization of
Thoth's config file across all the components
* application logging setup
* manipulation with date and time
Installation
============
This project is released on `PyPI <https://pypi.org/project/thoth-common>`_, so
the latest release can be installed via pip or `Pipenv
<https://pipenv.readthedocs.io>`_ as shown below:
.. code-block:: console
pipenv install thoth-common
This library will automatically discover installed packages and enable `Sentry
integrations <https://docs.sentry.io/platforms/python/>`_ if you use Flask,
SQLAlchemy or AIOHTTP. An exception is for Flask applications, that need to
explicitly install ``sentry-sdk[flask]`` due to integrations dependencies.
Logging setup
=============
To setup a logger in any of Thoth's component (component that are namespaced
with ``thoth``), you can simply set an environment variable. The name of
environment variable is constructed from module name. Let's say you want to
debug ``thoth.adviser.pipeline`` module, in that case you can set environment
variable ``THOTH_LOG_ADVISER_PIPELINE=DEBUG`` which will cause loggers
``thoth.adviser.pipeline`` to be set to ``DEBUG`` mode. See `log-levels
documentation <https://docs.python.org/3/library/logging.html#logging-levels>`_
for more info. If a module has underscore in its name, replace it with double
underscore in the environment variable name.
To setup a logger that is not introduced by a Thoth's component, you can set
``THOTH_ADJUST_LOGGING`` environment variable. The format of this environment
variable ``THOTH_ADJUST_LOGGING`` is a comma separated list where each entry is
made out of a logger name and a corresponding log-level ("``DEBUG``",
"``INFO``", "``WARNING``", "``ERROR``" as for standard Python's logging). These
two are delimited by a colon, an example:
.. code-block:: console
THOTH_ADJUST_LOGGING="flask:WARNING,alembic.migrations:ERROR"
Structured logging
==================
The library will automatically detect when it is running inside an OpenShift
cluster (based on ``STI_SCRIPTS_PATH`` environment variable that is inserted
into the container if build the container was built in an OpenShift cluster),
In such case, the library will setup structured logging suitable for automated
logs aggregation (e.g. automated logs aggregation using the ELK stack). This
behavior can be suppressed by setting environment variable
``THOTH_LOGGING_NO_JSON=1``.
Ignoring reports from a logger
==============================
In some cases it's expected to turn off reporting of some logger to Sentry. You
can provide ``THOTH_SENTRY_IGNORE_LOGGER`` environment variable which holds a
comma separated list of loggers that should be ignored when reporting errors to
Sentry:
.. code-block:: console
THOTH_SENTRY_IGNORE_LOGGER="thoth.adviser.resolver,thoth.adviser.run"
This is helpful if you want to report errors to users but not to Thoth
application itself.
If you want some certain classes of error not to be reported to Sentry, you can
can provide ``THOTH_SENTRY_IGNORE_EXCEPTION`` environment variable which holds
a comma-separated list of exception classes to be ignored when reporting to
Sentry:
.. code-block:: console
THOTH_SENTRY_IGNORE_EXCEPTION="connexion.decorators.validation,builtins.ValueError"
Remember all builtin exception classes need to be specified as in the same
manner as ``ValueError`` is specified above.
Raw data
{
"_id": null,
"home_page": "",
"name": "thoth-common",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Fridolin Pokorny",
"author_email": "fridolin@redhat.com",
"download_url": "https://files.pythonhosted.org/packages/ae/ef/90b54b7210b22190596b54b55ad22322460b0c0dbbf8733e44c18b30d8ae/thoth-common-0.36.6.tar.gz",
"platform": null,
"description": "Thoth Common\n------------\n\n.. image:: https://img.shields.io/github/v/tag/thoth-station/common?style=plastic\n :target: https://github.com/thoth-station/common/releases\n :alt: GitHub tag (latest by date)\n\n.. image:: https://img.shields.io/pypi/v/thoth-common?style=plastic\n :target: https://pypi.org/project/thoth-common\n :alt: PyPI - Module Version\n\n.. image:: https://img.shields.io/pypi/l/thoth-common?style=plastic\n :target: https://pypi.org/project/thoth-common\n :alt: PyPI - License\n\n.. image:: https://img.shields.io/pypi/dm/thoth-common?style=plastic\n :target: https://pypi.org/project/thoth-common\n :alt: PyPI - Downloads\n\nA library used in project `Thoth <https://thoth-station.ninja>`_. It's aim is\nto provide core utilities for logger setup, manipulation with datetimes and\nsimilar handy helpers. Namely, you can find:\n\n* operations used for cluster object management (e.g. obtaining logs of pods)\n* operations used for scheduling workload using Argo Workflows\n* Thoth's configuration abstraction used for serialization/deserialization of\n Thoth's config file across all the components\n* application logging setup\n* manipulation with date and time\n\nInstallation\n============\n\nThis project is released on `PyPI <https://pypi.org/project/thoth-common>`_, so\nthe latest release can be installed via pip or `Pipenv\n<https://pipenv.readthedocs.io>`_ as shown below:\n\n.. code-block:: console\n\n pipenv install thoth-common\n\nThis library will automatically discover installed packages and enable `Sentry\nintegrations <https://docs.sentry.io/platforms/python/>`_ if you use Flask,\nSQLAlchemy or AIOHTTP. An exception is for Flask applications, that need to\nexplicitly install ``sentry-sdk[flask]`` due to integrations dependencies.\n\nLogging setup\n=============\n\nTo setup a logger in any of Thoth's component (component that are namespaced\nwith ``thoth``), you can simply set an environment variable. The name of\nenvironment variable is constructed from module name. Let's say you want to\ndebug ``thoth.adviser.pipeline`` module, in that case you can set environment\nvariable ``THOTH_LOG_ADVISER_PIPELINE=DEBUG`` which will cause loggers\n``thoth.adviser.pipeline`` to be set to ``DEBUG`` mode. See `log-levels\ndocumentation <https://docs.python.org/3/library/logging.html#logging-levels>`_\nfor more info. If a module has underscore in its name, replace it with double\nunderscore in the environment variable name.\n\nTo setup a logger that is not introduced by a Thoth's component, you can set\n``THOTH_ADJUST_LOGGING`` environment variable. The format of this environment\nvariable ``THOTH_ADJUST_LOGGING`` is a comma separated list where each entry is\nmade out of a logger name and a corresponding log-level (\"``DEBUG``\",\n\"``INFO``\", \"``WARNING``\", \"``ERROR``\" as for standard Python's logging). These\ntwo are delimited by a colon, an example:\n\n.. code-block:: console\n\n THOTH_ADJUST_LOGGING=\"flask:WARNING,alembic.migrations:ERROR\"\n\nStructured logging\n==================\n\nThe library will automatically detect when it is running inside an OpenShift\ncluster (based on ``STI_SCRIPTS_PATH`` environment variable that is inserted\ninto the container if build the container was built in an OpenShift cluster),\nIn such case, the library will setup structured logging suitable for automated\nlogs aggregation (e.g. automated logs aggregation using the ELK stack). This\nbehavior can be suppressed by setting environment variable\n``THOTH_LOGGING_NO_JSON=1``.\n\nIgnoring reports from a logger\n==============================\n\nIn some cases it's expected to turn off reporting of some logger to Sentry. You\ncan provide ``THOTH_SENTRY_IGNORE_LOGGER`` environment variable which holds a\ncomma separated list of loggers that should be ignored when reporting errors to\nSentry:\n\n.. code-block:: console\n\n THOTH_SENTRY_IGNORE_LOGGER=\"thoth.adviser.resolver,thoth.adviser.run\"\n\n\nThis is helpful if you want to report errors to users but not to Thoth\napplication itself.\n\nIf you want some certain classes of error not to be reported to Sentry, you can\ncan provide ``THOTH_SENTRY_IGNORE_EXCEPTION`` environment variable which holds\na comma-separated list of exception classes to be ignored when reporting to\nSentry:\n\n.. code-block:: console\n\n THOTH_SENTRY_IGNORE_EXCEPTION=\"connexion.decorators.validation,builtins.ValueError\"\n\nRemember all builtin exception classes need to be specified as in the same\nmanner as ``ValueError`` is specified above.\n",
"bugtrack_url": null,
"license": "GPLv3+",
"summary": "Shared code logic in the project Thoth.",
"version": "0.36.6",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "86e1243543c3532a2fefb729b39166b4",
"sha256": "ff512cacdc3a537464d7818c32fde97049b7084a21c318c4b220a715f7d02dc3"
},
"downloads": -1,
"filename": "thoth_common-0.36.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "86e1243543c3532a2fefb729b39166b4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 52091,
"upload_time": "2022-10-31T14:04:20",
"upload_time_iso_8601": "2022-10-31T14:04:20.186267Z",
"url": "https://files.pythonhosted.org/packages/eb/c7/3ba5304293c47eaec9c971fb0bd52567cf7b551094571f63716869699074/thoth_common-0.36.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "2e1fabd1648b0fd845a6ba0f326bf738",
"sha256": "8591433a16046722e475dff35b63b711f6578566057191357b55b44ad4ed3c57"
},
"downloads": -1,
"filename": "thoth-common-0.36.6.tar.gz",
"has_sig": false,
"md5_digest": "2e1fabd1648b0fd845a6ba0f326bf738",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 124340,
"upload_time": "2022-10-31T14:04:21",
"upload_time_iso_8601": "2022-10-31T14:04:21.961732Z",
"url": "https://files.pythonhosted.org/packages/ae/ef/90b54b7210b22190596b54b55ad22322460b0c0dbbf8733e44c18b30d8ae/thoth-common-0.36.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-10-31 14:04:21",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "thoth-common"
}