Merge pull request #474 from libp2p/feat/log-names

give views names again
This commit is contained in:
Steven Allen 2020-03-03 18:24:30 -08:00 committed by GitHub
commit cf1c489d50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,55 +41,70 @@ var (
SentBytes = stats.Int64("libp2p.io/dht/kad/sent_bytes", "Total sent bytes per RPC", stats.UnitBytes) SentBytes = stats.Int64("libp2p.io/dht/kad/sent_bytes", "Total sent bytes per RPC", stats.UnitBytes)
) )
var DefaultViews = []*view.View{ // Views
&view.View{ var (
ReceivedMessagesView = &view.View{
Measure: ReceivedMessages, Measure: ReceivedMessages,
TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID}, TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID},
Aggregation: view.Count(), Aggregation: view.Count(),
}, }
&view.View{ ReceivedMessageErrorsView = &view.View{
Measure: ReceivedMessageErrors, Measure: ReceivedMessageErrors,
TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID}, TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID},
Aggregation: view.Count(), Aggregation: view.Count(),
}, }
&view.View{ ReceivedBytesView = &view.View{
Measure: ReceivedBytes, Measure: ReceivedBytes,
TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID}, TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID},
Aggregation: defaultBytesDistribution, Aggregation: defaultBytesDistribution,
}, }
&view.View{ InboundRequestLatencyView = &view.View{
Measure: InboundRequestLatency, Measure: InboundRequestLatency,
TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID}, TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID},
Aggregation: defaultMillisecondsDistribution, Aggregation: defaultMillisecondsDistribution,
}, }
&view.View{ OutboundRequestLatencyView = &view.View{
Measure: OutboundRequestLatency, Measure: OutboundRequestLatency,
TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID}, TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID},
Aggregation: defaultMillisecondsDistribution, Aggregation: defaultMillisecondsDistribution,
}, }
&view.View{ SentMessagesView = &view.View{
Measure: SentMessages, Measure: SentMessages,
TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID}, TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID},
Aggregation: view.Count(), Aggregation: view.Count(),
}, }
&view.View{ SentMessageErrorsView = &view.View{
Measure: SentMessageErrors, Measure: SentMessageErrors,
TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID}, TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID},
Aggregation: view.Count(), Aggregation: view.Count(),
}, }
&view.View{ SentRequestsView = &view.View{
Measure: SentRequests, Measure: SentRequests,
TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID}, TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID},
Aggregation: view.Count(), Aggregation: view.Count(),
}, }
&view.View{ SentRequestErrorsView = &view.View{
Measure: SentRequestErrors, Measure: SentRequestErrors,
TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID}, TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID},
Aggregation: view.Count(), Aggregation: view.Count(),
}, }
&view.View{ SentBytesView = &view.View{
Measure: SentBytes, Measure: SentBytes,
TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID}, TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID},
Aggregation: defaultBytesDistribution, Aggregation: defaultBytesDistribution,
}, }
)
// DefaultViews with all views in it.
var DefaultViews = []*view.View{
ReceivedMessagesView,
ReceivedMessageErrorsView,
ReceivedBytesView,
InboundRequestLatencyView,
OutboundRequestLatencyView,
SentMessagesView,
SentMessageErrorsView,
SentRequestsView,
SentRequestErrorsView,
SentBytesView,
} }