This section is empty.


This section is empty.


This section is empty.


type InMemoryStatsContext

type InMemoryStatsContext struct {
	StreamTotal              int64
	RequestSizesBytes        map[requestKey][]int64
	RequestAcksTotal         map[requestKey]int64
	RequestNacksTotal        map[nackKey]int64
	SendFailuresTotal        map[errorCodeKey]int64
	RecvFailuresTotal        map[errorCodeKey]int64
	StreamCreateSuccessTotal int64
	// contains filtered or unexported fields

InMemoryStatsContext enables MCP server metric collection which is stored in memory for testing purposes.

func NewInMemoryStatsContext

func NewInMemoryStatsContext() *InMemoryStatsContext

NewInMemoryStatsContext creates a new context for tracking metrics in memory.

func (*InMemoryStatsContext) Close

func (s *InMemoryStatsContext) Close() error

Close implements io.Closer.

func (*InMemoryStatsContext) RecordRecvError

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

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

func (*InMemoryStatsContext) RecordRequestAck

func (s *InMemoryStatsContext) RecordRequestAck(typeURL string, connectionID int64)

RecordRequestAck records an ACK message for a type URL on a connection.

func (*InMemoryStatsContext) RecordRequestNack

func (s *InMemoryStatsContext) RecordRequestNack(typeURL string, connectionID int64, code codes.Code)

RecordRequestNack records a NACK message for a type URL on a connection.

func (*InMemoryStatsContext) RecordRequestSize

func (s *InMemoryStatsContext) RecordRequestSize(typeURL string, connectionID int64, size int)

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

func (*InMemoryStatsContext) RecordSendError

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

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

func (*InMemoryStatsContext) RecordStreamCreateSuccess

func (s *InMemoryStatsContext) RecordStreamCreateSuccess()

RecordStreamCreateSuccess records a successful stream connection.

func (*InMemoryStatsContext) SetStreamCount

func (s *InMemoryStatsContext) SetStreamCount(clients int64)

SetStreamCount updates the current stream count to the given argument.

Source Files