diff --git a/.coveragerc b/.coveragerc index 7ca9769b..45987e2b 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,6 +1,6 @@ [run] branch = True -source = graphite_api +source = graphite_render [report] omit = *_vendor* diff --git a/README.rst b/README.rst index 5e97b779..25931aa9 100644 --- a/README.rst +++ b/README.rst @@ -1,4 +1,4 @@ -Graphite-API +Graphite-Render ============ **Note:** This is a friendly fork of the upstream project at https://github.com/brutasse/graphite-api. diff --git a/bin/graphite b/bin/graphite index 4323a162..ebbac1ed 100755 --- a/bin/graphite +++ b/bin/graphite @@ -3,14 +3,14 @@ import os os.environ.setdefault('DEBUG', '1') -import graphite_api +import graphite_render -graphite_api.DEBUG = bool(int(os.environ['DEBUG'])) +graphite_render.DEBUG = bool(int(os.environ['DEBUG'])) -from graphite_api.app import app +from graphite_render.app import app if __name__ == '__main__': port = int(os.environ.get('PORT', 8888)) host = os.environ.get('BIND_ADDRESS', '127.0.0.1') - app.run(debug=graphite_api.DEBUG, port=port, host=host) + app.run(debug=graphite_render.DEBUG, port=port, host=host) diff --git a/docs/api.rst b/docs/api.rst index 5952bc25..baf6f3b6 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -117,7 +117,7 @@ Example:: The Render API -- ``/render`` ============================= -Graphite-API provides a ``/render`` endpoint for generating graphs +Graphite-Render provides a ``/render`` endpoint for generating graphs and retrieving raw data. This endpoint accepts various arguments via query string parameters, form data or JSON data. @@ -697,7 +697,7 @@ fontName *Default: 'Sans'* Change the font used to render text on the graph The font must be installed -on the Graphite-API server. +on the Graphite-Render server. Example:: @@ -1162,7 +1162,7 @@ Example:: tz `` -*Default: The timezone specified in the graphite-api configuration* +*Default: The timezone specified in the graphite-render configuration* Time zone to convert all times into. diff --git a/docs/conf.py b/docs/conf.py index 8481756c..61131c0d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -21,7 +21,7 @@ master_doc = 'index' -project = 'Graphite-API' +project = 'Graphite-Render' copyright = u'2014, Bruno Renié' version = '1.1.4' @@ -34,24 +34,24 @@ html_theme = 'sphinx_rtd_theme' html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] -htmlhelp_basename = 'Graphite-APIdoc' +htmlhelp_basename = 'Graphite-Renderdoc' latex_elements = { } latex_documents = [ - ('index', 'Graphite-API.tex', 'Graphite-API Documentation', + ('index', 'Graphite-Render.tex', 'Graphite-Render Documentation', 'Bruno Renié', 'manual'), ] man_pages = [ - ('index', 'graphite-api', 'Graphite-API Documentation', + ('index', 'graphite-render', 'Graphite-Render Documentation', ['Bruno Renié'], 1) ] texinfo_documents = [ - ('index', 'Graphite-API', 'Graphite-API Documentation', - 'Bruno Renié', 'Graphite-API', 'One line description of project.', + ('index', 'Graphite-Render', 'Graphite-Render Documentation', + 'Bruno Renié', 'Graphite-Render', 'One line description of project.', 'Miscellaneous'), ] @@ -63,7 +63,7 @@ class RenderFunctionDocumenter(autodoc.FunctionDocumenter): def can_document_member(cls, member, membername, isattr, parent): return autodoc.FunctionDocumenter.can_document_member( member, membername, isattr, parent - ) and parent.name == 'graphite_api.functions' + ) and parent.name == 'graphite_render.functions' def format_args(self): args = super(RenderFunctionDocumenter, self).format_args() diff --git a/docs/configuration.rst b/docs/configuration.rst index c8f798af..2c60794a 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -1,12 +1,12 @@ Configuration ============= -/etc/graphite-api.yaml +/etc/graphite-render.yaml ---------------------- -The configuration file for Graphite-API lives at ``/etc/graphite-api.yaml`` +The configuration file for Graphite-Render lives at ``/etc/graphite-render.yaml`` and uses the YAML format. Creating the configuration file is optional: if -Graphite-API doesn't find the file, sane defaults are used. They are described +Graphite-Render doesn't find the file, sane defaults are used. They are described below. Default values @@ -16,10 +16,10 @@ Default values search_index: /srv/graphite/index finders: - - graphite_api.finders.whisper.WhisperFinder + - graphite_render.finders.whisper.WhisperFinder functions: - - graphite_api.functions.SeriesFunctions - - graphite_api.functions.PieFunctions + - graphite_render.functions.SeriesFunctions + - graphite_render.functions.PieFunctions whisper: directories: - /srv/graphite/whisper @@ -34,7 +34,7 @@ Default sections *search_index* The location of the search index used for searching metrics. Note that it - needs to be a file that is writable by the Graphite-API process. + needs to be a file that is writable by the Graphite-Render process. *finders* @@ -54,7 +54,7 @@ Default sections *time_zone* - The time zone to use when generating graphs. By default, Graphite-API tries + The time zone to use when generating graphs. By default, Graphite-Render tries to detect your system timezone. If detection fails it falls back to UTC. You can also manually override it if you want another value than your system's timezone. @@ -110,7 +110,7 @@ Extra sections *sentry_dsn* - This is useful if you want to send Graphite-API's exceptions to a `Sentry`_ + This is useful if you want to send Graphite-Render's exceptions to a `Sentry`_ instance for easier debugging. Example:: @@ -119,10 +119,10 @@ Extra sections .. note:: - Sentry integration requires Graphite-API to be installed with the + Sentry integration requires Graphite-Render to be installed with the corresponding extra dependency:: - $ pip install graphite-api[sentry] + $ pip install graphite-render[sentry] .. _Sentry: https://docs.getsentry.com @@ -159,23 +159,23 @@ Extra sections This would configure Flask-Cache with ``CACHE_TYPE = 'redis'`` and ``CACHE_REDIS_HOST = 'localhost'``. - Some cache options have default values defined by Graphite-API: + Some cache options have default values defined by Graphite-Render: * ``default_timeout``: 60 - * ``key_prefix``: ``'graphite-api:``. + * ``key_prefix``: ``'graphite-render:``. .. note:: Caching functionality requires you to install the cache extra dependency but also the underlying driver. E.g. for redis, you'll need:: - $ pip install graphite-api[cache] redis + $ pip install graphite-render[cache] redis *statsd* Attaches a statsd object to the application, which can be used for - instrumentation. Currently Graphite-API itself doesn't use this, + instrumentation. Currently Graphite-Render itself doesn't use this, but some backends do, like `Graphite-Influxdb`_. Example:: @@ -200,8 +200,8 @@ Extra sections Custom location --------------- -If you need the Graphite-API config file to be stored in another place than -``/etc/graphite-api.yaml``, you can set a custom location using the +If you need the Graphite-Render config file to be stored in another place than +``/etc/graphite-render.yaml``, you can set a custom location using the ``GRAPHITE_API_CONFIG`` environment variable:: export GRAPHITE_API_CONFIG=/var/lib/graphite/config.yaml diff --git a/docs/custom-functions.rst b/docs/custom-functions.rst index 1cbf257d..47233aac 100644 --- a/docs/custom-functions.rst +++ b/docs/custom-functions.rst @@ -1,7 +1,7 @@ Custom functions ================ -Just like with storage finders, it is possible to extend Graphite-API to add +Just like with storage finders, it is possible to extend Graphite-Render to add custom processing functions. To give an example, let's implement a function that reverses the time series, @@ -30,12 +30,12 @@ Once you've created your function, declare it in a dictionnary: 'reverseSeries': reverseSeries, } -Add your module to the Graphite-API Python path and add it to the +Add your module to the Graphite-Render Python path and add it to the configuration: .. code-block:: yaml functions: - - graphite_api.functions.SeriesFunctions - - graphite_api.functions.PieFunctions + - graphite_render.functions.SeriesFunctions + - graphite_render.functions.PieFunctions - reverse.ReverseFunctions diff --git a/docs/deployment.rst b/docs/deployment.rst index e8fd5e24..0314bd3d 100644 --- a/docs/deployment.rst +++ b/docs/deployment.rst @@ -10,32 +10,32 @@ First, you need to install Gunicorn. The easiest way is to use ``pip``:: $ pip install gunicorn -If you have installed Graphite-API in a virtualenv, install Gunicorn in the +If you have installed Graphite-Render in a virtualenv, install Gunicorn in the same virtualenv:: $ /usr/share/python/graphite/bin/pip install gunicorn -Next, create the script that will run Graphite-API using your process watcher +Next, create the script that will run Graphite-Render using your process watcher of choice. *Upstart* :: - description "Graphite-API server" + description "Graphite-Render server" start on runlevel [2345] stop on runlevel [!2345] respawn - exec gunicorn -w2 graphite_api.app:app -b 127.0.0.1:8888 + exec gunicorn -w2 graphite_render.app:app -b 127.0.0.1:8888 *Supervisor* :: - [program:graphite-api] - command = gunicorn -w2 graphite_api.app:app -b 127.0.0.1:8888 + [program:graphite-render] + command = gunicorn -w2 graphite_render.app:app -b 127.0.0.1:8888 autostart = true autorestart = true @@ -43,12 +43,12 @@ of choice. :: - # This is /etc/systemd/system/graphite-api.socket + # This is /etc/systemd/system/graphite-render.socket [Unit] - Description=graphite-api socket + Description=graphite-render socket [Socket] - ListenStream=/run/graphite-api.sock + ListenStream=/run/graphite-render.sock ListenStream=127.0.0.1:8888 [Install] @@ -56,13 +56,13 @@ of choice. :: - # This is /etc/systemd/system/graphite-api.service + # This is /etc/systemd/system/graphite-render.service [Unit] - Description=Graphite-API service - Requires=graphite-api.socket + Description=Graphite-Render service + Requires=graphite-render.socket [Service] - ExecStart=/usr/bin/gunicorn -w2 graphite_api.app:app + ExecStart=/usr/bin/gunicorn -w2 graphite_render.app:app Restart=on-failure #User=graphite #Group=graphite @@ -75,7 +75,7 @@ of choice. .. note:: - If you have installed Graphite-API and Gunicorn in a virtualenv, you + If you have installed Graphite-Render and Gunicorn in a virtualenv, you need to use the full path to Gunicorn. Instead of ``gunicorn``, use ``/usr/share/python/graphite/bin/gunicorn`` (assuming your virtualenv is at ``/usr/share/python/graphite``). @@ -122,13 +122,13 @@ See the `mod_wsgi InstallationInstructions`_ for installation instructions. .. _mod_wsgi InstallationInstructions: https://code.google.com/p/modwsgi/wiki/InstallationInstructions -Then create the graphite-api.wsgi: +Then create the graphite-render.wsgi: .. code-block:: bash - # /var/www/wsgi-scripts/graphite-api.wsgi + # /var/www/wsgi-scripts/graphite-render.wsgi - from graphite_api.app import app as application + from graphite_render.app import app as application Finally, configure the apache vhost: @@ -143,12 +143,12 @@ Finally, configure the apache vhost: Listen 8013 - WSGIDaemonProcess graphite-api processes=5 threads=5 display-name='%{GROUP}' inactivity-timeout=120 - WSGIProcessGroup graphite-api + WSGIDaemonProcess graphite-render processes=5 threads=5 display-name='%{GROUP}' inactivity-timeout=120 + WSGIProcessGroup graphite-render WSGIApplicationGroup %{GLOBAL} - WSGIImportScript /var/www/wsgi-scripts/graphite-api.wsgi process-group=graphite-api application-group=%{GLOBAL} + WSGIImportScript /var/www/wsgi-scripts/graphite-render.wsgi process-group=graphite-render application-group=%{GLOBAL} - WSGIScriptAlias / /var/www/wsgi-scripts/graphite-api.wsgi + WSGIScriptAlias / /var/www/wsgi-scripts/graphite-render.wsgi Order deny,allow @@ -171,25 +171,25 @@ Restart apache:: Docker ------ -Create a ``graphite-api.yaml`` configuration file with your desired config. +Create a ``graphite-render.yaml`` configuration file with your desired config. Create a ``Dockerfile``:: - FROM brutasse/graphite-api + FROM brutasse/graphite-render Build your container:: - docker build -t graphite-api . + docker build -t graphite-render . Run it:: - docker run -t -i -p 8888:8888 graphite-api + docker run -t -i -p 8888:8888 graphite-render ``/srv/graphite`` is a docker ``VOLUME``. You can use that to provide whisper -data from the host (or from another docker container) to the graphite-api +data from the host (or from another docker container) to the graphite-render container:: - docker run -t -i -v /path/to/graphite:/srv/graphite -p 8888:8888 graphite-api + docker run -t -i -v /path/to/graphite:/srv/graphite -p 8888:8888 graphite-render This container has all the :ref:`extra packages ` included. Cyanite backend and Sentry integration are available. @@ -199,8 +199,8 @@ Nginx + uWSGI First, you need to install uWSGI with Python support. On Debian, install ``uwsgi-plugin-python``. -Then create the uWSGI file for Graphite-API in -``/etc/uwsgi/apps-available/graphite-api.ini``: +Then create the uWSGI file for Graphite-Render in +``/etc/uwsgi/apps-available/graphite-render.ini``: .. code-block:: ini @@ -208,26 +208,26 @@ Then create the uWSGI file for Graphite-API in processes = 2 socket = localhost:8080 plugins = python27 - module = graphite_api.app:app + module = graphite_render.app:app -If you installed Graphite-API in a virtualenv, specify the virtualenv path: +If you installed Graphite-Render in a virtualenv, specify the virtualenv path: .. code-block:: ini home = /var/www/wsgi-scripts/env -If you need a custom location for Graphite-API's config file, set the +If you need a custom location for Graphite-Render's config file, set the environment variable like this: .. code-block:: ini env = GRAPHITE_API_CONFIG=/var/www/wsgi-scripts/config.yml -Enable ``graphite-api.ini`` and restart uWSGI: +Enable ``graphite-render.ini`` and restart uWSGI: .. code-block:: bash - $ ln -s /etc/uwsgi/apps-available/graphite-api.ini /etc/uwsgi/apps-enabled + $ ln -s /etc/uwsgi/apps-available/graphite-render.ini /etc/uwsgi/apps-enabled $ service uwsgi restart Finally, configure the nginx vhost: @@ -256,11 +256,11 @@ Other deployment methods ------------------------ They currently aren't described here but there are several other ways to serve -Graphite-API: +Graphite-Render: * nginx + circus + chaussette If you feel like contributing some documentation, feel free to open pull a -request on the `Graphite-API repository`_. +request on the `Graphite-Render repository`_. -.. _Graphite-API repository: https://github.com/brutasse/graphite-api +.. _Graphite-Render repository: https://github.com/brutasse/graphite-render diff --git a/docs/finders.rst b/docs/finders.rst index d1229acc..ed6e4bde 100644 --- a/docs/finders.rst +++ b/docs/finders.rst @@ -1,17 +1,17 @@ Storage finders --------------- -Graphite-API searches and fetches metrics from time series databases using an -interface called *finders*. The default finder provided with Graphite-API is +Graphite-Render searches and fetches metrics from time series databases using an +interface called *finders*. The default finder provided with Graphite-Render is the one that integrates with Whisper databases. -Customizing finders can be done in the ``finders`` section of the Graphite-API +Customizing finders can be done in the ``finders`` section of the Graphite-Render configuration file: .. code-block:: yaml finders: - - graphite_api.finders.whisper.WhisperFinder + - graphite_render.finders.whisper.WhisperFinder Several values are allowed, to let you store different kinds of metrics at different places or smoothly handle transitions from one time series database @@ -38,7 +38,7 @@ query: .. code-block:: python - from graphite_api.node import LeafNode, BranchNode + from graphite_render.node import LeafNode, BranchNode class CustomFinder(object): def find_nodes(self, query): @@ -57,7 +57,7 @@ methods: ``fetch()`` and ``get_intervals()``: .. code-block:: python - from graphite_api.intervals import IntervalSet, Interval + from graphite_render.intervals import IntervalSet, Interval class CustomReader(object): __slots__ = ('path',) # __slots__ is recommended to save memory on readers @@ -130,7 +130,7 @@ look at third-party finders to get some inspiration: Configuration ^^^^^^^^^^^^^ -Graphite-API instantiates finders and passes it its whole parsed configuration +Graphite-Render instantiates finders and passes it its whole parsed configuration file, as a Python data structure. External finders can require extra sections in the configuration file to setup access to the time series database they communicate with. For instance, let's say your ``CustomFinder`` needs two diff --git a/docs/functions.rst b/docs/functions.rst index d6460ee5..34c166a5 100644 --- a/docs/functions.rst +++ b/docs/functions.rst @@ -18,5 +18,5 @@ To pass multiple series lists to a function which only takes one, use the List of functions ----------------- -.. automodule:: graphite_api.functions +.. automodule:: graphite_render.functions :members: diff --git a/docs/index.rst b/docs/index.rst index d798f7db..a167b963 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,32 +1,32 @@ -Graphite-API documentation +Graphite-Render documentation ========================== .. raw:: html

- GitHub project + GitHub project - Build Status + Build Status - PyPI version + PyPI version

-Graphite-API is an alternative to Graphite-web, without any built-in +Graphite-Render is an alternative to Graphite-web, without any built-in dashboard. Its role is solely to fetch metrics from a time-series database (whisper, cyanite, etc.) and rendering graphs or JSON data out of these time series. It is meant to be consumed by any of the numerous Graphite dashboard applications. -Graphite-API is a fork of Graphite-web and couldn't have existed without the +Graphite-Render is a fork of Graphite-web and couldn't have existed without the fantastic prior work done by the Graphite team. Why should I use it? -------------------- -Graphite-API offers a number of improvements over Graphite-web that you might +Graphite-Render offers a number of improvements over Graphite-web that you might find useful. Namely: -* The Graphite-API application is completely stateless and doesn't need a SQL +* The Graphite-Render application is completely stateless and doesn't need a SQL database. It only needs to talk to a time series database. * Python 2 and 3 are both supported. @@ -52,10 +52,10 @@ find useful. Namely: .. note:: - Graphite-API does **not** provide any web/graphical interface. If you - currently rely on the built-in Graphite composer, Graphite-API might not + Graphite-Render does **not** provide any web/graphical interface. If you + currently rely on the built-in Graphite composer, Graphite-Render might not be for you. However, if you're using a third-party dashboard interface, - Graphite-API will do just fine. + Graphite-Render will do just fine. Contents -------- diff --git a/docs/installation.rst b/docs/installation.rst index 8323508e..e1ba4b5c 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -6,10 +6,10 @@ Debian / Ubuntu: native package =============================== If you run Debian 8 or Ubuntu 14.04 LTS, you can use one of the available -packages which provides a self-contained build of graphite-api. Builds are +packages which provides a self-contained build of graphite-render. Builds are available on the `releases`_ page. -.. _releases: https://github.com/brutasse/graphite-api/releases +.. _releases: https://github.com/brutasse/graphite-render/releases Once installed, Graphite-api should be running as a service and available on port 8888. The package contains all the :ref:`optional dependencies `. @@ -20,7 +20,7 @@ Python package Prerequisites ------------- -Installing Graphite-API requires: +Installing Graphite-Render requires: * Python 2 (2.6 and above) or 3 (3.3 and above), with development files. On debian/ubuntu, you'll want to install ``python-dev``. @@ -37,35 +37,35 @@ Installing Graphite-API requires: Global installation ------------------- -To install Graphite-API globally on your system, run as root:: +To install Graphite-Render globally on your system, run as root:: - $ pip install graphite-api + $ pip install graphite-render Isolated installation (virtualenv) ---------------------------------- -If you want to isolate Graphite-API from the system-wide python environment, +If you want to isolate Graphite-Render from the system-wide python environment, you can install it in a virtualenv. :: $ virtualenv /usr/share/python/graphite - $ /usr/share/python/graphite/bin/pip install graphite-api + $ /usr/share/python/graphite/bin/pip install graphite-render .. _extras: Extra dependencies ------------------ -When you install ``graphite-api``, all the dependencies for running a Graphite +When you install ``graphite-render``, all the dependencies for running a Graphite server that uses Whisper as a storage backend are installed. You can specify extra dependencies: -* For `Sentry`_ integration: ``pip install graphite-api[sentry]``. +* For `Sentry`_ integration: ``pip install graphite-render[sentry]``. -* For `Cyanite`_ integration: ``pip install graphite-api[cyanite]``. +* For `Cyanite`_ integration: ``pip install graphite-render[cyanite]``. -* For Cache support: ``pip install graphite-api[cache]``. You'll also need the +* For Cache support: ``pip install graphite-render[cache]``. You'll also need the driver for the type of caching you want to use (Redis, Memcache, etc.). See the `Flask-Cache docs`_ for supported cache types. @@ -76,4 +76,4 @@ extra dependencies: You can also combine several extra dependencies:: - $ pip install graphite-api[sentry,cyanite] + $ pip install graphite-render[sentry,cyanite] diff --git a/docs/releases.rst b/docs/releases.rst index 250078fb..54d8c5e9 100644 --- a/docs/releases.rst +++ b/docs/releases.rst @@ -1,11 +1,11 @@ -Graphite-API releases +Graphite-Render releases ===================== 1.1.3 -- 2016-05-23 ------------------- * Remove extra parenthesis from ``aliasByMetric()``. -* Fix leap year handling in ``graphite_api.render.attime``. +* Fix leap year handling in ``graphite_render.render.attime``. * Allow colon and hash in node names in ``aliasByNode()`` * Fix calling ``reduceFunction`` in ``reduceSeries`` * Revert a whisper patch which broke multiple retentions handling. diff --git a/graphite_api/__init__.py b/graphite_render/__init__.py similarity index 100% rename from graphite_api/__init__.py rename to graphite_render/__init__.py diff --git a/graphite_api/_vendor/__init__.py b/graphite_render/_vendor/__init__.py similarity index 100% rename from graphite_api/_vendor/__init__.py rename to graphite_render/_vendor/__init__.py diff --git a/graphite_api/_vendor/whisper.py b/graphite_render/_vendor/whisper.py similarity index 100% rename from graphite_api/_vendor/whisper.py rename to graphite_render/_vendor/whisper.py diff --git a/graphite_api/app.py b/graphite_render/app.py similarity index 100% rename from graphite_api/app.py rename to graphite_render/app.py diff --git a/graphite_api/carbonlink.py b/graphite_render/carbonlink.py similarity index 100% rename from graphite_api/carbonlink.py rename to graphite_render/carbonlink.py diff --git a/graphite_api/config.py b/graphite_render/config.py similarity index 94% rename from graphite_api/config.py rename to graphite_render/config.py index 2408a7c7..1fd74516 100644 --- a/graphite_api/config.py +++ b/graphite_render/config.py @@ -38,11 +38,11 @@ def _get_local_timezone_name(): default_conf = { 'search_index': '/srv/graphite/index', 'finders': [ - 'graphite_api.finders.whisper.WhisperFinder', + 'graphite_render.finders.whisper.WhisperFinder', ], 'functions': [ - 'graphite_api.functions.SeriesFunctions', - 'graphite_api.functions.PieFunctions', + 'graphite_render.functions.SeriesFunctions', + 'graphite_render.functions.PieFunctions', ], 'whisper': { 'directories': [ @@ -67,7 +67,7 @@ def __init__(self, *args, **kwargs): self._bound = structlog.BoundLoggerBase(None, processors, {}) def format(self, record): - if not record.name.startswith('graphite_api'): + if not record.name.startswith('graphite_render'): kw = dict(((k, v) for k, v in record.__dict__.items() if k not in NON_EXTRA)) kw['logger'] = record.name @@ -89,7 +89,7 @@ def error_handler(e): def configure(app): config_file = os.environ.get('GRAPHITE_API_CONFIG', - '/etc/graphite-api.yaml') + '/etc/graphite-render.yaml') if os.path.exists(config_file): with open(config_file) as f: config = yaml.safe_load(f) @@ -126,7 +126,7 @@ def configure(app): "Flask-Caching`.") else: cache_conf = {'CACHE_DEFAULT_TIMEOUT': 60, - 'CACHE_KEY_PREFIX': 'graphite-api:'} + 'CACHE_KEY_PREFIX': 'graphite-render:'} for key, value in config['cache'].items(): cache_conf['CACHE_{0}'.format(key.upper())] = value app.cache = Cache(app, config=cache_conf) @@ -187,7 +187,7 @@ def configure_logging(config): 'level': 'DEBUG', 'propagate': False, }) - config['logging']['loggers'].setdefault('graphite_api', { + config['logging']['loggers'].setdefault('graphite_render', { 'handlers': ['raw'], 'level': 'DEBUG', }) diff --git a/graphite_api/encoders.py b/graphite_render/encoders.py similarity index 100% rename from graphite_api/encoders.py rename to graphite_render/encoders.py diff --git a/graphite_api/evaluator.py b/graphite_render/evaluator.py similarity index 100% rename from graphite_api/evaluator.py rename to graphite_render/evaluator.py diff --git a/graphite_api/finders/__init__.py b/graphite_render/finders/__init__.py similarity index 100% rename from graphite_api/finders/__init__.py rename to graphite_render/finders/__init__.py diff --git a/graphite_api/finders/whisper.py b/graphite_render/finders/whisper.py similarity index 100% rename from graphite_api/finders/whisper.py rename to graphite_render/finders/whisper.py diff --git a/graphite_api/functions.py b/graphite_render/functions.py similarity index 100% rename from graphite_api/functions.py rename to graphite_render/functions.py diff --git a/graphite_api/intervals.py b/graphite_render/intervals.py similarity index 100% rename from graphite_api/intervals.py rename to graphite_render/intervals.py diff --git a/graphite_api/middleware.py b/graphite_render/middleware.py similarity index 100% rename from graphite_api/middleware.py rename to graphite_render/middleware.py diff --git a/graphite_api/node.py b/graphite_render/node.py similarity index 100% rename from graphite_api/node.py rename to graphite_render/node.py diff --git a/graphite_api/readers.py b/graphite_render/readers.py similarity index 100% rename from graphite_api/readers.py rename to graphite_render/readers.py diff --git a/graphite_api/render/__init__.py b/graphite_render/render/__init__.py similarity index 100% rename from graphite_api/render/__init__.py rename to graphite_render/render/__init__.py diff --git a/graphite_api/render/attime.py b/graphite_render/render/attime.py similarity index 100% rename from graphite_api/render/attime.py rename to graphite_render/render/attime.py diff --git a/graphite_api/render/datalib.py b/graphite_render/render/datalib.py similarity index 100% rename from graphite_api/render/datalib.py rename to graphite_render/render/datalib.py diff --git a/graphite_api/render/glyph.py b/graphite_render/render/glyph.py similarity index 100% rename from graphite_api/render/glyph.py rename to graphite_render/render/glyph.py diff --git a/graphite_api/render/grammar.py b/graphite_render/render/grammar.py similarity index 100% rename from graphite_api/render/grammar.py rename to graphite_render/render/grammar.py diff --git a/graphite_api/storage.py b/graphite_render/storage.py similarity index 100% rename from graphite_api/storage.py rename to graphite_render/storage.py diff --git a/graphite_api/utils.py b/graphite_render/utils.py similarity index 100% rename from graphite_api/utils.py rename to graphite_render/utils.py diff --git a/pyproject.toml b/pyproject.toml index 3676e5aa..3169a394 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools>=61.0", "wheel"] build-backend = "setuptools.build_meta" [project] -name = "graphite-api" +name = "graphite-render" version = "1.1.4" description = "Graphite-web, without the interface. Just the rendering HTTP API." readme = "README.rst" @@ -51,8 +51,8 @@ cache = ["flask-caching"] statsd = ["statsd"] [project.urls] -Homepage = "https://github.com/brutasse/graphite-api" -Repository = "https://github.com/brutasse/graphite-api" +Homepage = "https://github.com/brutasse/graphite-render" +Repository = "https://github.com/brutasse/graphite-render" [tool.setuptools] zip-safe = false diff --git a/tests/__init__.py b/tests/__init__.py index 378e36bb..49344b74 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -12,13 +12,13 @@ except ImportError: import unittest -from graphite_api._vendor import whisper -from graphite_api.app import app -from graphite_api.finders.whisper import WhisperFinder -from graphite_api.storage import Store +from graphite_render._vendor import whisper +from graphite_render.app import app +from graphite_render.finders.whisper import WhisperFinder +from graphite_render.storage import Store -DATA_DIR = '/tmp/graphite-api-data.{0}'.format(os.getpid()) +DATA_DIR = '/tmp/graphite-render-data.{0}'.format(os.getpid()) WHISPER_DIR = os.path.join(DATA_DIR, 'whisper') SEARCH_INDEX = os.path.join(DATA_DIR, 'index') diff --git a/tests/conf.yaml b/tests/conf.yaml index 2a7eae10..5fccde07 100644 --- a/tests/conf.yaml +++ b/tests/conf.yaml @@ -1,4 +1,4 @@ -search_index: /tmp/graphite-api-index +search_index: /tmp/graphite-render-index time_zone: UTC allowed_origins: - example.com @@ -13,7 +13,7 @@ logging: stdout: class: logging.StreamHandler loggers: - graphite_api: + graphite_render: handlers: - stdout propagate: true diff --git a/tests/test_attime.py b/tests/test_attime.py index 43fdeb3e..7063d9ef 100644 --- a/tests/test_attime.py +++ b/tests/test_attime.py @@ -2,7 +2,7 @@ import time import pytz -from graphite_api.render.attime import parseATTime +from graphite_render.render.attime import parseATTime from . import TestCase diff --git a/tests/test_carbonlink.py b/tests/test_carbonlink.py index 0c259002..1b7bdb6d 100644 --- a/tests/test_carbonlink.py +++ b/tests/test_carbonlink.py @@ -6,8 +6,8 @@ except ImportError: from mock import patch -from graphite_api import carbonlink -from graphite_api.carbonlink import CarbonLinkPool, ConsistentHashRing +from graphite_render import carbonlink +from graphite_render.carbonlink import CarbonLinkPool, ConsistentHashRing from . import TestCase diff --git a/tests/test_encoders.py b/tests/test_encoders.py index ec34e797..69685aad 100644 --- a/tests/test_encoders.py +++ b/tests/test_encoders.py @@ -1,4 +1,4 @@ -from graphite_api.encoders import JSONEncoder +from graphite_render.encoders import JSONEncoder from . import TestCase diff --git a/tests/test_finders.py b/tests/test_finders.py index 242cbbdd..242a4a35 100644 --- a/tests/test_finders.py +++ b/tests/test_finders.py @@ -9,12 +9,12 @@ except ImportError: from mock import patch -from graphite_api._vendor import whisper -from graphite_api.app import app -from graphite_api.finders.whisper import scandir -from graphite_api.intervals import Interval, IntervalSet -from graphite_api.node import BranchNode, LeafNode -from graphite_api.storage import Store +from graphite_render._vendor import whisper +from graphite_render.app import app +from graphite_render.finders.whisper import scandir +from graphite_render.intervals import Interval, IntervalSet +from graphite_render.node import BranchNode, LeafNode +from graphite_render.storage import Store from . import TestCase, WHISPER_DIR @@ -84,7 +84,7 @@ class WhisperFinderTest(TestCase): def scandir_mock(d): return scandir(d) - @patch('graphite_api.finders.whisper.scandir', wraps=scandir_mock) + @patch('graphite_render.finders.whisper.scandir', wraps=scandir_mock) def test_whisper_finder(self, scandir_mocked): for db in ( ('whisper_finder', 'foo.wsp'), @@ -160,7 +160,7 @@ def test_whisper_finder(self, scandir_mocked): finally: scandir_mocked.call_count = 0 - @patch('graphite_api.finders.whisper.scandir', wraps=scandir_mock) + @patch('graphite_render.finders.whisper.scandir', wraps=scandir_mock) def test_gzipped_whisper_finder(self, scandir_mocked): for db in ( ('gzwhisper_finder', 'foo.wsp'), diff --git a/tests/test_functions.py b/tests/test_functions.py index 0d79c892..494c114f 100644 --- a/tests/test_functions.py +++ b/tests/test_functions.py @@ -11,10 +11,10 @@ except ImportError: from mock import patch, call, MagicMock -from graphite_api import functions -from graphite_api.app import app -from graphite_api.render.attime import parseATTime -from graphite_api.render.datalib import TimeSeries +from graphite_render import functions +from graphite_render.app import app +from graphite_render.render.attime import parseATTime +from graphite_render.render.datalib import TimeSeries from . import TestCase @@ -1069,7 +1069,7 @@ def mock_evaluate(reqCtx, tokens, store=None): 20, 25, 1, [None, None, None, None, None]) ] - with patch('graphite_api.functions.evaluateTokens', mock_evaluate): + with patch('graphite_render.functions.evaluateTokens', mock_evaluate): result = functions.exponentialMovingAverage({ 'args': ({}, {}), 'startTime': datetime(1970, 1, 1, 0, 0, 0, 0, pytz.utc), @@ -1107,7 +1107,7 @@ def mock_evaluate(reqCtx, tokens, store=None): 1.517, 2.15, 2.85, 3.604, 4.404]) ] - with patch('graphite_api.functions.evaluateTokens', mock_evaluate): + with patch('graphite_render.functions.evaluateTokens', mock_evaluate): result = functions.exponentialMovingAverage({ 'args': ({}, {}), 'startTime': datetime(1970, 1, 1, 0, 0, 0, 0, pytz.utc), @@ -1134,7 +1134,7 @@ def mock_evaluate(reqCtx, tokens, store=None): expectedResults = [] - with patch('graphite_api.functions.evaluateTokens', mock_evaluate): + with patch('graphite_render.functions.evaluateTokens', mock_evaluate): result = functions.exponentialMovingAverage({ 'args': ({}, {}), 'startTime': datetime(1970, 1, 1, 0, 0, 0, 0, pytz.utc), @@ -1174,7 +1174,7 @@ def frange(x, y, jump): '"-1min")', 660, 700, 1, frange(29.5, 69.5, 1)), ]] - with patch('graphite_api.functions.evaluateTokens', mock_evaluate): + with patch('graphite_render.functions.evaluateTokens', mock_evaluate): result = functions.exponentialMovingAverage({ 'args': ({}, {}), 'startTime': datetime(1970, 1, 1, 0, 0, 0, 0, pytz.utc), @@ -1220,7 +1220,7 @@ def mock_evaluate(reqCtx, tokens, store=None): 20, 25, 1, [None, None, None, None, None]) ] - with patch('graphite_api.functions.evaluateTokens', mock_evaluate): + with patch('graphite_render.functions.evaluateTokens', mock_evaluate): result = functions.movingMedian({ 'args': ({}, {}), 'startTime': datetime(1970, 1, 1, 0, 0, 0, 0, pytz.utc), @@ -1256,7 +1256,7 @@ def mock_evaluate(reqCtx, tokens, store=None): 20, 30, 1, [None, 0, 1, 1, 2, 2, 3, 3, 4, 4]) ] - with patch('graphite_api.functions.evaluateTokens', mock_evaluate): + with patch('graphite_render.functions.evaluateTokens', mock_evaluate): result = functions.movingMedian({ 'args': ({}, {}), 'startTime': datetime(1970, 1, 1, 0, 0, 0, 0, pytz.utc), @@ -1283,7 +1283,7 @@ def mock_evaluate(reqCtx, tokens, store=None): expectedResults = [] - with patch('graphite_api.functions.evaluateTokens', mock_evaluate): + with patch('graphite_render.functions.evaluateTokens', mock_evaluate): result = functions.movingMedian({ 'args': ({}, {}), 'startTime': datetime(1970, 1, 1, 0, 0, 0, 0, pytz.utc), @@ -1316,7 +1316,7 @@ def mock_evaluate(reqCtx, tokens, store=None): 660, 700, 1, range(30, 70)), ]] - with patch('graphite_api.functions.evaluateTokens', mock_evaluate): + with patch('graphite_render.functions.evaluateTokens', mock_evaluate): result = functions.movingMedian({ 'args': ({}, {}), 'startTime': datetime(1970, 1, 1, 0, 0, 0, 0, pytz.utc), @@ -1415,7 +1415,7 @@ def mock_evaluate(reqCtx, tokens, store=None): 20, 25, 1, [None, None, None, None, None]) ] - with patch('graphite_api.functions.evaluateTokens', mock_evaluate): + with patch('graphite_render.functions.evaluateTokens', mock_evaluate): result = functions.movingAverage({ 'args': ({}, {}), 'startTime': datetime(1970, 1, 1, 0, 0, 0, 0, pytz.utc), @@ -1452,7 +1452,7 @@ def mock_evaluate(reqCtx, tokens, store=None): 2.0, 2.5, 3.0, 3.5, 4.0]) ] - with patch('graphite_api.functions.evaluateTokens', mock_evaluate): + with patch('graphite_render.functions.evaluateTokens', mock_evaluate): result = functions.movingAverage({ 'args': ({}, {}), 'startTime': datetime(1970, 1, 1, 0, 0, 0, 0, pytz.utc), @@ -1479,7 +1479,7 @@ def mock_evaluate(reqCtx, tokens, store=None): expectedResults = [] - with patch('graphite_api.functions.evaluateTokens', mock_evaluate): + with patch('graphite_render.functions.evaluateTokens', mock_evaluate): result = functions.movingAverage({ 'args': ({}, {}), 'startTime': datetime(1970, 1, 1, 0, 0, 0, 0, pytz.utc), @@ -1517,7 +1517,7 @@ def frange(x, y, jump): 660, 700, 1, frange(29.5, 69.5, 1)), ]] - with patch('graphite_api.functions.evaluateTokens', mock_evaluate): + with patch('graphite_render.functions.evaluateTokens', mock_evaluate): result = functions.movingAverage({ 'args': ({}, {}), 'startTime': datetime(1970, 1, 1, 0, 0, 0, 0, pytz.utc), @@ -1563,7 +1563,7 @@ def mock_evaluate(reqCtx, tokens, store=None): 20, 25, 1, [None, None, None, None, None]) ] - with patch('graphite_api.functions.evaluateTokens', mock_evaluate): + with patch('graphite_render.functions.evaluateTokens', mock_evaluate): result = functions.movingMin({ 'args': ({}, {}), 'startTime': datetime(1970, 1, 1, 0, 0, 0, 0, pytz.utc), @@ -1599,7 +1599,7 @@ def mock_evaluate(reqCtx, tokens, store=None): 20, 30, 1, [None, 0, 0, 0, 0, 0, 0, 0, 0, 0]) ] - with patch('graphite_api.functions.evaluateTokens', mock_evaluate): + with patch('graphite_render.functions.evaluateTokens', mock_evaluate): result = functions.movingMin({ 'args': ({}, {}), 'startTime': datetime(1970, 1, 1, 0, 0, 0, 0, pytz.utc), @@ -1626,7 +1626,7 @@ def mock_evaluate(reqCtx, tokens, store=None): expectedResults = [] - with patch('graphite_api.functions.evaluateTokens', mock_evaluate): + with patch('graphite_render.functions.evaluateTokens', mock_evaluate): result = functions.movingMin({ 'args': ({}, {}), 'startTime': datetime(1970, 1, 1, 0, 0, 0, 0, pytz.utc), @@ -1659,7 +1659,7 @@ def mock_evaluate(reqCtx, tokens, store=None): 660, 700, 1, range(0, 40)), ]] - with patch('graphite_api.functions.evaluateTokens', mock_evaluate): + with patch('graphite_render.functions.evaluateTokens', mock_evaluate): result = functions.movingMin({ 'args': ({}, {}), 'startTime': datetime(1970, 1, 1, 0, 0, 0, 0, pytz.utc), @@ -1705,7 +1705,7 @@ def mock_evaluate(reqCtx, tokens, store=None): 20, 25, 1, [None, None, None, None, None]) ] - with patch('graphite_api.functions.evaluateTokens', mock_evaluate): + with patch('graphite_render.functions.evaluateTokens', mock_evaluate): result = functions.movingMax({ 'args': ({}, {}), 'startTime': datetime(1970, 1, 1, 0, 0, 0, 0, pytz.utc), @@ -1741,7 +1741,7 @@ def mock_evaluate(reqCtx, tokens, store=None): 20, 30, 1, [None, 0, 1, 2, 3, 4, 5, 6, 7, 8]) ] - with patch('graphite_api.functions.evaluateTokens', mock_evaluate): + with patch('graphite_render.functions.evaluateTokens', mock_evaluate): result = functions.movingMax({ 'args': ({}, {}), 'startTime': datetime(1970, 1, 1, 0, 0, 0, 0, pytz.utc), @@ -1768,7 +1768,7 @@ def mock_evaluate(reqCtx, tokens, store=None): expectedResults = [] - with patch('graphite_api.functions.evaluateTokens', mock_evaluate): + with patch('graphite_render.functions.evaluateTokens', mock_evaluate): result = functions.movingMax({ 'args': ({}, {}), 'startTime': datetime(1970, 1, 1, 0, 0, 0, 0, pytz.utc), @@ -1801,7 +1801,7 @@ def mock_evaluate(reqCtx, tokens, store=None): 660, 700, 1, range(59, 99)), ]] - with patch('graphite_api.functions.evaluateTokens', mock_evaluate): + with patch('graphite_render.functions.evaluateTokens', mock_evaluate): result = functions.movingMax({ 'args': ({}, {}), 'startTime': datetime(1970, 1, 1, 0, 0, 0, 0, pytz.utc), @@ -1847,7 +1847,7 @@ def mock_evaluate(reqCtx, tokens, store=None): 20, 25, 1, [None, None, None, None, None]) ] - with patch('graphite_api.functions.evaluateTokens', mock_evaluate): + with patch('graphite_render.functions.evaluateTokens', mock_evaluate): result = functions.movingSum({ 'args': ({}, {}), 'startTime': datetime(1970, 1, 1, 0, 0, 0, 0, pytz.utc), @@ -1883,7 +1883,7 @@ def mock_evaluate(reqCtx, tokens, store=None): 20, 30, 1, [None, 0, 1, 3, 6, 10, 15, 21, 28, 36]) ] - with patch('graphite_api.functions.evaluateTokens', mock_evaluate): + with patch('graphite_render.functions.evaluateTokens', mock_evaluate): result = functions.movingSum({ 'args': ({}, {}), 'startTime': datetime(1970, 1, 1, 0, 0, 0, 0, pytz.utc), @@ -1910,7 +1910,7 @@ def mock_evaluate(reqCtx, tokens, store=None): expectedResults = [] - with patch('graphite_api.functions.evaluateTokens', mock_evaluate): + with patch('graphite_render.functions.evaluateTokens', mock_evaluate): result = functions.movingSum({ 'args': ({}, {}), 'startTime': datetime(1970, 1, 1, 0, 0, 0, 0, pytz.utc), @@ -1943,7 +1943,7 @@ def mock_evaluate(reqCtx, tokens, store=None): 660, 700, 1, range(1770, 4170, 60)), ]] - with patch('graphite_api.functions.evaluateTokens', mock_evaluate): + with patch('graphite_render.functions.evaluateTokens', mock_evaluate): result = functions.movingSum({ 'args': ({}, {}), 'startTime': datetime(1970, 1, 1, 0, 0, 0, 0, pytz.utc), @@ -2427,7 +2427,7 @@ def mock_evaluate(reqCtx, tokens, store=None): 605400, 700, 1, []) ] - with patch('graphite_api.functions.evaluateTokens', mock_evaluate): + with patch('graphite_render.functions.evaluateTokens', mock_evaluate): result = functions.holtWintersForecast({ 'args': ({}, {}), 'startTime': datetime(1970, 2, 1, 0, 0, 0, 0, pytz.utc), @@ -2508,7 +2508,7 @@ def mock_evaluate(reqCtx, tokens, store=None): expectedResults[1][0].options = {'invisible': True, 'stacked': True} expectedResults[1][1].options = {'stacked': True} - with patch('graphite_api.functions.evaluateTokens', mock_evaluate): + with patch('graphite_render.functions.evaluateTokens', mock_evaluate): result = functions.holtWintersConfidenceBands({ 'args': ({}, {}), 'startTime': datetime(1970, 2, 1, 0, 0, 0, 0, pytz.utc), diff --git a/tests/test_intervals.py b/tests/test_intervals.py index b1a18270..8bd1ece2 100644 --- a/tests/test_intervals.py +++ b/tests/test_intervals.py @@ -1,4 +1,4 @@ -from graphite_api.intervals import Interval, IntervalSet, union_overlapping +from graphite_render.intervals import Interval, IntervalSet, union_overlapping from . import TestCase diff --git a/tests/test_metrics.py b/tests/test_metrics.py index 21e651dd..b8f651d9 100644 --- a/tests/test_metrics.py +++ b/tests/test_metrics.py @@ -2,7 +2,7 @@ import os.path import time -from graphite_api._vendor import whisper +from graphite_render._vendor import whisper from . import TestCase, WHISPER_DIR diff --git a/tests/test_paths.py b/tests/test_paths.py index c928a6f8..2903a3c4 100644 --- a/tests/test_paths.py +++ b/tests/test_paths.py @@ -1,4 +1,4 @@ -from graphite_api.app import pathsFromTarget +from graphite_render.app import pathsFromTarget from . import TestCase diff --git a/tests/test_render.py b/tests/test_render.py index 5e84f68c..dd8ed27d 100644 --- a/tests/test_render.py +++ b/tests/test_render.py @@ -3,7 +3,7 @@ import os import time -from graphite_api._vendor import whisper +from graphite_render._vendor import whisper from . import TestCase, WHISPER_DIR diff --git a/tests/test_render_datalib.py b/tests/test_render_datalib.py index 1cea18f6..8b4fc8cb 100644 --- a/tests/test_render_datalib.py +++ b/tests/test_render_datalib.py @@ -1,4 +1,4 @@ -from graphite_api.render.datalib import nonempty, TimeSeries +from graphite_render.render.datalib import nonempty, TimeSeries from . import TestCase diff --git a/tests/test_render_glyph.py b/tests/test_render_glyph.py index 7d8f2b92..8dbfb367 100644 --- a/tests/test_render_glyph.py +++ b/tests/test_render_glyph.py @@ -1,8 +1,8 @@ import copy -from graphite_api.render import glyph -from graphite_api.render.datalib import TimeSeries -from graphite_api.utils import to_seconds +from graphite_render.render import glyph +from graphite_render.render.datalib import TimeSeries +from graphite_render.utils import to_seconds from . import TestCase diff --git a/tests/test_storage.py b/tests/test_storage.py index d14289e4..23d7fd78 100644 --- a/tests/test_storage.py +++ b/tests/test_storage.py @@ -1,6 +1,6 @@ import time -from graphite_api.storage import FindQuery +from graphite_render.storage import FindQuery from . import TestCase diff --git a/tox.ini b/tox.ini index 02c80d3f..d7d3978c 100644 --- a/tox.ini +++ b/tox.ini @@ -52,7 +52,7 @@ deps = flake8-import-order flake8-bugbear commands = - flake8 {toxinidir}/graphite_api {toxinidir}/tests + flake8 {toxinidir}/graphite_render {toxinidir}/tests [testenv:docs] changedir = docs