~homeworkprod/byceps

0a76c873c2d2ebaf4aea820a2356805c26defbef — Jochen Kupperschmidt 1 year, 3 months ago c3dbbb3
Move healthcheck and metrics blueprints into `monitoring` subpackage
8 files changed, 12 insertions(+), 12 deletions(-)

M byceps/application.py
R byceps/blueprints/{healthcheck/__init__.py => monitoring/__init__.py}
R byceps/blueprints/{metrics/__init__.py => monitoring/healthcheck/__init__.py}
R byceps/blueprints/{healthcheck/views.py => monitoring/healthcheck/views.py}
A byceps/blueprints/monitoring/metrics/__init__.py
R byceps/blueprints/{metrics/views.py => monitoring/metrics/views.py}
M byceps/metrics/application.py
M tests/integration/blueprints/healthcheck/test_health_fail.py
M byceps/application.py => byceps/application.py +2 -2
@@ 181,13 181,13 @@ def _get_blueprints_api() -> Iterator[BlueprintReg]:

def _get_blueprints_health() -> Iterator[BlueprintReg]:
    yield from [
        ('healthcheck',                 '/health'                   ),
        ('monitoring.healthcheck',      '/health'                   ),
    ]


def _get_blueprints_metrics() -> Iterator[BlueprintReg]:
    yield from [
        ('metrics',                     '/metrics'                  ),
        ('monitoring.metrics',          '/metrics'                  ),
    ]



R byceps/blueprints/healthcheck/__init__.py => byceps/blueprints/monitoring/__init__.py +0 -0
R byceps/blueprints/metrics/__init__.py => byceps/blueprints/monitoring/healthcheck/__init__.py +0 -0
R byceps/blueprints/healthcheck/views.py => byceps/blueprints/monitoring/healthcheck/views.py +4 -4
@@ 1,6 1,6 @@
"""
byceps.blueprints.healthcheck
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
byceps.blueprints.monitoring.healthcheck
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.


@@ 11,8 11,8 @@ from flask.json import dumps

from sqlalchemy.exc import OperationalError

from ...database import db
from ...util.framework.blueprint import create_blueprint
from ....database import db
from ....util.framework.blueprint import create_blueprint


blueprint = create_blueprint('healthcheck', __name__)

A byceps/blueprints/monitoring/metrics/__init__.py => byceps/blueprints/monitoring/metrics/__init__.py +0 -0
R byceps/blueprints/metrics/views.py => byceps/blueprints/monitoring/metrics/views.py +4 -4
@@ 1,6 1,6 @@
"""
byceps.blueprints.metrics
~~~~~~~~~~~~~~~~~~~~~~~~~
byceps.blueprints.monitoring.metrics
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Metrics export for `Prometheus <https://prometheus.io/>`_



@@ 10,8 10,8 @@ Metrics export for `Prometheus <https://prometheus.io/>`_

from flask import Response

from ...services.metrics import service as metrics_service
from ...util.framework.blueprint import create_blueprint
from ....services.metrics import service as metrics_service
from ....util.framework.blueprint import create_blueprint


blueprint = create_blueprint('metrics', __name__)

M byceps/metrics/application.py => byceps/metrics/application.py +1 -1
@@ 24,6 24,6 @@ def create_app(database_uri):
    # Initialize database.
    db.init_app(app)

    register_blueprint(app, 'metrics', '/metrics')
    register_blueprint(app, 'monitoring.metrics', '/metrics')

    return app

M tests/integration/blueprints/healthcheck/test_health_fail.py => tests/integration/blueprints/healthcheck/test_health_fail.py +1 -1
@@ 10,7 10,7 @@ from unittest.mock import patch
# party. After all, both admin and party apps should react the same.


@patch('byceps.blueprints.healthcheck.views._is_rdbms_ok')
@patch('byceps.blueprints.monitoring.healthcheck.views._is_rdbms_ok')
def test_healthcheck_fail(is_rdbms_ok_mock, admin_client):
    expected_media_type = 'application/health+json'