-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add historic metrics #74
Conversation
… scripts for db, update metrics.json file structure
metrics/src/db.py
Outdated
BACKFILL_DB_DAYS = 30 | ||
|
||
|
||
async def get_current_total_transactions(session, chain_name: str, address: str) -> int: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is better to move this method into src.explorer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved
metrics/src/gas.py
Outdated
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def init_w3(): | ||
logger.info(f'Connecting to {ENDPOINT}...') | ||
logger.info(f"Connecting to {ENDPOINT}...") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why double-quotes, but not single-quotes in this module?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
metrics/src/main.py
Outdated
def run_migrations(): | ||
logger.info('Running database migrations...') | ||
try: | ||
from models import Address, TransactionCount |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move models import to the other imports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved
logger.info('Metrics collector iteration started...') | ||
current_date = datetime.now().date() | ||
|
||
if last_run_date is None or current_date > last_run_date: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are running collect_metrics
at the beginning of the day, then in daily_transactions
field for this date in db will be in fact daily transactions count from the previous day. Is it supposed to work like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
metrics/src/db.py
Outdated
TRANSACTION_COUNT_FIELD = 'transactions_count' | ||
BACKFILL_DB_DAYS = 30 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably it's better to move db constants to src/config.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved
In this PR: