Gnocchi Python Client Library

raw JSON →
7.2.0 verified Fri May 01 auth: no python

Python client library for Gnocchi, a time series data storage and indexing service. Version 7.2.0 is current; active development, release cadence irregular.

pip install gnocchiclient
error ModuleNotFoundError: No module named 'gnocchiclient'
cause Library not installed.
fix
Run pip install gnocchiclient.
error ImportError: cannot import name 'Client' from 'gnocchiclient'
cause Using wrong import path. gnocchiclient top-level does not contain Client directly.
fix
Use from gnocchiclient.v1 import Client.
error gnocchiclient.exceptions.Unauthorized: Authorization failed
cause Missing or invalid authentication token.
fix
Set GNOCCHI_AUTH_TOKEN environment variable or pass auth_token parameter.
breaking In version 4.x, the API client moved from `gnocchiclient.client.Client` to `gnocchiclient.v1.Client`. Old imports will fail.
fix Use `from gnocchiclient.v1 import Client` instead of `from gnocchiclient import Client`.
deprecated The `gnocchiclient.v2` module is deprecated and will be removed in a future release.
fix Use `gnocchiclient.v1` for all operations.

Create a client and list metrics.

from gnocchiclient.v1 import Client
import os

# Optionally set auth token via environment variable
os.environ.setdefault('GNOCCHI_ENDPOINT', 'http://localhost:8041')
os.environ.setdefault('GNOCCHI_AUTH_TOKEN', '')

client = Client(
    endpoint=os.environ['GNOCCHI_ENDPOINT'],
    auth_token=os.environ.get('GNOCCHI_AUTH_TOKEN', '')
)
# List metrics
metrics = client.metric.list()
print(metrics)