Skip to main content

A wrapper for redis-py, instrumented using OpenCensus for distributed tracing and metrics

Project description

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.

https://badge.fury.io/py/ocredis.svg

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ocredis-0.0.4.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

ocredis-0.0.4-py2-none-any.whl (14.3 kB view details)

Uploaded Python 2

File details

Details for the file ocredis-0.0.4.tar.gz.

File metadata

  • Download URL: ocredis-0.0.4.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for ocredis-0.0.4.tar.gz
Algorithm Hash digest
SHA256 7fdcc8ca1b8c915abe5f270e0b7574d2d2ab1f9d545c9882b9bbde162b3828f1
MD5 54aa96818892870013bbb31d2d4a6579
BLAKE2b-256 06b964a9507d323902dcfdfad57407f22c0883d6b5ae4c772f40ffe2121ca667

See more details on using hashes here.

File details

Details for the file ocredis-0.0.4-py2-none-any.whl.

File metadata

  • Download URL: ocredis-0.0.4-py2-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 2
  • Uploaded using 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

File hashes

Hashes for ocredis-0.0.4-py2-none-any.whl
Algorithm Hash digest
SHA256 7b1e90309120a831b6c6c49405ca08dcf2fdbae2338510d65e6a9e12e4b92d3b
MD5 94f4e08a67f95153505e743e8da39af9
BLAKE2b-256 1211266c43988ddb569f277d1c6c8e905b277ab026c038d3a8f19e13bd1a353c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page