Skip to main content
File added late

1 file was added to this release more than 14 days after its initial publication. Inspect the release files before installing.

Overview

graphite-query is a library created from graphite-web in order to make some of its functionality framework neutral, i.e. to require as little dependencies as possible.

Installation

You can install graphite-query by running:

pip install graphite-query

You can also download/clone the github repository, and, inside the directory where you downloaded graphite-query run:

python setup.py install

Usage

This package provides the functions query, eval_qs and get_all_leaf_nodes (all are part of the graphitequery.query subpackage).

query

query takes both positional and keyword arguments, which in turn are taken from graphite-web’s render API except for the graph/format arguments, which are, of course, inapplicable to graphite-query.

In short, its parameters (in positional order) are:

A basic query might look like this:

>>> from graphitequery.query import query
>>> print list(query("graphite-web.compatible.path.expression")[0])

The query function always (even if you supply only one target path) returns a list of instances of graphitequery.query.datalib.TimeSeries, which in turn is a list-like object whose sub-elements are the values stored by graphite (in a whisper database) at particular points in time.

eval_qs

This is a helper function: it takes a URL query string as a parameter. The query string must be compatible with the graphite-web’s render controller. eval_qs internally converts this string to a parameter dictionary that can be passed on to query and calls query.E.g.:

>>> from graphitequery.query import query, eval_qs
>>> print list(eval_qs("format=raw&target=*.*.*")[0])
>>> # The above is the same as:
>>> print list(query(**{"target": "*.*.*"}))

get_all_leaf_nodes

Returns a list of all leaf nodes/targets that are found in the settings.STORAGE_DIR. It doesn’t have any parameters.

Configuring graphite-query

The module graphitequery.settings can be used to set up some of the “package-wide” parameters of graphite-query. You can look into that module to see some of the supported settings. The graphitequery.query subpackage directly imports this module, so one can do a from graphitequery.query import settings for convenience.

Perhaps the most important parameter is STORAGE_DIR, the directory that is used to look for data. By default, this directory is set to /opt/graphite/storage, as this is the default directory used by graphite. You could set this parameter manually, but it’s better to use the provided graphitequery.settings.setup_storage_variables function, as this will set some additional dependant parameters (such as the whisper storage directory etc.). Otherwise, one would have to set those parameters manually also.

Finally, it’s possible to set the STORAGE_DIR parameter with the environment variable GRAPHITE_STORAGE_DIR, prior to running/importing graphite-query. This variable will trigger the setup_storage_variables function to set all of the default directories relative to (GRAPHITE_)STORAGE_DIR.

Metadata

Release files for graphite-query 0.11.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

File added late

1 file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release files before installing.

Source distribution (sdist)

Source distribution for graphite-query 0.11.3
File Size Uploaded
graphite-query-0.11.3.tar.gz 50.8 kB Details

Release files / graphite-query-0.11.3.tar.gz

File added late

This file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release file before installing.

Download URL graphite-query-0.11.3.tar.gz
Size 50.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ba45979af47305007810e96756090bb7f6e60decf7a887cdc9848f44d3b5195a
BLAKE2b-256 checksum
How to use checksums
cf322a22c08cf0d7d529e452a1d1f840cc281d524302471640712e3f5fcf97c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.11.3 This release

1 release file

0.11.2

1 release file

0.11.1

1 release file

0.11.0

1 release file

0.10.10

1 release file

0.10.9

1 release file

0.10.8

1 release file

0.10.7

1 release file

0.10.6

1 release file

0.10.5

1 release file

0.10.4

1 release file

0.10.3

1 release file

0.10.2

1 release file

0.10.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page