metrics

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KeyMessageType, _ = tag.NewKey("message_type")
	KeyPeerID, _      = tag.NewKey("peer_id")
	// KeyInstanceID 通过指针地址标识DHT实例
	// 用于区分具有相同对等ID的不同DHT
	KeyInstanceID, _ = tag.NewKey("instance_id")
)

Keys 标签键

View Source
var (
	ReceivedMessages       = stats.Int64("libp2p.io/dht/kad/received_messages", "每个RPC接收的消息总数", stats.UnitDimensionless)
	ReceivedMessageErrors  = stats.Int64("libp2p.io/dht/kad/received_message_errors", "每个RPC接收消息的错误总数", stats.UnitDimensionless)
	ReceivedBytes          = stats.Int64("libp2p.io/dht/kad/received_bytes", "每个RPC接收的总字节数", stats.UnitBytes)
	InboundRequestLatency  = stats.Float64("libp2p.io/dht/kad/inbound_request_latency", "每个RPC的延迟", stats.UnitMilliseconds)
	OutboundRequestLatency = stats.Float64("libp2p.io/dht/kad/outbound_request_latency", "每个RPC的延迟", stats.UnitMilliseconds)
	SentMessages           = stats.Int64("libp2p.io/dht/kad/sent_messages", "每个RPC发送的消息总数", stats.UnitDimensionless)
	SentMessageErrors      = stats.Int64("libp2p.io/dht/kad/sent_message_errors", "每个RPC发送消息的错误总数", stats.UnitDimensionless)
	SentRequests           = stats.Int64("libp2p.io/dht/kad/sent_requests", "每个RPC发送的请求总数", stats.UnitDimensionless)
	SentRequestErrors      = stats.Int64("libp2p.io/dht/kad/sent_request_errors", "每个RPC发送请求的错误总数", stats.UnitDimensionless)
	SentBytes              = stats.Int64("libp2p.io/dht/kad/sent_bytes", "每个RPC发送的总字节数", stats.UnitBytes)
	NetworkSize            = stats.Int64("libp2p.io/dht/kad/network_size", "网络规模估计", stats.UnitDimensionless)
)

Measures 度量指标

View Source
var (
	ReceivedMessagesView = &view.View{
		Measure:     ReceivedMessages,
		TagKeys:     []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID},
		Aggregation: view.Count(),
	}
	ReceivedMessageErrorsView = &view.View{
		Measure:     ReceivedMessageErrors,
		TagKeys:     []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID},
		Aggregation: view.Count(),
	}
	ReceivedBytesView = &view.View{
		Measure:     ReceivedBytes,
		TagKeys:     []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID},
		Aggregation: defaultBytesDistribution,
	}
	InboundRequestLatencyView = &view.View{
		Measure:     InboundRequestLatency,
		TagKeys:     []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID},
		Aggregation: defaultMillisecondsDistribution,
	}
	OutboundRequestLatencyView = &view.View{
		Measure:     OutboundRequestLatency,
		TagKeys:     []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID},
		Aggregation: defaultMillisecondsDistribution,
	}
	SentMessagesView = &view.View{
		Measure:     SentMessages,
		TagKeys:     []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID},
		Aggregation: view.Count(),
	}
	SentMessageErrorsView = &view.View{
		Measure:     SentMessageErrors,
		TagKeys:     []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID},
		Aggregation: view.Count(),
	}
	SentRequestsView = &view.View{
		Measure:     SentRequests,
		TagKeys:     []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID},
		Aggregation: view.Count(),
	}
	SentRequestErrorsView = &view.View{
		Measure:     SentRequestErrors,
		TagKeys:     []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID},
		Aggregation: view.Count(),
	}
	SentBytesView = &view.View{
		Measure:     SentBytes,
		TagKeys:     []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID},
		Aggregation: defaultBytesDistribution,
	}
	NetworkSizeView = &view.View{
		Measure:     NetworkSize,
		TagKeys:     []tag.Key{KeyPeerID, KeyInstanceID},
		Aggregation: view.Count(),
	}
)

Views 视图定义

DefaultViews 包含所有默认视图 返回值:

  • []*view.View 视图列表

Functions

func UpsertMessageType

func UpsertMessageType(m *pb.Message) tag.Mutator

UpsertMessageType 将pb.Message的消息类型更新到KeyMessageType中 参数:

  • m: *pb.Message 消息对象

返回值:

  • tag.Mutator 标签变更器

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL