Giter Club home page Giter Club logo

statis's Introduction

Statis

A flexible real-time stat tracking library for python and redis.

Statis aims to offer a very simple way to get started with fixed-bucket aggregation. Counters are multi-dimensional using paths and each statistic can be aggregated at different levels of resolution (YEAR, MONTH, DAY, HOUR (default), MINUTE, SECOND).

Statis was heavily inspired by Redistat: https://github.com/jimeh/redistat

Requirements

  • Python 3
  • Redis
  • Docker (optional)

Usage

import statis
import json

stats = statis.Statis('statis-redis', port=6379)

stats.store('personas/c1733467-c272-45b0-84dd-9e345d16a3c8', ['age/33','eyes/blue'] )
stats.store('personas/f528fb69-85ea-4882-86f9-cd6f07c8b400', ['age/22'] )
stats.store('personas/fea80818-ddfa-42ae-adeb-ce2b1dafcc24', ['age/22','eyes/brown'] )
stats.store('personas/bb7ac6ef-a24a-44dd-a013-06cb11fbc606', ['age/43','eyes/blue'])

data = stats.fetch(
    path='personas',
    depth=statis.DAY
)
print(json.dumps(data, indent=4))

Returns:

[
    {
        "age": 4,
        "age/33": 1,
        "eyes": 3,
        "eyes/blue": 2,
        "age/22": 2,
        "eyes/brown": 1,
        "age/43": 1,
        "datekey": "20170806"
    }
]

statis's People

Contributors

jcinis avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

statis's Issues

Bug in make_path

  File "/tmp/src/statis-master/statis.py", line 107, in make_path
    parts[i] = parts[i] and urllib.quote_plus(parts[i]) or ''
  File "/usr/lib/python2.7/urllib.py", line 1293, in quote_plus
    s = quote(s, safe + ' ')
  File "/usr/lib/python2.7/urllib.py", line 1288, in quote
    return ''.join(map(quoter, s))
KeyError: u'\xef'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.