Documentation ¶
Index ¶
Constants ¶
const ( // ExporterKey is an attribute name that identifies an // exporter component that produces internal metrics, logs, // and traces. ExporterKey = "exporter" // ReceiverKey is an attribute name that identifies an // receiver component that produces internal metrics, logs, // and traces. ReceiverKey = "receiver" // SentBytes is used to track bytes sent by exporters and receivers. SentBytes = "sent" // SentWireBytes is used to track bytes sent on the wire // (includes compression) by exporters and receivers. SentWireBytes = "sent_wire" // RecvBytes is used to track bytes received by exporters and receivers. RecvBytes = "recv" // RecvWireBytes is used to track bytes received on the wire // (includes compression) by exporters and receivers. RecvWireBytes = "recv_wire" // CompSize is used for compressed size histogram metrics. CompSize = "compressed_size" )
Variables ¶
This section is empty.
Functions ¶
func GRPCStreamMethodName ¶
func GRPCStreamMethodName(desc grpc.ServiceDesc, stream grpc.StreamDesc) string
GRPCStreamMethodName applies the logic gRPC uses but does not expose to construct method names. This allows direct calling of the netstats interface from outside a gRPC stats handler.
func GRPCUnaryMethodName ¶
func GRPCUnaryMethodName(desc grpc.ServiceDesc, method grpc.MethodDesc) string
GRPCUnaryMethodName applies the logic gRPC uses but does not expose to construct method names. This allows direct calling of the netstats interface from outside a gRPC stats handler.
Types ¶
type Interface ¶
type Interface interface { // CountSend reports outbound bytes. CountSend(ctx context.Context, ss SizesStruct) // CountSend reports inbound bytes. CountReceive(ctx context.Context, ss SizesStruct) }
Interface describes a *NetworkReporter or a Noop.
type NetworkReporter ¶
type NetworkReporter struct {
// contains filtered or unexported fields
}
NetworkReporter is a helper to add network-level observability to an exporter or receiver.
func NewExporterNetworkReporter ¶
func NewExporterNetworkReporter(settings exporter.Settings) (*NetworkReporter, error)
NewExporterNetworkReporter creates a new NetworkReporter configured for an exporter.
func NewReceiverNetworkReporter ¶
func NewReceiverNetworkReporter(settings receiver.Settings) (*NetworkReporter, error)
NewReceiverNetworkReporter creates a new NetworkReporter configured for an exporter.
func (*NetworkReporter) CountReceive ¶
func (rep *NetworkReporter) CountReceive(ctx context.Context, ss SizesStruct)
CountReceive is used to report a message received by the component. For exporters, SizesStruct indicates the size of a response. For receivers, SizesStruct indicates the size of a request.
func (*NetworkReporter) CountSend ¶
func (rep *NetworkReporter) CountSend(ctx context.Context, ss SizesStruct)
CountSend is used to report a message sent by the component. For exporters, SizesStruct indicates the size of a request. For receivers, SizesStruct indicates the size of a response.
func (*NetworkReporter) Handler ¶
func (rep *NetworkReporter) Handler() stats.Handler
type Noop ¶
type Noop struct{}
Noop is a no-op implementation of Interface.
func (Noop) CountReceive ¶
func (Noop) CountReceive(context.Context, SizesStruct)
type SizesStruct ¶
type SizesStruct struct { // Method refers to the gRPC method name Method string // Length is the uncompressed size Length int64 // WireLength is compressed size WireLength int64 }
SizesStruct is used to pass uncompressed on-wire message lengths to the CountSend() and CountReceive() methods.