>>> from sentry.app import tsdb
>>> from django.utils import timezone
>>> from datetime import timedelta
>>> end = timezone.now()
>>> tsdb.get_sums(model=tsdb.models.internal, keys=['events.total'],start=end-timedelta(days=30), end=end)['events.total']
15177455
>>> from sentry.nodestore.django.models import Node
>>> Node.objects.count()
13078513
>>>
I just tried that and the number for a single month using the tsdb method is bigger than what I though was the total number of events (Node.objects.count()). Isn’t it weird ?
I am quite new to Python and Sentry, and I have some extra questions:
The following works, but I’m sure this can be done more elegantly, can you tell me how?
tsdb.get_sums(model=tsdb.models.internal, keys=[‘events.total’],start=end-timedelta(days=9999), end=end)[‘events.total’]
I would like to be able to not only have the total number of events, but also per Team and/or Project?