Merge pull request #1328 from filecoin-project/metrics/rework-default-view
remove high cardinality tags from metrics
This commit is contained in:
commit
697ab30304
@ -2,7 +2,6 @@ package sub
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
lru "github.com/hashicorp/golang-lru"
|
lru "github.com/hashicorp/golang-lru"
|
||||||
@ -112,11 +111,6 @@ func (bv *BlockValidator) flagPeer(p peer.ID) {
|
|||||||
|
|
||||||
func (bv *BlockValidator) Validate(ctx context.Context, pid peer.ID, msg *pubsub.Message) bool {
|
func (bv *BlockValidator) Validate(ctx context.Context, pid peer.ID, msg *pubsub.Message) bool {
|
||||||
stats.Record(ctx, metrics.BlockReceived.M(1))
|
stats.Record(ctx, metrics.BlockReceived.M(1))
|
||||||
ctx, _ = tag.New(
|
|
||||||
ctx,
|
|
||||||
tag.Insert(metrics.PeerID, pid.String()),
|
|
||||||
tag.Insert(metrics.ReceivedFrom, msg.ReceivedFrom.String()),
|
|
||||||
)
|
|
||||||
blk, err := types.DecodeBlockMsg(msg.GetData())
|
blk, err := types.DecodeBlockMsg(msg.GetData())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("got invalid block over pubsub: ", err)
|
log.Error("got invalid block over pubsub: ", err)
|
||||||
@ -178,7 +172,6 @@ func NewMessageValidator(mp *messagepool.MessagePool) *MessageValidator {
|
|||||||
|
|
||||||
func (mv *MessageValidator) Validate(ctx context.Context, pid peer.ID, msg *pubsub.Message) bool {
|
func (mv *MessageValidator) Validate(ctx context.Context, pid peer.ID, msg *pubsub.Message) bool {
|
||||||
stats.Record(ctx, metrics.MessageReceived.M(1))
|
stats.Record(ctx, metrics.MessageReceived.M(1))
|
||||||
ctx, _ = tag.New(ctx, tag.Insert(metrics.PeerID, pid.String()))
|
|
||||||
m, err := types.DecodeSignedMessage(msg.Message.GetData())
|
m, err := types.DecodeSignedMessage(msg.Message.GetData())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnf("failed to decode incoming message: %s", err)
|
log.Warnf("failed to decode incoming message: %s", err)
|
||||||
@ -191,9 +184,6 @@ func (mv *MessageValidator) Validate(ctx context.Context, pid peer.ID, msg *pubs
|
|||||||
log.Warnf("failed to add message from network to message pool (From: %s, To: %s, Nonce: %d, Value: %s): %s", m.Message.From, m.Message.To, m.Message.Nonce, types.FIL(m.Message.Value), err)
|
log.Warnf("failed to add message from network to message pool (From: %s, To: %s, Nonce: %d, Value: %s): %s", m.Message.From, m.Message.To, m.Message.Nonce, types.FIL(m.Message.Value), err)
|
||||||
ctx, _ = tag.New(
|
ctx, _ = tag.New(
|
||||||
ctx,
|
ctx,
|
||||||
tag.Insert(metrics.MessageFrom, m.Message.From.String()),
|
|
||||||
tag.Insert(metrics.MessageTo, m.Message.To.String()),
|
|
||||||
tag.Insert(metrics.MessageNonce, fmt.Sprint(m.Message.Nonce)),
|
|
||||||
tag.Insert(metrics.FailureType, "add"),
|
tag.Insert(metrics.FailureType, "add"),
|
||||||
)
|
)
|
||||||
stats.Record(ctx, metrics.MessageValidationFailure.M(1))
|
stats.Record(ctx, metrics.MessageValidationFailure.M(1))
|
||||||
|
@ -36,67 +36,83 @@ var (
|
|||||||
RPCResponseError = stats.Int64("rpc/response_error", "Total number of responses errors handled", stats.UnitDimensionless)
|
RPCResponseError = stats.Int64("rpc/response_error", "Total number of responses errors handled", stats.UnitDimensionless)
|
||||||
)
|
)
|
||||||
|
|
||||||
// DefaultViews is an array of Consensus views for metric gathering purposes
|
var (
|
||||||
var DefaultViews = []*view.View{
|
InfoView = &view.View{
|
||||||
&view.View{
|
|
||||||
Name: "info",
|
Name: "info",
|
||||||
Description: "Lotus node information",
|
Description: "Lotus node information",
|
||||||
Measure: LotusInfo,
|
Measure: LotusInfo,
|
||||||
Aggregation: view.LastValue(),
|
Aggregation: view.LastValue(),
|
||||||
TagKeys: []tag.Key{Version, Commit},
|
TagKeys: []tag.Key{Version, Commit},
|
||||||
},
|
}
|
||||||
&view.View{
|
ChainNodeHeightView = &view.View{
|
||||||
Measure: ChainNodeHeight,
|
Measure: ChainNodeHeight,
|
||||||
Aggregation: view.LastValue(),
|
Aggregation: view.LastValue(),
|
||||||
},
|
}
|
||||||
&view.View{
|
ChainNodeWorkerHeightView = &view.View{
|
||||||
Measure: ChainNodeWorkerHeight,
|
Measure: ChainNodeWorkerHeight,
|
||||||
Aggregation: view.LastValue(),
|
Aggregation: view.LastValue(),
|
||||||
},
|
}
|
||||||
&view.View{
|
BlockReceivedView = &view.View{
|
||||||
Measure: BlockReceived,
|
Measure: BlockReceived,
|
||||||
Aggregation: view.Count(),
|
Aggregation: view.Count(),
|
||||||
},
|
}
|
||||||
&view.View{
|
BlockValidationFailureView = &view.View{
|
||||||
Measure: BlockValidationFailure,
|
Measure: BlockValidationFailure,
|
||||||
Aggregation: view.Count(),
|
Aggregation: view.Count(),
|
||||||
TagKeys: []tag.Key{FailureType, PeerID, ReceivedFrom},
|
TagKeys: []tag.Key{FailureType},
|
||||||
},
|
}
|
||||||
&view.View{
|
BlockValidationSuccessView = &view.View{
|
||||||
Measure: BlockValidationSuccess,
|
Measure: BlockValidationSuccess,
|
||||||
Aggregation: view.Count(),
|
Aggregation: view.Count(),
|
||||||
},
|
}
|
||||||
&view.View{
|
MessageReceivedView = &view.View{
|
||||||
Measure: MessageReceived,
|
Measure: MessageReceived,
|
||||||
Aggregation: view.Count(),
|
Aggregation: view.Count(),
|
||||||
},
|
}
|
||||||
&view.View{
|
MessageValidationFailureView = &view.View{
|
||||||
Measure: MessageValidationFailure,
|
Measure: MessageValidationFailure,
|
||||||
Aggregation: view.Count(),
|
Aggregation: view.Count(),
|
||||||
TagKeys: []tag.Key{FailureType, MessageFrom, MessageTo, MessageNonce},
|
TagKeys: []tag.Key{FailureType},
|
||||||
},
|
}
|
||||||
&view.View{
|
MessageValidationSuccessView = &view.View{
|
||||||
Measure: MessageValidationSuccess,
|
Measure: MessageValidationSuccess,
|
||||||
Aggregation: view.Count(),
|
Aggregation: view.Count(),
|
||||||
},
|
}
|
||||||
&view.View{
|
PeerCountView = &view.View{
|
||||||
Measure: PeerCount,
|
Measure: PeerCount,
|
||||||
Aggregation: view.LastValue(),
|
Aggregation: view.LastValue(),
|
||||||
},
|
}
|
||||||
// All RPC related metrics should at the very least tag the RPCMethod
|
// All RPC related metrics should at the very least tag the RPCMethod
|
||||||
&view.View{
|
RPCInvalidMethodView = &view.View{
|
||||||
Measure: RPCInvalidMethod,
|
Measure: RPCInvalidMethod,
|
||||||
Aggregation: view.Count(),
|
Aggregation: view.Count(),
|
||||||
TagKeys: []tag.Key{RPCMethod},
|
TagKeys: []tag.Key{RPCMethod},
|
||||||
},
|
}
|
||||||
&view.View{
|
RPCRequestErrorView = &view.View{
|
||||||
Measure: RPCRequestError,
|
Measure: RPCRequestError,
|
||||||
Aggregation: view.Count(),
|
Aggregation: view.Count(),
|
||||||
TagKeys: []tag.Key{RPCMethod},
|
TagKeys: []tag.Key{RPCMethod},
|
||||||
},
|
}
|
||||||
&view.View{
|
RPCResponseErrorView = &view.View{
|
||||||
Measure: RPCResponseError,
|
Measure: RPCResponseError,
|
||||||
Aggregation: view.Count(),
|
Aggregation: view.Count(),
|
||||||
TagKeys: []tag.Key{RPCMethod},
|
TagKeys: []tag.Key{RPCMethod},
|
||||||
},
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// DefaultViews is an array of OpenCensus views for metric gathering purposes
|
||||||
|
var DefaultViews = []*view.View{
|
||||||
|
InfoView,
|
||||||
|
ChainNodeHeightView,
|
||||||
|
ChainNodeWorkerHeightView,
|
||||||
|
BlockReceivedView,
|
||||||
|
BlockValidationFailureView,
|
||||||
|
BlockValidationSuccessView,
|
||||||
|
MessageReceivedView,
|
||||||
|
MessageValidationFailureView,
|
||||||
|
MessageValidationSuccessView,
|
||||||
|
PeerCountView,
|
||||||
|
RPCInvalidMethodView,
|
||||||
|
RPCRequestErrorView,
|
||||||
|
RPCResponseErrorView,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user