Merge remote-tracking branch 'origin/master' into feat/sector-recovery

This commit is contained in:
Łukasz Magiera 2020-01-24 01:53:52 +01:00
commit b5660b58b3
8 changed files with 570 additions and 107 deletions

View File

@ -3,6 +3,7 @@ package blocksync
import (
"bufio"
"context"
"time"
"github.com/libp2p/go-libp2p-core/protocol"
"go.opencensus.io/trace"
@ -13,7 +14,6 @@ import (
"github.com/filecoin-project/lotus/chain/types"
"github.com/ipfs/go-cid"
cbor "github.com/ipfs/go-ipld-cbor"
logging "github.com/ipfs/go-log/v2"
inet "github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
@ -25,11 +25,7 @@ type NewStreamFunc func(context.Context, peer.ID, ...protocol.ID) (inet.Stream,
const BlockSyncProtocolID = "/fil/sync/blk/0.0.1"
func init() {
cbor.RegisterCborType(BlockSyncRequest{})
cbor.RegisterCborType(BlockSyncResponse{})
cbor.RegisterCborType(BSTipSet{})
}
const BlockSyncMaxRequestLength = 800
type BlockSyncService struct {
cs *store.ChainStore
@ -55,8 +51,17 @@ func ParseBSOptions(optfield uint64) *BSOptions {
}
const (
BSOptBlocks = 1 << 0
BSOptMessages = 1 << 1
BSOptBlocks = 1 << iota
BSOptMessages
)
const (
StatusOK = uint64(0)
StatusPartial = uint64(101)
StatusNotFound = uint64(201)
StatusGoAway = uint64(202)
StatusInternalError = uint64(203)
StatusBadRequest = uint64(204)
)
type BlockSyncResponse struct {
@ -93,28 +98,30 @@ func (bss *BlockSyncService) HandleStream(s inet.Stream) {
log.Warnf("failed to read block sync request: %s", err)
return
}
log.Infof("block sync request for: %s %d", req.Start, req.RequestLength)
log.Infow("block sync request", "start", req.Start, "len", req.RequestLength)
resp, err := bss.processRequest(ctx, &req)
resp, err := bss.processRequest(ctx, s.Conn().RemotePeer(), &req)
if err != nil {
log.Warn("failed to process block sync request: ", err)
return
}
writeDeadline := 60 * time.Second
s.SetDeadline(time.Now().Add(writeDeadline))
if err := cborutil.WriteCborRPC(s, resp); err != nil {
log.Warn("failed to write back response for handle stream: ", err)
log.Warnw("failed to write back response for handle stream", "err", err, "peer", s.Conn().RemotePeer())
return
}
}
func (bss *BlockSyncService) processRequest(ctx context.Context, req *BlockSyncRequest) (*BlockSyncResponse, error) {
func (bss *BlockSyncService) processRequest(ctx context.Context, p peer.ID, req *BlockSyncRequest) (*BlockSyncResponse, error) {
_, span := trace.StartSpan(ctx, "blocksync.ProcessRequest")
defer span.End()
opts := ParseBSOptions(req.Options)
if len(req.Start) == 0 {
return &BlockSyncResponse{
Status: 204,
Status: StatusBadRequest,
Message: "no cids given in blocksync request",
}, nil
}
@ -122,20 +129,32 @@ func (bss *BlockSyncService) processRequest(ctx context.Context, req *BlockSyncR
span.AddAttributes(
trace.BoolAttribute("blocks", opts.IncludeBlocks),
trace.BoolAttribute("messages", opts.IncludeMessages),
trace.Int64Attribute("reqlen", int64(req.RequestLength)),
)
chain, err := bss.collectChainSegment(types.NewTipSetKey(req.Start...), req.RequestLength, opts)
reqlen := req.RequestLength
if reqlen > BlockSyncMaxRequestLength {
log.Warnw("limiting blocksync request length", "orig", req.RequestLength, "peer", p)
reqlen = BlockSyncMaxRequestLength
}
chain, err := bss.collectChainSegment(types.NewTipSetKey(req.Start...), reqlen, opts)
if err != nil {
log.Warn("encountered error while responding to block sync request: ", err)
return &BlockSyncResponse{
Status: 203,
Status: StatusInternalError,
Message: err.Error(),
}, nil
}
status := StatusOK
if reqlen < req.RequestLength {
status = StatusPartial
}
return &BlockSyncResponse{
Chain: chain,
Status: 0,
Status: status,
}, nil
}

View File

@ -21,6 +21,7 @@ import (
cborutil "github.com/filecoin-project/go-cbor-util"
"github.com/filecoin-project/lotus/chain/store"
"github.com/filecoin-project/lotus/chain/types"
incrt "github.com/filecoin-project/lotus/lib/increadtimeout"
"github.com/filecoin-project/lotus/node/modules/dtypes"
"github.com/filecoin-project/lotus/peermgr"
)
@ -44,15 +45,15 @@ func NewBlockSyncClient(bserv dtypes.ChainBlockService, h host.Host, pmgr peermg
func (bs *BlockSync) processStatus(req *BlockSyncRequest, res *BlockSyncResponse) error {
switch res.Status {
case 101: // Partial Response
case StatusPartial: // Partial Response
return xerrors.Errorf("not handling partial blocksync responses yet")
case 201: // req.Start not found
case StatusNotFound: // req.Start not found
return xerrors.Errorf("not found")
case 202: // Go Away
case StatusGoAway: // Go Away
return xerrors.Errorf("not handling 'go away' blocksync responses yet")
case 203: // Internal Error
case StatusInternalError: // Internal Error
return xerrors.Errorf("block sync peer errored: %s", res.Message)
case 204:
case StatusBadRequest:
return xerrors.Errorf("block sync request invalid: %s", res.Message)
default:
return xerrors.Errorf("unrecognized response code: %d", res.Status)
@ -194,11 +195,16 @@ func (bs *BlockSync) GetChainMessages(ctx context.Context, h *types.TipSet, coun
continue
}
if res.Status == 0 {
if res.Status == StatusOK {
bs.syncPeers.logGlobalSuccess(time.Since(start))
return res.Chain, nil
}
if res.Status == StatusPartial {
log.Warn("dont yet handle partial responses")
continue
}
err = bs.processStatus(req, res)
if err != nil {
log.Warnf("BlockSync peer %s response was an error: %s", p.String(), err)
@ -241,16 +247,18 @@ func (bs *BlockSync) sendRequestToPeer(ctx context.Context, p peer.ID, req *Bloc
bs.RemovePeer(p)
return nil, xerrors.Errorf("failed to open stream to peer: %w", err)
}
s.SetDeadline(time.Now().Add(10 * time.Second))
defer s.SetDeadline(time.Time{})
s.SetWriteDeadline(time.Now().Add(5 * time.Second))
if err := cborutil.WriteCborRPC(s, req); err != nil {
s.SetWriteDeadline(time.Time{})
bs.syncPeers.logFailure(p, time.Since(start))
return nil, err
}
s.SetWriteDeadline(time.Time{})
var res BlockSyncResponse
if err := cborutil.ReadCborRPC(bufio.NewReader(s), &res); err != nil {
r := incrt.New(s, 50<<10, 5*time.Second)
if err := cborutil.ReadCborRPC(bufio.NewReader(r), &res); err != nil {
bs.syncPeers.logFailure(p, time.Since(start))
return nil, err
}

View File

@ -84,6 +84,15 @@ create table if not exists blocks
create unique index if not exists block_cid_uindex
on blocks (cid);
create materialized view if not exists state_heights
as select distinct height, parentstateroot from blocks;
create unique index if not exists state_heights_uindex
on state_heights (height);
create index if not exists state_heights_height_index
on state_heights (parentstateroot);
create table if not exists id_address_map
(
id text not null,
@ -119,6 +128,22 @@ create index if not exists id_address_map_address_index
create index if not exists id_address_map_id_index
on id_address_map (id);
create or replace function actor_tips(epoch bigint)
returns table (id text,
code text,
head text,
nonce int,
balance text,
stateroot text,
height bigint,
parentstateroot text) as
$body$
select distinct on (id) * from actors
inner join state_heights sh on sh.parentstateroot = stateroot
where height < $1
order by id, height desc;
$body$ language sql;
create table if not exists actor_states
(
head text not null,
@ -210,6 +235,31 @@ create table if not exists miner_heads
primary key (head, addr)
);
create or replace function miner_tips(epoch bigint)
returns table (head text,
addr text,
stateroot text,
sectorset text,
setsize decimal,
provingset text,
provingsize decimal,
owner text,
worker text,
peerid text,
sectorsize bigint,
power decimal,
active bool,
ppe bigint,
slashed_at bigint,
height bigint,
parentstateroot text) as
$body$
select distinct on (addr) * from miner_heads
inner join state_heights sh on sh.parentstateroot = stateroot
where height < $1
order by addr, height desc;
$body$ language sql;
create table if not exists deals
(
id int not null,
@ -237,6 +287,21 @@ create index if not exists deals_pieceRef_index
create index if not exists deals_provider_index
on deals (provider);
create table if not exists deal_activations
(
deal bigint not null
constraint deal_activations_deals_id_fk
references deals,
activation_epoch bigint not null,
constraint deal_activations_pk
primary key (deal)
);
create index if not exists deal_activations_activation_epoch_index
on deal_activations (activation_epoch);
create unique index if not exists deal_activations_deal_uindex
on deal_activations (deal);
`)
if err != nil {
return err
@ -769,7 +834,60 @@ func (st *storage) storeDeals(deals map[string]actors.OnChainDeal) error {
return xerrors.Errorf("actor put: %w", err)
}
return tx.Commit()
if err := tx.Commit(); err != nil {
return err
}
// Activations
tx, err = st.db.Begin()
if err != nil {
return err
}
if _, err := tx.Exec(`
create temp table d (like deal_activations excluding constraints) on commit drop;
`); err != nil {
return xerrors.Errorf("prep temp: %w", err)
}
stmt, err = tx.Prepare(`copy d (deal, activation_epoch) from stdin `)
if err != nil {
return err
}
for id, deal := range deals {
if deal.ActivationEpoch == 0 {
continue
}
if _, err := stmt.Exec(
id,
deal.ActivationEpoch,
); err != nil {
return err
}
}
if err := stmt.Close(); err != nil {
return err
}
if _, err := tx.Exec(`insert into deal_activations select * from d on conflict do nothing `); err != nil {
return xerrors.Errorf("actor put: %w", err)
}
if err := tx.Commit(); err != nil {
return err
}
return nil
}
func (st *storage) refreshViews() error {
if _, err := st.db.Exec(`refresh materialized view state_heights`); err != nil {
return err
}
return nil
}
func (st *storage) close() error {

View File

@ -371,6 +371,13 @@ func syncHead(ctx context.Context, api api.FullNode, st *storage, ts *types.TipS
return
}
log.Infof("Refresh views")
if err := st.refreshViews(); err != nil {
log.Error(err)
return
}
log.Infof("Sync done")
}

1
go.sum
View File

@ -719,6 +719,7 @@ github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f/go.mod h1:p9UJB6dDgdPgMJZs7UjUOdulKyRr9fqkS+6JKAInPy8=
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k=
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc=
github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo=
github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM=
github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f/go.mod h1:cZNvX9cFybI01GriPRMXDtczuvUhgbcYr9iCGaNlRv8=
github.com/whyrusleeping/go-smux-multiplex v3.0.16+incompatible/go.mod h1:34LEDbeKFZInPUrAG+bjuJmUXONGdEFW7XL0SpTY1y4=

View File

@ -0,0 +1,73 @@
package incrt
import (
"io"
"time"
logging "github.com/ipfs/go-log/v2"
)
var log = logging.Logger("incrt")
var now = time.Now
type ReaderDeadline interface {
Read([]byte) (int, error)
SetReadDeadline(time.Time) error
}
type incrt struct {
rd ReaderDeadline
waitPerByte time.Duration
wait time.Duration
maxWait time.Duration
}
// New creates an Incremental Reader Timeout, with minimum sustained speed of
// minSpeed bytes per second and with maximum wait of maxWait
func New(rd ReaderDeadline, minSpeed int64, maxWait time.Duration) io.Reader {
return &incrt{
rd: rd,
waitPerByte: time.Second / time.Duration(minSpeed),
wait: maxWait,
maxWait: maxWait,
}
}
type errNoWait struct{}
func (err errNoWait) Error() string {
return "wait time exceeded"
}
func (err errNoWait) Timeout() bool {
return true
}
func (crt *incrt) Read(buf []byte) (int, error) {
start := now()
if crt.wait == 0 {
return 0, errNoWait{}
}
err := crt.rd.SetReadDeadline(start.Add(crt.wait))
if err != nil {
log.Warnf("unable to set daedline: %+v", err)
}
n, err := crt.rd.Read(buf)
crt.rd.SetReadDeadline(time.Time{})
if err == nil {
dur := now().Sub(start)
crt.wait -= dur
crt.wait += time.Duration(n) * crt.waitPerByte
if crt.wait < 0 {
crt.wait = 0
}
if crt.wait > crt.maxWait {
crt.wait = crt.maxWait
}
}
return n, err
}

View File

@ -50,7 +50,7 @@ func (m *Sealing) checkPreCommitted(ctx statemachine.Context, sector SectorInfo)
pci, found := state.PreCommittedSectors[fmt.Sprint(sector.SectorID)]
if found {
// TODO: If not expired yet, we can just try reusing sealticket
log.Errorf("sector %d found in miner preseal array: %+v", sector.SectorID, err)
log.Warnf("sector %d found in miner preseal array", sector.SectorID)
return pci, true
}

View File

@ -62,7 +62,7 @@
"panels": [
{
"aliasColors": {},
"bars": false,
"bars": true,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_INFLUXDB}",
@ -70,7 +70,7 @@
"fill": 3,
"fillGradient": 0,
"gridPos": {
"h": 16,
"h": 9,
"w": 24,
"x": 0,
"y": 0
@ -80,18 +80,18 @@
"interval": "",
"legend": {
"alignAsTable": true,
"avg": false,
"current": true,
"avg": true,
"current": false,
"max": false,
"min": false,
"rightSide": true,
"show": true,
"sort": "current",
"sort": "avg",
"sortDesc": true,
"total": false,
"values": true
},
"lines": true,
"lines": false,
"linewidth": 1,
"nullPointMode": "null",
"options": {
@ -131,7 +131,7 @@
"measurement": "chain.election",
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT moving_average(count(\"value\"), 10) FROM \"chain.election\" WHERE $timeFilter -10m GROUP BY time($__interval), \"miner\" fill(null)",
"query": "SELECT count(\"value\") FROM \"chain.election\" WHERE $timeFilter -10m GROUP BY time($__interval), \"miner\" fill(null)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
@ -214,9 +214,10 @@
"h": 4,
"w": 8,
"x": 0,
"y": 16
"y": 9
},
"id": 22,
"interval": "",
"legend": {
"avg": false,
"current": false,
@ -268,7 +269,7 @@
}
],
"thresholds": [],
"timeFrom": null,
"timeFrom": "4h",
"timeRegions": [],
"timeShift": null,
"title": "Total Power",
@ -287,9 +288,8 @@
},
"yaxes": [
{
"decimals": 2,
"format": "bytes",
"label": "",
"label": null,
"logBase": 1,
"max": null,
"min": null,
@ -329,9 +329,9 @@
},
"gridPos": {
"h": 4,
"w": 8,
"w": 4,
"x": 8,
"y": 16
"y": 9
},
"id": 12,
"interval": null,
@ -413,6 +413,122 @@
],
"valueName": "avg"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"#299c46",
"rgba(237, 129, 40, 0.89)",
"#d44a3a"
],
"datasource": "${DS_INFLUXDB}",
"format": "bytes",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"gridPos": {
"h": 4,
"w": 4,
"x": 12,
"y": 9
},
"id": 42,
"interval": "",
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"options": {},
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": true,
"ymax": null,
"ymin": 0
},
"tableColumn": "",
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT sum(\"value\") FROM \"chain.miner_power\" WHERE $timeFilter GROUP BY time(45s)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
}
],
"thresholds": "",
"timeFrom": null,
"timeShift": null,
"title": "Network Storage",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "current"
},
{
"cacheTimeout": null,
"colorBackground": false,
@ -435,7 +551,7 @@
"h": 4,
"w": 8,
"x": 16,
"y": 16
"y": 9
},
"id": 6,
"interval": null,
@ -477,8 +593,15 @@
"tableColumn": "",
"targets": [
{
"groupBy": [],
"measurement": "chain.block_count",
"groupBy": [
{
"params": [
"$interval"
],
"type": "time"
}
],
"measurement": "chain.election",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
@ -490,6 +613,10 @@
"value"
],
"type": "field"
},
{
"params": [],
"type": "sum"
}
]
],
@ -509,7 +636,7 @@
"value": "null"
}
],
"valueName": "current"
"valueName": "avg"
},
{
"cacheTimeout": null,
@ -534,7 +661,7 @@
"h": 3,
"w": 4,
"x": 0,
"y": 20
"y": 13
},
"id": 4,
"interval": null,
@ -632,7 +759,7 @@
"h": 3,
"w": 4,
"x": 4,
"y": 20
"y": 13
},
"id": 14,
"interval": null,
@ -734,7 +861,7 @@
"h": 3,
"w": 4,
"x": 8,
"y": 20
"y": 13
},
"id": 32,
"interval": null,
@ -849,7 +976,7 @@
"h": 3,
"w": 4,
"x": 12,
"y": 20
"y": 13
},
"id": 20,
"interval": null,
@ -964,7 +1091,7 @@
"h": 3,
"w": 4,
"x": 16,
"y": 20
"y": 13
},
"id": 8,
"interval": null,
@ -1079,7 +1206,7 @@
"h": 3,
"w": 4,
"x": 20,
"y": 20
"y": 13
},
"id": 10,
"interval": null,
@ -1131,7 +1258,7 @@
},
{
"params": [
"0"
"null"
],
"type": "fill"
}
@ -1139,8 +1266,8 @@
"measurement": "chain.message_count",
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT sum(\"value\") FROM (SELECT \"value\" FROM \"chain.message_count\" GROUP BY \"height\") WHERE $timeFilter GROUP BY time($__interval) fill(0)",
"rawQuery": true,
"query": "SELECT \"value\" FROM \"chain.message_count\" WHERE $timeFilter ",
"rawQuery": false,
"refId": "A",
"resultFormat": "time_series",
"select": [
@ -1153,7 +1280,7 @@
},
{
"params": [],
"type": "mean"
"type": "sum"
}
]
],
@ -1198,7 +1325,7 @@
"h": 3,
"w": 4,
"x": 0,
"y": 23
"y": 16
},
"id": 16,
"interval": "",
@ -1293,16 +1420,16 @@
"h": 3,
"w": 16,
"x": 4,
"y": 23
"y": 16
},
"id": 2,
"legend": {
"alignAsTable": true,
"avg": true,
"current": false,
"current": true,
"hideEmpty": false,
"hideZero": false,
"max": false,
"max": true,
"min": false,
"rightSide": true,
"show": true,
@ -1321,10 +1448,6 @@
"points": false,
"renderer": "flot",
"seriesOverrides": [
{
"alias": "chain.height.difference",
"yaxis": 2
},
{
"alias": "Null Blocks",
"yaxis": 2
@ -1399,7 +1522,7 @@
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "",
"title": "Tipsets",
"tooltip": {
"shared": true,
"sort": 0,
@ -1416,7 +1539,7 @@
"yaxes": [
{
"format": "s",
"label": "Time delta",
"label": "Time between tipsets",
"logBase": 1,
"max": null,
"min": null,
@ -1425,7 +1548,7 @@
{
"decimals": 0,
"format": "short",
"label": "# null blocks",
"label": "Number of Null blocks",
"logBase": 1,
"max": null,
"min": "0",
@ -1459,7 +1582,7 @@
"h": 3,
"w": 4,
"x": 20,
"y": 23
"y": 16
},
"id": 30,
"interval": null,
@ -1540,10 +1663,10 @@
"datasource": "${DS_INFLUXDB}",
"fontSize": "100%",
"gridPos": {
"h": 16,
"h": 21,
"w": 4,
"x": 0,
"y": 26
"y": 19
},
"id": 28,
"options": {},
@ -1627,13 +1750,13 @@
"dashLength": 10,
"dashes": false,
"datasource": "${DS_INFLUXDB}",
"fill": 4,
"fill": 5,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 4,
"y": 26
"y": 19
},
"id": 40,
"interval": "",
@ -1641,8 +1764,8 @@
"alignAsTable": true,
"avg": false,
"current": true,
"hideEmpty": false,
"hideZero": false,
"hideEmpty": true,
"hideZero": true,
"max": false,
"min": false,
"rightSide": true,
@ -1765,10 +1888,10 @@
"datasource": "${DS_INFLUXDB}",
"fontSize": "100%",
"gridPos": {
"h": 16,
"h": 21,
"w": 8,
"x": 16,
"y": 26
"y": 19
},
"id": 18,
"options": {},
@ -1862,10 +1985,10 @@
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"h": 6,
"w": 12,
"x": 4,
"y": 34
"y": 27
},
"id": 24,
"legend": {
@ -1981,6 +2104,128 @@
{
"aliasColors": {},
"bars": false,
"cacheTimeout": null,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_INFLUXDB}",
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 7,
"w": 12,
"x": 4,
"y": 33
},
"id": 44,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"options": {
"dataLinks": []
},
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"previous"
],
"type": "fill"
}
],
"measurement": "chain.miner_power",
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT count(\"value\") FROM \"chain.miner_power\" WHERE $timeFilter GROUP BY time($__interval)",
"rawQuery": false,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "count"
}
]
],
"tags": []
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Miners on Chain",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"decimals": 0,
"format": "none",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": true,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_INFLUXDB}",
@ -1990,7 +2235,7 @@
"h": 9,
"w": 12,
"x": 0,
"y": 42
"y": 40
},
"id": 34,
"legend": {
@ -2004,7 +2249,7 @@
"total": false,
"values": false
},
"lines": true,
"lines": false,
"linewidth": 1,
"nullPointMode": "null",
"options": {
@ -2050,8 +2295,6 @@
"measurement": "chain.message_count",
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT moving_average(count(\"value\"), 2) FROM \"chain.message_count\" WHERE $timeFilter -4m GROUP BY time($__interval), \"actor\", \"method\" fill(null)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
"select": [
@ -2064,7 +2307,7 @@
},
{
"params": [],
"type": "count"
"type": "sum"
}
]
],
@ -2114,35 +2357,35 @@
},
{
"aliasColors": {},
"bars": false,
"bars": true,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_INFLUXDB}",
"decimals": 2,
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 9,
"w": 12,
"x": 12,
"y": 42
"y": 40
},
"id": 36,
"interval": "",
"legend": {
"alignAsTable": true,
"avg": true,
"avg": false,
"current": false,
"max": true,
"hideEmpty": true,
"hideZero": true,
"max": false,
"min": false,
"rightSide": true,
"show": true,
"sort": "avg",
"sortDesc": true,
"sortDesc": false,
"total": false,
"values": true
"values": false
},
"lines": true,
"lines": false,
"linewidth": 1,
"nullPointMode": "null",
"options": {
@ -2166,6 +2409,12 @@
],
"type": "time"
},
{
"params": [
"method"
],
"type": "tag"
},
{
"params": [
"exitcode"
@ -2178,12 +2427,6 @@
],
"type": "tag"
},
{
"params": [
"method"
],
"type": "tag"
},
{
"params": [
"null"
@ -2194,7 +2437,7 @@
"measurement": "chain.message_count",
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT moving_average(count(\"value\"), 10) FROM \"chain.message_count\" WHERE $timeFilter -10m GROUP BY time($__interval), \"exitcode\", \"actor\", \"method\" fill(null)",
"query": "SELECT sum(\"value\") FROM \"chain.message_count\" WHERE $timeFilter GROUP BY time($__interval), \"method\", \"exitcode\", \"actor\" fill(null)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
@ -2209,12 +2452,6 @@
{
"params": [],
"type": "count"
},
{
"params": [
10
],
"type": "moving_average"
}
]
],
@ -2241,7 +2478,6 @@
},
"yaxes": [
{
"decimals": null,
"format": "short",
"label": "",
"logBase": 1,
@ -2264,7 +2500,7 @@
}
}
],
"refresh": "30s",
"refresh": "45s",
"schemaVersion": 20,
"style": "dark",
"tags": [],
@ -2280,6 +2516,7 @@
"5s",
"10s",
"30s",
"45s",
"1m",
"5m",
"15m",
@ -2292,5 +2529,5 @@
"timezone": "",
"title": "Chain",
"uid": "z6FtI92Zz",
"version": 8
}
"version": 9
}