Documentation

Index

Constants

This section is empty.

Variables

var (
	// CollectionTag holds the collection for the context.
	CollectionTag tag.Key
	// ErrorCodeTag holds the gRPC error code for the context.
	ErrorCodeTag tag.Key
	// ErrorTag holds the error string for the context.
	ErrorTag tag.Key
	// ConnectionIDTag holds the connection ID for the context.
	ConnectionIDTag tag.Key
	// CodeTag holds the status code for the context.
	CodeTag tag.Key
)

Functions

This section is empty.

Types

type Reporter

type Reporter interface {
	io.Closer

	RecordSendError(err error, code codes.Code)
	RecordRecvError(err error, code codes.Code)
	RecordRequestSize(collection string, connectionID int64, size int)
	RecordRequestAck(collection string, connectionID int64)
	RecordRequestNack(collection string, connectionID int64, code codes.Code)

	SetStreamCount(clients int64)
	RecordStreamCreateSuccess()
}

Reporter is used to report metrics for an MCP server.

type StatsContext

type StatsContext struct {
	// contains filtered or unexported fields
}

StatsContext enables metric collection backed by OpenCensus.

func NewStatsContext

func NewStatsContext(prefix string) *StatsContext

NewStatsContext creates a new context for recording metrics using OpenCensus. The specified prefix is prepended to all metric names and must be a non-empty string.

func (*StatsContext) Close

func (s *StatsContext) Close() error

func (*StatsContext) RecordRecvError

func (s *StatsContext) RecordRecvError(err error, code codes.Code)

RecordRecvError records an error during a network recv with its error string and code.

func (*StatsContext) RecordRequestAck

func (s *StatsContext) RecordRequestAck(collection string, connectionID int64)

RecordRequestAck records an ACK message for a collection on a connection.

func (*StatsContext) RecordRequestNack

func (s *StatsContext) RecordRequestNack(collection string, connectionID int64, code codes.Code)

RecordRequestNack records a NACK message for a collection on a connection.

func (*StatsContext) RecordRequestSize

func (s *StatsContext) RecordRequestSize(collection string, connectionID int64, size int)

RecordRequestSize records the size of a request from a connection for a specific type URL.

func (*StatsContext) RecordSendError

func (s *StatsContext) RecordSendError(err error, code codes.Code)

RecordSendError records an error during a network send with its error string and code.

func (*StatsContext) RecordStreamCreateSuccess

func (s *StatsContext) RecordStreamCreateSuccess()

RecordStreamCreateSuccess records a successful stream connection.

func (*StatsContext) SetStreamCount

func (s *StatsContext) SetStreamCount(clients int64)

SetStreamCount updates the current client count to the given argument.

Source Files