%load_ext autotime
%load_ext autoreload
%autoreload 2
time: 10.2 ms (started: 2021-12-05 00:34:44 +00:00)
# External depences
import pandas as pd
import numpy as np
import plotly.express as px
# Move path to parent folder
import sys
sys.path.insert(1, '../')
# Internal dependences
from filecoin_metrics.connection import get_connection, get_connection_string
from filecoin_metrics.metrics import *
time: 515 ms (started: 2021-12-05 00:34:44 +00:00)
conn_string = get_connection_string('../config/sentinel-conn-string.txt')
connection = get_connection(conn_string)
time: 106 ms (started: 2021-12-05 00:34:45 +00:00)
s = rate_missing_post_network_weekly(connection)
px.bar(s, log_y=True)
time: 1min 1s (started: 2021-12-05 00:34:45 +00:00)
s = fraction_missing_post_network_weekly(connection)
px.bar(s)
time: 56.7 s (started: 2021-12-05 00:35:46 +00:00)
d = rate_missing_post_miner_weekly(connection)
s = declare_fault_count_per_miner(connection) print(s.sort_values(ascending=False).head(10))
from filecoin_metrics.metrics import declare_fault_weekly
s = declare_fault_weekly(connection)
fig_df = s.reset_index()
fig = px.bar(fig_df,
x='timestamp',
y='declare_fault_count',
title='Weekly Declare Fault Count',
log_y=True)
fig.show()
time: 422 ms (started: 2021-12-05 00:36:43 +00:00)
from filecoin_metrics.metrics import renewal_count_per_epoch
s = renewal_count_per_epoch(connection)
INTERVAL = '1w'
s_count = (s.resample(INTERVAL)
.sum()
.backfill()
)
s_cum = (s.cumsum()
.resample(INTERVAL)
.median()
.backfill()
)
s_cum.name = 'renewal_count_cumulative'
fig_df = (pd.DataFrame([s_count, s_cum])
.T
.reset_index()
.melt(id_vars=['timestamp'])
)
fig = px.bar(fig_df,
x='timestamp',
y='value',
title='Renewal Events Count',
facet_col='variable',
log_y=True)
fig.show()
time: 19.5 s (started: 2021-12-05 00:36:44 +00:00)