-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Aggregate metrics from other discovery nodes (#1266)
* Aggregate metrics from other discovery nodes * Add comments and small changes * Rename models, update comments, remove logs * Add command to spin up discovery node and its dependencies * Fix lint * Describe timestamp attributes in new metrics tables * Parallelize calls to get other discovery node endpoints * Update command name to start up discovery provider with its dependencies * Add tests * Order aggregate route metrics by timestamp asc and fix test * Merge and persist route and app metrics regardless of new metrics * Fix month metrics returned * Fix tests after db query updates * Use date instead of datetime for db query comparison and add more logs * Add more logs * Persist own metrics Co-authored-by: Saliou Diallo <saliou@audius.co> Co-authored-by: Raymond Jacobson <ray@audius.co>
- Loading branch information
1 parent
33b4c6d
commit ceaebcc
Showing
22 changed files
with
2,243 additions
and
32 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,3 +38,6 @@ cov_html/* | |
build/ | ||
|
||
.vscode/ | ||
|
||
# redis dumps | ||
*_dump |
78 changes: 78 additions & 0 deletions
78
discovery-provider/alembic/versions/c967ae0fcaf6_add_aggregate_metrics_tables.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
"""Add aggregate metrics tables | ||
Revision ID: c967ae0fcaf6 | ||
Revises: 579360c7cbf3 | ||
Create Date: 2021-02-24 17:45:45.939947 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'c967ae0fcaf6' | ||
down_revision = '5dd6a55bb738' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
op.create_table('aggregate_daily_unique_users_metrics', | ||
sa.Column('id', sa.Integer(), nullable=False, primary_key=True), | ||
sa.Column('count', sa.Integer(), nullable=False), | ||
sa.Column('timestamp', sa.Date(), nullable=False), | ||
sa.Column('created_at', sa.DateTime, nullable=False, default=sa.func.now()), | ||
sa.Column('updated_at', sa.DateTime, nullable=False, onupdate=sa.func.now()), | ||
sa.PrimaryKeyConstraint('id') | ||
) | ||
op.create_table('aggregate_daily_total_users_metrics', | ||
sa.Column('id', sa.Integer(), nullable=False, primary_key=True), | ||
sa.Column('count', sa.Integer(), nullable=False), | ||
sa.Column('timestamp', sa.Date(), nullable=False), | ||
sa.Column('created_at', sa.DateTime, nullable=False, default=sa.func.now()), | ||
sa.Column('updated_at', sa.DateTime, nullable=False, onupdate=sa.func.now()), | ||
sa.PrimaryKeyConstraint('id') | ||
) | ||
op.create_table('aggregate_monthly_unique_users_metrics', | ||
sa.Column('id', sa.Integer(), nullable=False, primary_key=True), | ||
sa.Column('count', sa.Integer(), nullable=False), | ||
sa.Column('timestamp', sa.Date(), nullable=False), | ||
sa.Column('created_at', sa.DateTime, nullable=False, default=sa.func.now()), | ||
sa.Column('updated_at', sa.DateTime, nullable=False, onupdate=sa.func.now()), | ||
sa.PrimaryKeyConstraint('id') | ||
) | ||
op.create_table('aggregate_monthly_total_users_metrics', | ||
sa.Column('id', sa.Integer(), nullable=False, primary_key=True), | ||
sa.Column('count', sa.Integer(), nullable=False), | ||
sa.Column('timestamp', sa.Date(), nullable=False), | ||
sa.Column('created_at', sa.DateTime, nullable=False, default=sa.func.now()), | ||
sa.Column('updated_at', sa.DateTime, nullable=False, onupdate=sa.func.now()), | ||
sa.PrimaryKeyConstraint('id') | ||
) | ||
op.create_table('aggregate_daily_app_name_metrics', | ||
sa.Column('id', sa.Integer(), nullable=False, primary_key=True), | ||
sa.Column('application_name', sa.String(), nullable=False), | ||
sa.Column('count', sa.Integer(), nullable=False), | ||
sa.Column('timestamp', sa.Date(), nullable=False), | ||
sa.Column('created_at', sa.DateTime, nullable=False, default=sa.func.now()), | ||
sa.Column('updated_at', sa.DateTime, nullable=False, onupdate=sa.func.now()), | ||
sa.PrimaryKeyConstraint('id') | ||
) | ||
op.create_table('aggregate_monthly_app_name_metrics', | ||
sa.Column('id', sa.Integer(), nullable=False, primary_key=True), | ||
sa.Column('application_name', sa.String(), nullable=False), | ||
sa.Column('count', sa.Integer(), nullable=False), | ||
sa.Column('timestamp', sa.Date(), nullable=False), | ||
sa.Column('created_at', sa.DateTime, nullable=False, default=sa.func.now()), | ||
sa.Column('updated_at', sa.DateTime, nullable=False, onupdate=sa.func.now()), | ||
sa.PrimaryKeyConstraint('id') | ||
) | ||
|
||
|
||
def downgrade(): | ||
op.drop_table('aggregate_daily_unique_users_metrics') | ||
op.drop_table('aggregate_daily_total_users_metrics') | ||
op.drop_table('aggregate_monthly_unique_users_metrics') | ||
op.drop_table('aggregate_monthly_total_users_metrics') | ||
op.drop_table('aggregate_daily_app_name_metrics') | ||
op.drop_table('aggregate_monthly_app_name_metrics') |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.