{"id":13530680,"url":"https://github.com/InfluxGraph/influxgraph","last_synced_at":"2025-04-01T18:32:13.803Z","repository":{"id":62570967,"uuid":"70264502","full_name":"InfluxGraph/influxgraph","owner":"InfluxGraph","description":"Graphite InfluxDB backend. InfluxDB storage finder / plugin for Graphite API.","archived":false,"fork":false,"pushed_at":"2018-11-07T11:49:29.000Z","size":1267,"stargazers_count":93,"open_issues_count":0,"forks_count":23,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-19T12:07:09.869Z","etag":null,"topics":["grafana","graphite","graphite-api","influxdb","metrics","metrics-databases","metrics-gathering","metrics-library","metrics-visualization","metrics2","monitoring","timeseries","visualisation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/InfluxGraph.png","metadata":{"files":{"readme":"README.rst","changelog":"Changelog.rst","contributing":".github/CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":".github/code_of_conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-07T16:36:30.000Z","updated_at":"2024-11-20T13:37:34.000Z","dependencies_parsed_at":"2022-11-03T17:01:12.831Z","dependency_job_id":null,"html_url":"https://github.com/InfluxGraph/influxgraph","commit_stats":null,"previous_names":[],"tags_count":53,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InfluxGraph%2Finfluxgraph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InfluxGraph%2Finfluxgraph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InfluxGraph%2Finfluxgraph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InfluxGraph%2Finfluxgraph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/InfluxGraph","download_url":"https://codeload.github.com/InfluxGraph/influxgraph/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246691696,"owners_count":20818556,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["grafana","graphite","graphite-api","influxdb","metrics","metrics-databases","metrics-gathering","metrics-library","metrics-visualization","metrics2","monitoring","timeseries","visualisation"],"created_at":"2024-08-01T07:00:53.427Z","updated_at":"2025-04-01T18:32:13.427Z","avatar_url":"https://github.com/InfluxGraph.png","language":"Python","funding_links":[],"categories":["Consuming data from InfluxDB"],"sub_categories":["Dashboards and visualization"],"readme":"InfluxGraph\n=================\n\nAn `InfluxDB`_ storage plugin for `Graphite-API`_. Graphite with InfluxDB data store from any kind of schema(s) used in the DB.\n\n.. image:: https://img.shields.io/pypi/v/influxgraph.svg\n  :target: https://pypi.python.org/pypi/influxgraph\n  :alt: Latest Version\n.. image:: https://travis-ci.org/InfluxGraph/influxgraph.svg?branch=master\n  :target: https://travis-ci.org/InfluxGraph/influxgraph\n  :alt: CI status\n.. image:: https://codecov.io/gh/InfluxGraph/influxgraph/branch/master/graph/badge.svg\n  :target: https://codecov.io/gh/InfluxGraph/influxgraph\n.. image:: https://readthedocs.org/projects/influxgraph/badge/?version=latest\n  :target: http://influxgraph.readthedocs.io/en/latest/?badge=latest\n  :alt: Documentation Status\n.. image:: https://img.shields.io/pypi/wheel/influxgraph.svg\n   :target: https://pypi.python.org/pypi/influxgraph\n.. image:: https://img.shields.io/pypi/pyversions/influxgraph.svg\n   :target: https://pypi.python.org/pypi/influxgraph\n\n\nThis project started as a re-write of `graphite influxdb \u003chttps://github.com/vimeo/graphite-influxdb\u003e`_, now a separate project.\n\n\nInstallation\n=============\n\nDocker Compose\n---------------\n\nIn `compose directory \u003chttps://github.com/InfluxGraph/influxgraph/tree/master/docker/compose\u003e`_ can be found docker-compose configuration that will spawn all necessary services for a complete monitoring solution with:\n\n* InfluxDB\n* Telegraf\n* Graphite API with InfluxGraph\n* Grafana dashboard\n\nTo use, within compose directory run:\n\n.. code-block:: shell\n\n   docker-compose up\n\nGrafana will be running on ``http://localhost:3000`` with Graphite datasource for InfluxDB data available at ``http://localhost``. Add a new Graphite datasource to Grafana - default Grafana user/pass is admin/admin - to create dashboards with.\n\nSee `compose configuration readme \u003chttps://github.com/InfluxGraph/influxgraph/tree/master/docker/compose\u003e`_ for more details.\n\nDocker Image\n-------------\n\n.. code-block:: shell\n\n  docker pull influxgraph/influxgraph\n  docker create  --name=influxgraph -p 8000:80 influxgraph/influxgraph\n  docker start influxgraph\n\nThere will now be a Graphite-API running on ``localhost:8000`` from the container with a default InfluxDB configuration and memcache enabled. Finder expects InfluxDB to be running on ``localhost:8086`` by default.\n\nThe image will use a supplied ``graphite-api.yaml`` on build, when ``docker build`` is called on an InfluxGraph image.\n\n`Docker file \u003chttps://github.com/InfluxGraph/influxgraph/blob/master/docker/Dockerfile\u003e`_ used to build container can be found under ``docker`` directory of the repository.\n\n.. note::\n\n  If having issues with the container accessing the host's InfluxDB service then either use ``--network=\"host\"`` when launching the container or build a new image with a provided configuration file containing the correct `InfluxDB host:port \u003chttps://github.com/InfluxGraph/influxgraph/blob/master/docker/graphite-api.yaml#L4\u003e`_ destination.\n\nManual Installation\n---------------------\n\n.. code-block:: shell\n\n  pip install influxgraph\n\nUse of a local `memcached` service is highly recommended - see configuration section on how to enable.\n\nMimimal configuration for Graphite-API is below. See `Full Configuration Example`_ for all possible configuration options.\n\n``/etc/graphite-api.yaml``\n\n.. code-block:: yaml\n\n  finders:\n    - influxgraph.InfluxDBFinder\n\nSee the `Wiki \u003chttps://github.com/InfluxGraph/influxgraph/wiki\u003e`_ and `Configuration`_ section for details.\n\n.. contents:: Table of Contents\n\nMain features\n==============\n\n* InfluxDB Graphite template support - expose InfluxDB tagged data as Graphite metrics with configurable metric paths\n* Dynamically calculated group by intervals based on query date/time range - fast queries regardless of the date/time they span\n* Configurable per-query aggregation functions by regular expression pattern\n* Configurable per-query retention policies by query date/time range. Automatically use pre-calculated downsampled data in a retention policy for historical data\n* Fast in-memory index for Graphite metric path queries as a Python native code extension\n* Multi-fetch enabled - fetch data for multiple metrics with one query to InfluxDB\n* Memcached integration\n* Python 3 and PyPy compatibility\n* Good performance even with extremely large number of metrics in the DB - generated queries are guaranteed to have ``O(1)`` performance characteristics\n\nGoogle User's Group\n=====================\n\nThere is a `Google user's group for discussion \u003chttps://groups.google.com/forum/#!forum/influxgraph\u003e`_ which is open to the public.\n\nGoals\n======\n\n* InfluxDB as a drop-in replacement data store to the Graphite query API\n* Backwards compatibility with existing Graphite API clients like Grafana and Graphite installations migrated to InfluxDB data stores using Graphite input service *with or without* Graphite template configuration\n* Expose native InfluxDB line protocol ingested data via the Graphite API\n* Clean, readable code with complete documentation for public endpoints\n* Complete code coverage with both unit and integration testing. Code has `\u003e90%` test coverage and is integration tested against a real InfluxDB service\n* Good performance at large scale. InfluxGraph is used in production with good performance on InfluxDB nodes with cardinality exceeding 5M and a write rate of over 5M metrics/minute or 66K/second.\n\nThe first three goals provide both\n\n- A backwards compatible migration path for existing Graphite installations to use InfluxDB as a drop-in storage back-end replacement with no API client side changes required, meaning existing Grafana or other dashboards continue to work as-is.\n- A way for native InfluxDB collection agents to expose their data via the *Graphite API* which allows the use of any Graphite API talking tool, the plethora of Graphite API functions, custom functions, functions across series, multi-series plotting and functions via Graphite glob expressions et al.\n\nAs of this time of writing, no alternatives exist with similar functionality, performance and compatibility.\n\nNon-Goals\n==========\n\n* Graphite-Web support from the official Graphite project\n\nDependencies\n=============\n\nWith the exception of `InfluxDB`_ itself, the other dependencies are installed automatically by ``pip``.\n\n* ``influxdb`` Python module\n* `Graphite-API`_\n* ``python-memcached`` Python module\n* `InfluxDB`_ service, versions ``1.0`` or higher\n\nInfluxDB Graphite metric templates\n==================================\n\n`InfluxGraph` can make use of any InfluxDB data and expose them as Graphite API metrics, as well as make use of Graphite metrics added to InfluxDB as-is sans tags.\n\nEven data written to InfluxDB by native InfluxDB API clients can be exposed as Graphite metrics, allowing transparent to clients use of the Graphite API with InfluxDB acting as its storage back-end.\n\nTo make use of tagged InfluxDB data, the finder needs to know how to generate a Graphite metric path from the tags used by InfluxDB.\n\nThe easiest way to do this is to use the Graphite service in InfluxDB with configured templates which can be used as-is in `InfluxGraph`_ configuration - see `Full Configuration Example`_ section for details. This presumes existing collection agents are using the Graphite line protocol to write to InfluxDB via its Graphite input service.\n\nIf, on the other hand, native `InfluxDB`_ metrics collection agents like `Telegraf \u003chttps://www.influxdata.com/time-series-platform/telegraf/\u003e`_ are used, that data can too be exposed as Graphite metrics by writing appropriate template(s) in Graphite-API configuration alone.\n\nSee `Telegraf default configuration template \u003chttps://github.com/InfluxGraph/influxgraph/wiki/Telegraf-default-configuration-template\u003e`_ for an example of this.\n\nBy default, the storage plugin makes no assumptions that data is tagged, per InfluxDB default Graphite service template configuration as below::\n  \n  [[graphite]]\n    \u003c..\u003e\n    # templates = []\n\n\nRetention policy configuration\n==============================\n\nPending implementation of a feature request that will allow InfluxDB to select and/or merge results from down-sampled data as appropriate, retention policy configuration is needed to support the use-case of down-sampled data being present in non default retention policies:\n\n.. code-block:: yaml\n\n  retention_policies:\n      \u003ctime interval of query\u003e: \u003cretention policy name\u003e\n\nFor example, to make a query with a group by interval of one minute or less, interval above one and less than thirty minutes and interval thirty minutes or above use the retention policies named ``default``, ``10min`` and ``30min`` respectively:\n\n.. code-block:: yaml\n\n  retention_policies:\n      60: default\n      600: 10min\n      1800: 30min\n\nWhile not required, retention policy interval is best kept close to or identical to ``deltas`` interval for best influx query performance.\n\nSee `Full Configuration Example`_ file for additional details.\n\nConfiguration\n=======================\n\nMinimal Configuration\n----------------------\n\nIn graphite-api config file at ``/etc/graphite-api.yaml``:\n\n.. code-block:: yaml\n\n  finders:\n    - influxgraph.InfluxDBFinder\n\nThe folowing default Graphite-API configuration is used if not provided:\n\n.. code-block:: yaml\n\n  influxdb:\n     db: graphite\n\nFull Configuration Example\n---------------------------\n\nSee `Graphite-API example configuration file \u003chttps://github.com/InfluxGraph/influxgraph/blob/master/graphite-api.yaml.example\u003e`_ for a complete configuration example.\n\nAggregation function configuration\n-----------------------------------\n\nThe finder supports configurable aggregation and selector functions to use per metric path regular expression pattern. This is the equivalent of ``storage-aggregation.conf`` in Graphite's ``carbon-cache``.\n\nDefault aggregation function used is ``mean`` if no configuration provided nor any matching configuration.\n\nInfluxGraph has pre-defined aggregation configuration matching ``carbon-cache`` defaults, namely:\n\n.. code-block:: yaml\n\n  aggregation_functions:\n      \\.min$ : min\n      \\.max$ : max\n      \\.last$ : last\n      \\.sum$ : sum\n\nDefaults are overridden if ``aggregation_functions`` is configured in ``graphite-api.yaml`` as shown in configuration example.\n\nAn error will be printed to stderr if a configured aggregation function is not a known valid InfluxDB aggregation or selector method per `InfluxDB function list \u003chttps://docs.influxdata.com/influxdb/v1.1/query_language/functions/\u003e`_.\n\nTransformation functions, for example ``derivative``, may _not_ be used as they require a separate aggregation to be performed. Transformations are performed by Graphite-API instead, which also supports pluggable functions.\n\nKnown InfluxDB aggregation and selector functions are defined at ``influxgraph.constants.INFLUXDB_AGGREGATIONS`` and can be overriden if necessary.\n\n.. note::\n\n   When querying identical fields from multiple measurements InfluxDB allows only *one* aggregation function to be used for all identical fields in the query.\n   \n   In other words, make sure all identical InfluxDB fields matched by a Graphite query pattern, for example ``my_host.cpu.*.*`` have the same aggregation function configured.\n\n   When using neither tagged data nor template configuration, the InfluxDB field to be queried is always ``value``. This is the case where this limitation is (most) relevant.\n\n   ``InfluxGraph`` will use the first aggregation function configured and log a warning message to that effect if a pattern query resolves to multiple aggregation functions.\n\n\nMemcached InfluxDB\n------------------------\n\nMemcached can be used to cache InfluxDB data so the `Graphite-API` can avoid querying the DB if it does not have to.\n\nTTL configuration for memcache as shown in `Full Configuration Example`_ is only for InfluxDB series list with data query TTL set to the grouping interval used.\n\nFor example, for a query spanning twenty-four hours, a group by interval of one minute is used by default. TTL for memcache is set to one minute for that query.\n\nFor a query spanning one month, a fifteen minute group by interval is used by default. TTL is also set to fifteen minutes for that query.\n\nCalculated intervals\n--------------------\n\nA data ``group by`` interval is automatically calculated depending on the date/time range of the query. This keeps data size in check regardless of query range and speeds up graph generation for large ranges.\n\nDefault configuration mirrors what `Grafana`_ uses with the native InfluxDB API.\n\nOverriding the automatically calculated intervals can be done via the optional ``deltas`` configuration. See `Full Configuration Example`_ file for all supported configuration options.\n\nUnlike other Graphite compatible data stores, InfluxDB performs aggregation on data query, not on ingestion. Queries made by InfluxGraph are therefore always aggregation queries with a group by clause.\n\nUsers that wish to retrieve all, non-aggregated, data points regardless of date/time range are advised to query `InfluxDB`_ directly.\n\nVarnish caching InfluxDB API\n----------------------------\n\nThe following is a sample configuration of `Varnish`_ as an HTTP cache in front of InfluxDB's HTTP API. It uses Varnish's default TTL of 60 sec for all InfluxDB queries.\n\nThe intention is for a local (to InfluxDB) Varnish service to cache frequently accessed data and protect the database from multiple identical requests, for example multiple users viewing the same dashboard.\n\nInfluxGraph configuration should use Varnish port to connect to InfluxDB.\n\nUnfortunately, given that clients like Grafana use POST requests for querying the Graphite API, which cannot be cached, using Varnish in front of a Graphite-API webapp would have no effect. Multiple requests for the same dashboard/graph will therefore still hit Graphite-API, but with Varnish in front of InfluxDB the more sensitive DB is spared from duplicated queries.\n\nSubstitute the default ``8086`` backend port with the InfluxDB API port for your installation if needed:\n\n.. code-block:: tcl\n\n  backend default {\n    .host = \"127.0.0.1\";\n    .port = \"8086\";\n  }\n\n  sub vcl_recv {\n    unset req.http.cookie;\n  }\n\nGraphite API example configuration:\n\n.. code-block:: yaml\n\n  finders:\n    - influxgraph.InfluxDBFinder\n  influxdb:\n    port: \u003cvarnish port\u003e\n\nWhere ``\u003cvarnish_port\u003e`` is Varnish's listening port.\n\nAny other HTTP caching service will similarly work just as well.\n\nOptional C Extensions\n======================\n\nIn order of fastest to slowest, here is how the supported interpreters fare with and without C extensions. How much faster depends largely on hardware and compiler used - can expect at least `15x` and `4x` performance increases for CPython with extensions and PyPy respectively compared to standard CPython without extensions.\n\nCPython with extensions will also use about `20x` less memory for the index than either PyPy or CPython without extensions.\n\n#. CPython with C extensions\n#. Pypy\n#. CPython\n\nThere are two performance tests in the repository that can be used to see relative performance with and without extensions, for `index \u003chttps://github.com/InfluxGraph/influxgraph/blob/master/tests/index_perf.py\u003e`_ and `template \u003chttps://github.com/InfluxGraph/influxgraph/blob/master/tests/templates_parse_perf.py\u003e`_ functionality respectively. On PyPy extensions are purposefully disabled.\n\nKnown Limitations\n===================\n\nData *fill* parameter and counter values\n-----------------------------------------\n\n*Changed in version 1.3.6*\n\nAs of version ``1.3.6``, the default *fill* parameter is **null** so as to not add values that do not exist in data - was ``previous`` in prior versions.\n\nThis default will break derivative calculated counter values when data sampling rate exceeds configured interval for the query - see `Calculated intervals`_.\n\nFor example, with a data sampling rate of sixty (60) seconds and default ``deltas`` configuration, queries of thirty (30) minutes and below will use a thirty (30) second interval and will contain null datapoints. This in turn causes Graphite functions like ``derivative`` and ``non_negative_derivative`` to only contain null datapoints.\n\nThe fill parameter is configurable - see `Full Configuration Example`_ - but is currently common for all metric paths.\n\nFor ``derivative`` and related functions to work, either set ``deltas`` configuration to not go below data sampling rate or set *fill* configuration to ``previous``.\n\nIndex for Graphite metric paths\n--------------------------------\n\nThe index implementation via native code extension releases Python's GIL as much as possible, however, there will still be a response time increase while index is being re-built.\n\nWithout extensions response time increase will be much higher - building with extensions is highly recommended.\n\nThat said, building extensions can be disabled by running `setup.py` with the `DISABLE_INFLUXGRAPH_CEXT=1` environment variable set. A notice will be displayed by `setup.py` that extensions have been disabled.\n\nNote that without native extension, performance is much lower and memory use of index much higher.\n\n.. _Varnish: https://www.varnish-cache.org/\n.. _Graphite-API: https://github.com/brutasse/graphite-api\n.. _Grafana: https://github.com/grafana/grafana\n.. _InfluxDB: https://github.com/influxdb/influxdb\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FInfluxGraph%2Finfluxgraph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FInfluxGraph%2Finfluxgraph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FInfluxGraph%2Finfluxgraph/lists"}