Mini Shell

Direktori : /opt/imh-python/lib/python3.9/site-packages/ngxstats/
Upload File :
Current File : //opt/imh-python/lib/python3.9/site-packages/ngxstats/stats.py

# vim: set ts=4 sw=4 expandtab syntax=python:
"""

ngxstats.stats
Realtime Nginx stats aggregation tool
User-facing stats subservice, exposing a REST interface via Flask
This module is a stub that calls ngxstats.stats_app

Copyright (c) 2019-2020 InMotion Hosting, Inc.
https://www.inmotionhosting.com/

@author J. Hipps <jacobh@inmotionhosting.com>

"""

import multiprocessing
import logging
import logging.handlers

from setproctitle import setproctitle

logger = logging.getLogger('ngxstats')


def start():
    """
    Setup Flask app for Stats API
    """
    logger.info(
        "stats: subservice started. pid = %d",
        multiprocessing.current_process().pid,
    )
    try:
        setproctitle("ngxstats: stats")
    except Exception:
        pass

    # Importing stats_app also sets up Flask and REST Plus.
    # It is done this way to still allow us to use the handy
    # decorators they define
    logger.debug("stats: importing stats_app and initializing Flask...")
    from ngxstats import stats_app

    stats_app.initialize_app()

Zerion Mini Shell 1.0