Created
May 21, 2013 04:36
-
-
Save dcramer/5617510 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
sentry.tsdb.models | |
~~~~~~~~~~~~~~~~~~ | |
Get a key: | |
>>> key = Key.objects.get_or_create( | |
>>> name='events.group.{}'.format(group_id) | |
>>> ) | |
Increment the key for the current time: | |
>>> now = timezone.now() | |
>>> Point.objects.incr(key, timestamp=now) | |
Periodically flush unused data: | |
>>> if random.random() > 0.9: | |
>>> Point.objects.trim() | |
Get some datas: | |
>>> points = Point.objects.fetch(key, now, now - timedelta(days=1)) | |
>>> for (timestamp, value) in points: | |
>>> print timestamp, value | |
:copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details. | |
:license: BSD, see LICENSE for more details. | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment