netstats

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

View Source
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 added in v0.7.0

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 added in v0.7.0

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 added in v0.7.0

type Interface interface {
	// CountSend reports outbound bytes.
	CountSend(ctx context.Context, ss SizesStruct)

	// CountSend reports inbound bytes.
	CountReceive(ctx context.Context, ss SizesStruct)

	// SetSpanAttributes is a No-Op. Deprecated.  Remove uses of
	// this function as the same functionality is included in
	// CountSend/CountReceive.  Remove this after the collector-contrib
	// components have been updated to not reference this method.
	SetSpanSizeAttributes(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 added in v0.7.0

func (rep *NetworkReporter) Handler() stats.Handler

func (*NetworkReporter) SetSpanSizeAttributes added in v0.17.0

func (*NetworkReporter) SetSpanSizeAttributes(ctx context.Context, ss SizesStruct)

SetSpanSizeAttributes is a no-op.

type Noop added in v0.7.0

type Noop struct{}

Noop is a no-op implementation of Interface.

func (Noop) CountReceive added in v0.7.0

func (Noop) CountReceive(ctx context.Context, ss SizesStruct)

func (Noop) CountSend added in v0.7.0

func (Noop) CountSend(ctx context.Context, ss SizesStruct)

func (Noop) SetSpanSizeAttributes added in v0.17.0

func (Noop) SetSpanSizeAttributes(ctx context.Context, ss 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.

Jump to

Keyboard shortcuts

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