ocredis is a wrapper for the popular [redis-py](https://github.com/andymccurdy/redis-py)
ocredis provides observability using OpenCensus for distributed tracing and metrics.
Installing it
pip install ocredis
Using it
You can initialize exactly how you would for redis.Redis. In fact it is meant to be a drop replacement.
Change the import statement from
>>> import redis
to
>>> import ocredis
Change the client initialization from
>>> client = redis.Redis(host=host, port=port)
to
>>> client = ocredis.OcRedis(host=host, port=port)`
and obviously enabling OpenCensus metrics and exporters as per https://opencensus.io/exporters/supported-exporters/python/
>>> ocredis.register_views()
and the rest is trivial to use then.
For example
>>> import ocredis
>>> ocredis.register_views()
>>> r = ocredis.OcRedis(host='localhost', port=6379)
>>> r.set('foo', 'bar')
True
>>> r.get('foo')
'bar'
Metrics available
calls
latency
key_length
value_length
Metric |
View Name |
Unit |
Tags |
|---|---|---|---|
Latency |
redispy/latency |
ms |
‘error’, ‘method’, ‘status’ |
Calls |
redispy/calls |
1 |
‘error’, ‘method’, ‘status’ |
Key lengths |
redispy/key_length |
By |
‘error’, ‘method’, ‘status’ |
Value lengths |
redispy/value_length |
By |
‘error’, ‘method’, ‘status’ |
Tests
Tests can be run by using pytest, for example
pytest
Metadata
Release files for ocredis 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ocredis-0.0.4.tar.gz | 12.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ocredis-0.0.4-py2-none-any.whl | Python 2 | none | any | Details |
Total release size: 27.0 kB
Release files / ocredis-0.0.4.tar.gz
| Download URL | ocredis-0.0.4.tar.gz |
|---|---|
| Size | 12.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7fdcc8ca1b8c915abe5f270e0b7574d2d2ab1f9d545c9882b9bbde162b3828f1
|
|
BLAKE2b-256 checksum How to use checksums |
06b964a9507d323902dcfdfad57407f22c0883d6b5ae4c772f40ffe2121ca667
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/2.7.15
|
Release files / ocredis-0.0.4-py2-none-any.whl
| Download URL | ocredis-0.0.4-py2-none-any.whl |
|---|---|
| Size | 14.3 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
7b1e90309120a831b6c6c49405ca08dcf2fdbae2338510d65e6a9e12e4b92d3b
|
|
BLAKE2b-256 checksum How to use checksums |
1211266c43988ddb569f277d1c6c8e905b277ab026c038d3a8f19e13bd1a353c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/2.7.15
|