Add views for pubsub metrics

This commit is contained in:
lanzafame 2020-08-28 16:25:50 +10:00
parent 094baf8aa9
commit 3ebe4ebb3d

View File

@ -83,6 +83,10 @@ var (
Measure: BlockValidationDurationMilliseconds, Measure: BlockValidationDurationMilliseconds,
Aggregation: defaultMillisecondsDistribution, Aggregation: defaultMillisecondsDistribution,
} }
MessagePublishedView = &view.View{
Measure: MessagePublished,
Aggregation: view.Count(),
}
MessageReceivedView = &view.View{ MessageReceivedView = &view.View{
Measure: MessageReceived, Measure: MessageReceived,
Aggregation: view.Count(), Aggregation: view.Count(),
@ -100,6 +104,34 @@ var (
Measure: PeerCount, Measure: PeerCount,
Aggregation: view.LastValue(), Aggregation: view.LastValue(),
} }
PubsubPublishMessageView = &view.View{
Measure: PubsubPublishMessage,
Aggregation: view.Count(),
}
PubsubDeliverMessageView = &view.View{
Measure: PubsubDeliverMessage,
Aggregation: view.Count(),
}
PubsubRejectMessageView = &view.View{
Measure: PubsubRejectMessage,
Aggregation: view.Count(),
}
PubsubDuplicateMessageView = &view.View{
Measure: PubsubDuplicateMessage,
Aggregation: view.Count(),
}
PubsubRecvRPCView = &view.View{
Measure: PubsubRecvRPC,
Aggregation: view.Count(),
}
PubsubSendRPCView = &view.View{
Measure: PubsubSendRPC,
Aggregation: view.Count(),
}
PubsubDropRPCView = &view.View{
Measure: PubsubDropRPC,
Aggregation: view.Count(),
}
) )
// DefaultViews is an array of OpenCensus views for metric gathering purposes // DefaultViews is an array of OpenCensus views for metric gathering purposes
@ -111,10 +143,18 @@ var DefaultViews = append([]*view.View{
BlockValidationFailureView, BlockValidationFailureView,
BlockValidationSuccessView, BlockValidationSuccessView,
BlockValidationDurationView, BlockValidationDurationView,
MessagePublishedView,
MessageReceivedView, MessageReceivedView,
MessageValidationFailureView, MessageValidationFailureView,
MessageValidationSuccessView, MessageValidationSuccessView,
PeerCountView, PeerCountView,
PubsubPublishMessageView,
PubsubDeliverMessageView,
PubsubRejectMessageView,
PubsubDuplicateMessageView,
PubsubRecvRPCView,
PubsubSendRPCView,
PubsubDropRPCView,
}, },
rpcmetrics.DefaultViews...) rpcmetrics.DefaultViews...)