analytics: Change messages_sent_to_stream to a daily stat.

Analytics database tables are getting big, and so we're likely moving to a
model where ~all stats are day stats, and we keep hourly stats only for the
last N days.

Also changed the name because:
* messages_sent_* suggests the counts (summed over subgroup) should be the
  same as the other messages_sent stats, but they are different (these don't
  include PMs).
* messages_sent_by_stream:is_bot:day is longer than 32 characters, the max
  allowable length for a BaseCount.property.

Includes a database migration to remove the old stat from the analytics
tables.
This commit is contained in:
Rishi Gupta
2017-02-14 19:10:03 -08:00
committed by Tim Abbott
parent b8caf45262
commit 20255e48a4
3 changed files with 39 additions and 10 deletions

View File

@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
from django.db import migrations
from analytics.lib.counts import do_delete_count_stat
def delete_messages_sent_to_stream_stat(apps, schema_editor):
# type: (StateApps, DatabaseSchemaEditor) -> None
do_delete_count_stat('messages_sent_to_stream:is_bot')
class Migration(migrations.Migration):
dependencies = [
('analytics', '0008_add_count_indexes'),
]
operations = [
migrations.RunPython(delete_messages_sent_to_stream_stat),
]