monitor

package
v0.0.0-...-7febb3a Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TransportPool = NewReferenceCountedPool(
	func(counter ReferenceCounter) ReferenceCountable {
		br := new(Transport)
		br.ReferenceCounter = counter
		return br
	}, ResetTransport)

Functions

func MonitorHandlerFunc

func MonitorHandlerFunc(ctx context.Context, c echo.Context) error

func NewEventsMonitor

func NewEventsMonitor(ctx context.Context, dataChan chan *Transport,
	monitorRequest *MonitorRequest, errChan chan error)

func NewQueueMessagesMonitor

func NewQueueMessagesMonitor(ctx context.Context, dataChan chan *Transport, monitorRequest *MonitorRequest, errChan chan error)

func NewReferenceCountedPool

func NewReferenceCountedPool(factory func(referenceCounter ReferenceCounter) ReferenceCountable, reset func(interface{}) error) *referenceCountedPool

Method to create a new pool

func NewRequestResponseMonitor

func NewRequestResponseMonitor(ctx context.Context, dataChan chan *Transport, monitorRequest *MonitorRequest, errChan chan error)

func ResetTransport

func ResetTransport(i interface{}) error

func TransformToDtoString

func TransformToDtoString(tr *Transport) (string, error)

Types

type Middleware

type Middleware struct {
	Stopped chan struct{}
	// contains filtered or unexported fields
}

func NewMonitorMiddleware

func NewMonitorMiddleware(ctx context.Context, appConfig *config.Config) (*Middleware, error)

func (*Middleware) CheckAndSendCommand

func (md *Middleware) CheckAndSendCommand(ctx context.Context, req *pb.Request, res *pb.Response, err error)

func (*Middleware) CheckAndSendQuery

func (md *Middleware) CheckAndSendQuery(ctx context.Context, req *pb.Request, res *pb.Response, err error)

func (*Middleware) Shutdown

func (md *Middleware) Shutdown()

type MiddlewareMessage

type MiddlewareMessage struct {
	Kind             string `json:"kind"`
	MonitoredChannel string `json:"monitored_channel"`
	PublishChannel   string `json:"publish_channel"`
}

func NewMiddlewareMessage

func NewMiddlewareMessage(msg *pb.EventReceive) *MiddlewareMessage

func (*MiddlewareMessage) ToMessage

func (mm *MiddlewareMessage) ToMessage(channel string) *pb.Event

type MonitorRequest

type MonitorRequest struct {
	Kind        entities.KindType `json:"kind"`
	Channel     string            `json:"channel"`
	MaxBodySize int               `json:"max_body_size"`
}

type ReferenceCountable

type ReferenceCountable interface {
	// Method to set the current instance
	SetInstance(i interface{})
	// Method to increment the reference count
	IncrementReferenceCount()
	// Method to decrement reference count
	DecrementReferenceCount()
}

type ReferenceCounter

type ReferenceCounter struct {
	Instance interface{}
	// contains filtered or unexported fields
}

func (ReferenceCounter) DecrementReferenceCount

func (r ReferenceCounter) DecrementReferenceCount()

Method to decrement a reference If the reference count goes to zero, the object is put back inside the pool

func (ReferenceCounter) IncrementReferenceCount

func (r ReferenceCounter) IncrementReferenceCount()

Method to increment a reference

func (*ReferenceCounter) SetInstance

func (r *ReferenceCounter) SetInstance(i interface{})

Method to set the current instance

type ResponseError

type ResponseError struct {
	Kind      string `json:"kind"`
	RequestID string `json:"request_id"`
	Error     string `json:"error"`
}

func NewResponseErrorFromRequest

func NewResponseErrorFromRequest(v *pb.Request, err error) *ResponseError

func (*ResponseError) JsonString

func (re *ResponseError) JsonString() string

func (*ResponseError) ToMessage

func (re *ResponseError) ToMessage(channel string) *pb.Event

type Transport

type Transport struct {
	ReferenceCounter `sql:"-"`
	ClientID         string  `json:"client_id"`
	Channel          string  `json:"channel"`
	Kind             string  `json:"kind"`
	SubKind          string  `json:"sub_kind"`
	Error            error   `json:"error"`
	Payload          []byte  `json:"payload"`
	BodySize         float32 `json:"payload_size"`
	BodySize2        float32 `json:"body_size_2"`
	CacheKeyExist    bool    `json:"cache_key_exist"`
	CacheHit         bool    `json:"cache_hit"`
	ResponseEmpty    bool    `json:"response_empty"`
	ClientID2        string  `json:"client_id_2"`
	Latency          float64 `json:"latency"`
}

func NewTransport

func NewTransport() *Transport

func NewTransportFromMessage

func NewTransportFromMessage(v *pb.Event) *Transport

func NewTransportFromMessageReceived

func NewTransportFromMessageReceived(v *pb.EventReceive) *Transport

func NewTransportFromQueueMessage

func NewTransportFromQueueMessage(v *pb.QueueMessage) *Transport

func NewTransportFromRequest

func NewTransportFromRequest(v *pb.Request) *Transport

func NewTransportFromRequestAndResponse

func NewTransportFromRequestAndResponse(v1 *pb.Request, v2 *pb.Response) *Transport

func NewTransportFromResponse

func NewTransportFromResponse(v *pb.Response) *Transport

func NewTransportFromResponseError

func NewTransportFromResponseError(v *ResponseError) *Transport

func (*Transport) Finish

func (t *Transport) Finish()

func (*Transport) Reset

func (t *Transport) Reset()

func (*Transport) SetClient

func (t *Transport) SetClient(clientID string) *Transport

func (*Transport) SetClient2

func (t *Transport) SetClient2(clientID string) *Transport

func (*Transport) SetError

func (t *Transport) SetError(err error) *Transport

func (*Transport) SetLatency

func (t *Transport) SetLatency(value float64) *Transport

func (*Transport) SetPayload

func (t *Transport) SetPayload(v interface{}) *Transport

func (*Transport) SetSubKind

func (t *Transport) SetSubKind(v string) *Transport

func (*Transport) String

func (t *Transport) String() string

func (*Transport) Unmarshal

func (t *Transport) Unmarshal(v interface{}) error

type TransportBatch

type TransportBatch struct {
	Item      *Transport
	IsErr     bool
	ClientIds []string
}

type TransportPubSubMessageDto

type TransportPubSubMessageDto struct {
	MessageId string `json:"messageId"`
	Metadata  string `json:"metadata,omitempty"`
	Body      any    `json:"body,omitempty"`
	Timestamp string `json:"timestamp,omitempty"`
	Sequence  int64  `json:"sequence,omitempty"`
	Tags      string `json:"tags,omitempty"`
}

func NewTransportPubSubMessageDto

func NewTransportPubSubMessageDto(tr *Transport) *TransportPubSubMessageDto

type TransportQueueMessageDto

type TransportQueueMessageDto struct {
	MessageId     string `json:"messageId"`
	Metadata      string `json:"metadata,omitempty"`
	Body          any    `json:"body,omitempty"`
	Timestamp     string `json:"timestamp,omitempty"`
	Sequence      int64  `json:"sequence,omitempty"`
	Tags          string `json:"tags,omitempty"`
	ReceivedCount int32  `json:"receivedCount,omitempty"`
	ReRoutedFrom  string `json:"reRoutedFrom,omitempty"`
	ExpirationAt  string `json:"expirationAt,omitempty"`
	DelayedTo     string `json:"delayedTo,omitempty"`
}

func NewTransportQueueMessageDto

func NewTransportQueueMessageDto(tr *Transport) *TransportQueueMessageDto

type TransportRequestMessageDto

type TransportRequestMessageDto struct {
	RequestId string `json:"requestId"`
	Metadata  string `json:"metadata,omitempty"`
	Body      any    `json:"body,omitempty"`
	Timeout   int32  `json:"timeout,omitempty"`
	Tags      string `json:"tags,omitempty"`
}

func NewTransportRequestMessageDto

func NewTransportRequestMessageDto(tr *Transport) *TransportRequestMessageDto

type TransportResponseErrorMessageDto

type TransportResponseErrorMessageDto struct {
	RequestId string `json:"requestId"`
	Error     string `json:"error,omitempty"`
	Timestamp string `json:"timestamp,omitempty"`
}

func NewTransportResponseErrorMessageDto

func NewTransportResponseErrorMessageDto(tr *Transport) *TransportResponseErrorMessageDto

type TransportResponseMessageDto

type TransportResponseMessageDto struct {
	RequestId string `json:"requestId"`
	Metadata  string `json:"metadata,omitempty"`
	Body      any    `json:"body,omitempty"`
	Timestamp string `json:"timestamp,omitempty"`
	Tags      string `json:"tags,omitempty"`
	Error     string `json:"error,omitempty"`
	Executed  bool   `json:"executed,omitempty"`
}

func NewTransportResponseMessageDto

func NewTransportResponseMessageDto(tr *Transport) *TransportResponseMessageDto

Jump to

Keyboard shortcuts

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