Skip to content

Instantly share code, notes, and snippets.

@ehfeng
Created February 21, 2017 21:50
Show Gist options
  • Save ehfeng/49465161b06ae46dc95cd52acce41818 to your computer and use it in GitHub Desktop.
Save ehfeng/49465161b06ae46dc95cd52acce41818 to your computer and use it in GitHub Desktop.
from sentry.app import tsdb
from datetime import timedelta
end = timezone.now()
month_event_total = tsdb.get_sums(
model=tsdb.models.internal,
keys=['events.total'],
start=end - timedelta(days=30),
end=end
)['events.total']
print(month_event_total)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment