openmetrics-liveness-probe


Nameopenmetrics-liveness-probe JSON
Version 0.1.8 PyPI version JSON
download
home_pagehttps://github.com/Usetech/openmetrics-liveness-probe
SummaryLibrary for getting the time when the service was last considered alive.
upload_time2023-03-16 14:23:58
maintainer
docs_urlNone
authorDaniil Nikitin
requires_python>=3.6.1,<4
licenseMIT
keywords openmetrics liveness_probe
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![PyPI pyversions](https://img.shields.io/pypi/pyversions/openmetrics-liveness-probe.svg)](https://pypi.python.org/pypi/openmetrics-liveness-probe/) [![PyPI license](https://img.shields.io/pypi/l/openmetrics-liveness-probe.svg)](https://pypi.python.org/pypi/openmetrics-liveness-probe/) [![PyPI version fury.io](https://badge.fury.io/py/openmetrics-liveness-probe.svg)](https://pypi.python.org/pypi/openmetrics-liveness-probe/) [![build](https://github.com/Usetech/openmetrics-liveness-probe/actions/workflows/ci.yml/badge.svg)](https://github.com/Usetech/openmetrics-liveness-probe/actions/workflows/ci.yml?branch=main)


openmetrics-liveness-probe
============

Библиотека для получения времени, когда сервис в последний раз считался живым.
Результат экспортируется в формате OpenMetrics. Пример вывода:

```
# HELP liveness_probe_unixtime Unixtime последней liveness probe
# TYPE liveness_probe_unixtime gauge
liveness_probe_unixtime{service="test"} 1.659455742252334e+09
```

В многопоточном режиме:
```
# HELP liveness_probe_unixtime Multiprocess metric
# TYPE liveness_probe_unixtime gauge
liveness_probe_unixtime{pid="12821",service="example"} 1.6596198592194734e+09
liveness_probe_unixtime{pid="13521",service="example"} 1.6796198592194734e+09
```

Для начала необходимо объявить переменные окружения:
```
OPENMETRICS_LIVENESS_PROBE_ENABLED=True
OPENMETRICS_LIVENESS_PROBE_HOST=0.0.0.0
OPENMETRICS_LIVENESS_PROBE_PORT=8000
OPENMETRICS_LIVENESS_PROBE_SERVICE_NAME=example
OPENMETRICS_LIVENESS_PROBE_NAME_POSTFIX=liveness_probe_unixtime
OPENMETRICS_LIVENESS_PROBE_ENABLE_DEFAULT_PROMETHEUS_METRICS=False
PROMETHEUS_MULTIPROC_DIR=None
```

Все переменные по-умолчанию будут равны значениям, указанным в списке выше, Но переменная окружения ``SERVICE_NAME`` должна быть обязательно изменена.

Переменная окружения ``ENABLE_DEFAULT_PROMETHEUS_METRICS`` включает метрики по-умолчанию доступные в ``prometheus_client``: 
``PROCESS_COLLECTOR``, ``PLATFORM_COLLECTOR``, ``GC_COLLECTOR``.    
По-умолчанию их отображение выключено.

Переменная окружения ``PROMETHEUS_MULTIPROC_DIR`` позволяет запускать prometheus сервер в многопоточном режиме. По умолчанию эта переменная равна ``None.`` Для активации этого режима нужно задать путь для переменной окружения ``PROMETHEUS_MULTIPROC_DIR``, например: ``/tmp``.

# Содержание

- [Установка](#Установка)

<a name='Установка'></a>
## Установка

Описание установки
- pip 
```
pip install openmetrics_liveness_probe
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Usetech/openmetrics-liveness-probe",
    "name": "openmetrics-liveness-probe",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6.1,<4",
    "maintainer_email": "",
    "keywords": "openmetrics,liveness_probe",
    "author": "Daniil Nikitin",
    "author_email": "dnikitin@usetech.ru",
    "download_url": "https://files.pythonhosted.org/packages/84/38/a22599d51489b4ee5b3eb824a959a28f56fefbf0126ab272342b808c8cf4/openmetrics_liveness_probe-0.1.8.tar.gz",
    "platform": null,
    "description": "[![PyPI pyversions](https://img.shields.io/pypi/pyversions/openmetrics-liveness-probe.svg)](https://pypi.python.org/pypi/openmetrics-liveness-probe/) [![PyPI license](https://img.shields.io/pypi/l/openmetrics-liveness-probe.svg)](https://pypi.python.org/pypi/openmetrics-liveness-probe/) [![PyPI version fury.io](https://badge.fury.io/py/openmetrics-liveness-probe.svg)](https://pypi.python.org/pypi/openmetrics-liveness-probe/) [![build](https://github.com/Usetech/openmetrics-liveness-probe/actions/workflows/ci.yml/badge.svg)](https://github.com/Usetech/openmetrics-liveness-probe/actions/workflows/ci.yml?branch=main)\n\n\nopenmetrics-liveness-probe\n============\n\n\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043a\u043e\u0433\u0434\u0430 \u0441\u0435\u0440\u0432\u0438\u0441 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0440\u0430\u0437 \u0441\u0447\u0438\u0442\u0430\u043b\u0441\u044f \u0436\u0438\u0432\u044b\u043c.\n\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 OpenMetrics. \u041f\u0440\u0438\u043c\u0435\u0440 \u0432\u044b\u0432\u043e\u0434\u0430:\n\n```\n# HELP liveness_probe_unixtime Unixtime \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 liveness probe\n# TYPE liveness_probe_unixtime gauge\nliveness_probe_unixtime{service=\"test\"} 1.659455742252334e+09\n```\n\n\u0412 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435:\n```\n# HELP liveness_probe_unixtime Multiprocess metric\n# TYPE liveness_probe_unixtime gauge\nliveness_probe_unixtime{pid=\"12821\",service=\"example\"} 1.6596198592194734e+09\nliveness_probe_unixtime{pid=\"13521\",service=\"example\"} 1.6796198592194734e+09\n```\n\n\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f:\n```\nOPENMETRICS_LIVENESS_PROBE_ENABLED=True\nOPENMETRICS_LIVENESS_PROBE_HOST=0.0.0.0\nOPENMETRICS_LIVENESS_PROBE_PORT=8000\nOPENMETRICS_LIVENESS_PROBE_SERVICE_NAME=example\nOPENMETRICS_LIVENESS_PROBE_NAME_POSTFIX=liveness_probe_unixtime\nOPENMETRICS_LIVENESS_PROBE_ENABLE_DEFAULT_PROMETHEUS_METRICS=False\nPROMETHEUS_MULTIPROC_DIR=None\n```\n\n\u0412\u0441\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0432\u043d\u044b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0432\u044b\u0448\u0435, \u041d\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f ``SERVICE_NAME`` \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0430.\n\n\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f ``ENABLE_DEFAULT_PROMETHEUS_METRICS`` \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0432 ``prometheus_client``: \n``PROCESS_COLLECTOR``, ``PLATFORM_COLLECTOR``, ``GC_COLLECTOR``.    \n\u041f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u0445 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u043e.\n\n\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f ``PROMETHEUS_MULTIPROC_DIR`` \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c prometheus \u0441\u0435\u0440\u0432\u0435\u0440 \u0432 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u044d\u0442\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0440\u0430\u0432\u043d\u0430 ``None.`` \u0414\u043b\u044f \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u0436\u0438\u043c\u0430 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u043f\u0443\u0442\u044c \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f ``PROMETHEUS_MULTIPROC_DIR``, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: ``/tmp``.\n\n# \u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435\n\n- [\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430](#\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430)\n\n<a name='\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430'></a>\n## \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430\n\n\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438\n- pip \n```\npip install openmetrics_liveness_probe\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Library for getting the time when the service was last considered alive.",
    "version": "0.1.8",
    "split_keywords": [
        "openmetrics",
        "liveness_probe"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "95b4638d5a2fa2d587948298a47158597b22bb0167ec8fb8496e490054953f59",
                "md5": "8254f90043144d8f69ebd7f14a2e6126",
                "sha256": "2e1d3f045f8538544f4954135a3b184039b7323386aa306bf531ffb1903c22a6"
            },
            "downloads": -1,
            "filename": "openmetrics_liveness_probe-0.1.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8254f90043144d8f69ebd7f14a2e6126",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6.1,<4",
            "size": 4924,
            "upload_time": "2023-03-16T14:23:56",
            "upload_time_iso_8601": "2023-03-16T14:23:56.679781Z",
            "url": "https://files.pythonhosted.org/packages/95/b4/638d5a2fa2d587948298a47158597b22bb0167ec8fb8496e490054953f59/openmetrics_liveness_probe-0.1.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8438a22599d51489b4ee5b3eb824a959a28f56fefbf0126ab272342b808c8cf4",
                "md5": "45b50fa079ed6479368a5259928b5d97",
                "sha256": "15c939ecd2a007a525794a6ef6b73c14a78912d2fa318406d3a563f36ca6e43e"
            },
            "downloads": -1,
            "filename": "openmetrics_liveness_probe-0.1.8.tar.gz",
            "has_sig": false,
            "md5_digest": "45b50fa079ed6479368a5259928b5d97",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6.1,<4",
            "size": 4357,
            "upload_time": "2023-03-16T14:23:58",
            "upload_time_iso_8601": "2023-03-16T14:23:58.404425Z",
            "url": "https://files.pythonhosted.org/packages/84/38/a22599d51489b4ee5b3eb824a959a28f56fefbf0126ab272342b808c8cf4/openmetrics_liveness_probe-0.1.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-16 14:23:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "Usetech",
    "github_project": "openmetrics-liveness-probe",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "openmetrics-liveness-probe"
}
        
Elapsed time: 0.08473s