Example #1
0
  def handle(self, *args, **options):
    print('Starting...')
    stats = Analytics.admin_stats()
    msg = '\n'.join(['%s\t=\t%s' % stat for stat in stats])

    mail.mail_admins(subject='Query Stats', message=msg, fail_silently=False)

    print('Done.')
Example #2
0
  def test_basic_stats(self):
    try:
      doc, created = Document2.objects.get_or_create(name='test_query_stats', type='query-hive', owner=self.user, data={})

      Analytics.admin_stats()
      Analytics.user_stats(user=self.user)
      Analytics.query_stats(query=doc)
    finally:
      doc.delete()
Example #3
0
def admin_stats(request):
  if is_admin(user=request.user):
    return JsonResponse({
      'admin_stats': Analytics.admin_stats()
    })