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 (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
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 {
|
||||
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())
|
||||
if err != nil {
|
||||
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 {
|
||||
stats.Record(ctx, metrics.MessageReceived.M(1))
|
||||
ctx, _ = tag.New(ctx, tag.Insert(metrics.PeerID, pid.String()))
|
||||
m, err := types.DecodeSignedMessage(msg.Message.GetData())
|
||||
if err != nil {
|
||||
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)
|
||||
ctx, _ = tag.New(
|
||||
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"),
|
||||
)
|
||||
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)
|
||||
)
|
||||
|
||||
// DefaultViews is an array of Consensus views for metric gathering purposes
|
||||
var DefaultViews = []*view.View{
|
||||
&view.View{
|
||||
var (
|
||||
InfoView = &view.View{
|
||||
Name: "info",
|
||||
Description: "Lotus node information",
|
||||
Measure: LotusInfo,
|
||||
Aggregation: view.LastValue(),
|
||||
TagKeys: []tag.Key{Version, Commit},
|
||||
},
|
||||
&view.View{
|
||||
}
|
||||
ChainNodeHeightView = &view.View{
|
||||
Measure: ChainNodeHeight,
|
||||
Aggregation: view.LastValue(),
|
||||
},
|
||||
&view.View{
|
||||
}
|
||||
ChainNodeWorkerHeightView = &view.View{
|
||||
Measure: ChainNodeWorkerHeight,
|
||||
Aggregation: view.LastValue(),
|
||||
},
|
||||
&view.View{
|
||||
}
|
||||
BlockReceivedView = &view.View{
|
||||
Measure: BlockReceived,
|
||||
Aggregation: view.Count(),
|
||||
},
|
||||
&view.View{
|
||||
}
|
||||
BlockValidationFailureView = &view.View{
|
||||
Measure: BlockValidationFailure,
|
||||
Aggregation: view.Count(),
|
||||
TagKeys: []tag.Key{FailureType, PeerID, ReceivedFrom},
|
||||
},
|
||||
&view.View{
|
||||
TagKeys: []tag.Key{FailureType},
|
||||
}
|
||||
BlockValidationSuccessView = &view.View{
|
||||
Measure: BlockValidationSuccess,
|
||||
Aggregation: view.Count(),
|
||||
},
|
||||
&view.View{
|
||||
}
|
||||
MessageReceivedView = &view.View{
|
||||
Measure: MessageReceived,
|
||||
Aggregation: view.Count(),
|
||||
},
|
||||
&view.View{
|
||||
}
|
||||
MessageValidationFailureView = &view.View{
|
||||
Measure: MessageValidationFailure,
|
||||
Aggregation: view.Count(),
|
||||
TagKeys: []tag.Key{FailureType, MessageFrom, MessageTo, MessageNonce},
|
||||
},
|
||||
&view.View{
|
||||
TagKeys: []tag.Key{FailureType},
|
||||
}
|
||||
MessageValidationSuccessView = &view.View{
|
||||
Measure: MessageValidationSuccess,
|
||||
Aggregation: view.Count(),
|
||||
},
|
||||
&view.View{
|
||||
}
|
||||
PeerCountView = &view.View{
|
||||
Measure: PeerCount,
|
||||
Aggregation: view.LastValue(),
|
||||
},
|
||||
}
|
||||
// All RPC related metrics should at the very least tag the RPCMethod
|
||||
&view.View{
|
||||
RPCInvalidMethodView = &view.View{
|
||||
Measure: RPCInvalidMethod,
|
||||
Aggregation: view.Count(),
|
||||
TagKeys: []tag.Key{RPCMethod},
|
||||
},
|
||||
&view.View{
|
||||
}
|
||||
RPCRequestErrorView = &view.View{
|
||||
Measure: RPCRequestError,
|
||||
Aggregation: view.Count(),
|
||||
TagKeys: []tag.Key{RPCMethod},
|
||||
},
|
||||
&view.View{
|
||||
}
|
||||
RPCResponseErrorView = &view.View{
|
||||
Measure: RPCResponseError,
|
||||
Aggregation: view.Count(),
|
||||
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