Maybe fix messange count?
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
parent
cf9edae000
commit
b81d8d084b
@ -14,6 +14,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/filecoin-project/lotus/chain/address"
|
"github.com/filecoin-project/lotus/chain/address"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
"github.com/multiformats/go-multihash"
|
"github.com/multiformats/go-multihash"
|
||||||
|
|
||||||
_ "github.com/influxdata/influxdb1-client"
|
_ "github.com/influxdata/influxdb1-client"
|
||||||
@ -182,6 +183,12 @@ func RecordTipsetStatePoints(ctx context.Context, api api.FullNode, pl *PointLis
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type msgTag struct {
|
||||||
|
actor string
|
||||||
|
method uint64
|
||||||
|
exitcode uint8
|
||||||
|
}
|
||||||
|
|
||||||
func RecordTipsetMessagesPoints(ctx context.Context, api api.FullNode, pl *PointList, tipset *types.TipSet) error {
|
func RecordTipsetMessagesPoints(ctx context.Context, api api.FullNode, pl *PointList, tipset *types.TipSet) error {
|
||||||
cids := tipset.Cids()
|
cids := tipset.Cids()
|
||||||
if len(cids) == 0 {
|
if len(cids) == 0 {
|
||||||
@ -198,6 +205,8 @@ func RecordTipsetMessagesPoints(ctx context.Context, api api.FullNode, pl *Point
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
msgn := make(map[msgTag][]cid.Cid)
|
||||||
|
|
||||||
for i, msg := range msgs {
|
for i, msg := range msgs {
|
||||||
p := NewPoint("chain.message_gasprice", msg.Message.GasPrice.Int64())
|
p := NewPoint("chain.message_gasprice", msg.Message.GasPrice.Int64())
|
||||||
pl.AddPoint(p)
|
pl.AddPoint(p)
|
||||||
@ -215,16 +224,33 @@ func RecordTipsetMessagesPoints(ctx context.Context, api api.FullNode, pl *Point
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
p = NewPoint("chain.message_count", 1)
|
|
||||||
|
|
||||||
dm, err := multihash.Decode(actor.Code.Hash())
|
dm, err := multihash.Decode(actor.Code.Hash())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
tag := msgTag{
|
||||||
|
actor: string(dm.Digest),
|
||||||
|
method: msg.Message.Method,
|
||||||
|
exitcode: recp[i].ExitCode,
|
||||||
|
}
|
||||||
|
|
||||||
p.AddTag("actor", string(dm.Digest))
|
found := false
|
||||||
p.AddTag("method", fmt.Sprintf("%d", msg.Message.Method))
|
for _, c := range msgn[tag] {
|
||||||
p.AddTag("exitcode", fmt.Sprintf("%d", recp[i].ExitCode))
|
if c.Equals(msg.Cid) {
|
||||||
|
found = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !found {
|
||||||
|
msgn[tag] = append(msgn[tag], msg.Cid)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for t, m := range msgn {
|
||||||
|
p := NewPoint("chain.message_count", len(m))
|
||||||
|
p.AddTag("actor", t.actor)
|
||||||
|
p.AddTag("method", fmt.Sprintf("%d", t.method))
|
||||||
|
p.AddTag("exitcode", fmt.Sprintf("%d", t.exitcode))
|
||||||
pl.AddPoint(p)
|
pl.AddPoint(p)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user