event

package
v0.19.43 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetricsEventsNs      = "metrics"
	MetricsEventsVersion = 2
)
View Source
const (
	UsageEventsNs      = "fabric.usage"
	UsageEventsVersion = 2
)
View Source
const (
	ServiceEventsNs = "services"
)

Variables

Functions

This section is empty.

Types

type CircuitEvent added in v0.19.28

type CircuitEvent struct {
	Namespace        string           `json:"namespace"`
	Version          uint32           `json:"version"`
	EventType        CircuitEventType `json:"event_type"`
	CircuitId        string           `json:"circuit_id"`
	Timestamp        time.Time        `json:"timestamp"`
	ClientId         string           `json:"client_id"`
	ServiceId        string           `json:"service_id"`
	TerminatorId     string           `json:"terminator_id"`
	InstanceId       string           `json:"instance_id"`
	CreationTimespan *time.Duration   `json:"creation_timespan,omitempty"`
	Path             CircuitPath      `json:"path"`
	LinkCount        int              `json:"link_count"`
	Cost             *uint32          `json:"path_cost,omitempty"`
	FailureCause     *string          `json:"failure_cause,omitempty"`
}

func (*CircuitEvent) String added in v0.19.28

func (event *CircuitEvent) String() string

type CircuitEventHandler added in v0.19.28

type CircuitEventHandler interface {
	AcceptCircuitEvent(event *CircuitEvent)
}

type CircuitEventType added in v0.19.28

type CircuitEventType string
const (
	CircuitEventsNs                       = "fabric.circuits"
	CircuitEventsVersion                  = 2
	CircuitCreated       CircuitEventType = "created"
	CircuitUpdated       CircuitEventType = "pathUpdated"
	CircuitDeleted       CircuitEventType = "deleted"
	CircuitFailed        CircuitEventType = "failed"
)

type CircuitPath added in v0.19.28

type CircuitPath struct {
	Nodes               []string `json:"nodes"`
	Links               []string `json:"links"`
	IngressId           string   `json:"ingress_id"`
	EgressId            string   `json:"egress_id"`
	TerminatorLocalAddr string   `json:"terminator_local_addr"`
}

func (*CircuitPath) String added in v0.19.28

func (self *CircuitPath) String() string

type Dispatcher

type Dispatcher interface {
	RegisterEventType(eventType string, registrationHandler RegistrationHandler)
	RegisterEventHandlerFactory(eventHandlerType string, factory HandlerFactory)

	Dispatch(event Event)

	AddCircuitEventHandler(handler CircuitEventHandler)
	RemoveCircuitEventHandler(handler CircuitEventHandler)

	AddLinkEventHandler(handler LinkEventHandler)
	RemoveLinkEventHandler(handler LinkEventHandler)

	AddMetricsMapper(mapper MetricsMapper)

	AddMetricsEventHandler(handler MetricsEventHandler)
	RemoveMetricsEventHandler(handler MetricsEventHandler)

	AddMetricsMessageHandler(handler MetricsMessageHandler)
	RemoveMetricsMessageHandler(handler MetricsMessageHandler)
	NewFilteredMetricsAdapter(sourceFilter *regexp.Regexp, metricFilter *regexp.Regexp, handler MetricsEventHandler) MetricsMessageHandler

	AddRouterEventHandler(handler RouterEventHandler)
	RemoveRouterEventHandler(handler RouterEventHandler)

	AddServiceEventHandler(handler ServiceEventHandler)
	RemoveServiceEventHandler(handler ServiceEventHandler)

	AddTerminatorEventHandler(handler TerminatorEventHandler)
	RemoveTerminatorEventHandler(handler TerminatorEventHandler)

	AddUsageEventHandler(handler UsageEventHandler)
	RemoveUsageEventHandler(handler UsageEventHandler)

	CircuitEventHandler
	LinkEventHandler
	MetricsEventHandler
	MetricsMessageHandler
	RouterEventHandler
	ServiceEventHandler
	TerminatorEventHandler
	UsageEventHandler
}

The Dispatcher interface manages handlers for a number of events as well as dispatching events to those handlers

type DispatcherMock added in v0.19.28

type DispatcherMock struct{}

func (DispatcherMock) AcceptCircuitEvent added in v0.19.28

func (d DispatcherMock) AcceptCircuitEvent(*CircuitEvent)

func (DispatcherMock) AcceptLinkEvent added in v0.19.28

func (d DispatcherMock) AcceptLinkEvent(*LinkEvent)

func (DispatcherMock) AcceptMetricsEvent added in v0.19.28

func (d DispatcherMock) AcceptMetricsEvent(*MetricsEvent)

func (DispatcherMock) AcceptMetricsMsg added in v0.19.28

func (d DispatcherMock) AcceptMetricsMsg(*metrics_pb.MetricsMessage)

func (DispatcherMock) AcceptRouterEvent added in v0.19.28

func (d DispatcherMock) AcceptRouterEvent(*RouterEvent)

func (DispatcherMock) AcceptServiceEvent added in v0.19.28

func (d DispatcherMock) AcceptServiceEvent(*ServiceEvent)

func (DispatcherMock) AcceptTerminatorEvent added in v0.19.28

func (d DispatcherMock) AcceptTerminatorEvent(*TerminatorEvent)

func (DispatcherMock) AcceptUsageEvent added in v0.19.28

func (d DispatcherMock) AcceptUsageEvent(*UsageEvent)

func (DispatcherMock) AddCircuitEventHandler added in v0.19.28

func (d DispatcherMock) AddCircuitEventHandler(CircuitEventHandler)

func (DispatcherMock) AddLinkEventHandler added in v0.19.28

func (d DispatcherMock) AddLinkEventHandler(LinkEventHandler)

func (DispatcherMock) AddMetricsEventHandler added in v0.19.28

func (d DispatcherMock) AddMetricsEventHandler(MetricsEventHandler)

func (DispatcherMock) AddMetricsMapper added in v0.19.28

func (d DispatcherMock) AddMetricsMapper(MetricsMapper)

func (DispatcherMock) AddMetricsMessageHandler added in v0.19.28

func (d DispatcherMock) AddMetricsMessageHandler(MetricsMessageHandler)

func (DispatcherMock) AddRouterEventHandler added in v0.19.28

func (d DispatcherMock) AddRouterEventHandler(RouterEventHandler)

func (DispatcherMock) AddServiceEventHandler added in v0.19.28

func (d DispatcherMock) AddServiceEventHandler(ServiceEventHandler)

func (DispatcherMock) AddTerminatorEventHandler added in v0.19.28

func (d DispatcherMock) AddTerminatorEventHandler(TerminatorEventHandler)

func (DispatcherMock) AddUsageEventHandler added in v0.19.28

func (d DispatcherMock) AddUsageEventHandler(UsageEventHandler)

func (DispatcherMock) Dispatch added in v0.19.28

func (d DispatcherMock) Dispatch(Event)

func (DispatcherMock) NewFilteredMetricsAdapter added in v0.19.28

func (DispatcherMock) RegisterEventHandlerFactory added in v0.19.28

func (d DispatcherMock) RegisterEventHandlerFactory(string, HandlerFactory)

func (DispatcherMock) RegisterEventType added in v0.19.28

func (d DispatcherMock) RegisterEventType(string, RegistrationHandler)

func (DispatcherMock) RemoveCircuitEventHandler added in v0.19.28

func (d DispatcherMock) RemoveCircuitEventHandler(CircuitEventHandler)

func (DispatcherMock) RemoveLinkEventHandler added in v0.19.28

func (d DispatcherMock) RemoveLinkEventHandler(LinkEventHandler)

func (DispatcherMock) RemoveMetricsEventHandler added in v0.19.28

func (d DispatcherMock) RemoveMetricsEventHandler(MetricsEventHandler)

func (DispatcherMock) RemoveMetricsMessageHandler added in v0.19.28

func (d DispatcherMock) RemoveMetricsMessageHandler(MetricsMessageHandler)

func (DispatcherMock) RemoveRouterEventHandler added in v0.19.28

func (d DispatcherMock) RemoveRouterEventHandler(RouterEventHandler)

func (DispatcherMock) RemoveServiceEventHandler added in v0.19.28

func (d DispatcherMock) RemoveServiceEventHandler(ServiceEventHandler)

func (DispatcherMock) RemoveTerminatorEventHandler added in v0.19.28

func (d DispatcherMock) RemoveTerminatorEventHandler(TerminatorEventHandler)

func (DispatcherMock) RemoveUsageEventHandler added in v0.19.28

func (d DispatcherMock) RemoveUsageEventHandler(UsageEventHandler)

type Event

type Event interface {
	Handle()
}

type HandlerFactory added in v0.19.28

type HandlerFactory interface {
	NewEventHandler(config map[interface{}]interface{}) (interface{}, error)
}

A HandlerFactory knows how to create a given event handler type using the provided configuration map

type LinkConnection added in v0.19.28

type LinkConnection struct {
	Id         string `json:"id"`
	LocalAddr  string `json:"local_addr"`
	RemoteAddr string `json:"remote_addr"`
}

type LinkEvent added in v0.19.28

type LinkEvent struct {
	Namespace   string            `json:"namespace"`
	EventType   LinkEventType     `json:"event_type"`
	Timestamp   time.Time         `json:"timestamp"`
	LinkId      string            `json:"link_id"`
	SrcRouterId string            `json:"src_router_id"`
	DstRouterId string            `json:"dst_router_id"`
	Protocol    string            `json:"protocol"`
	DialAddress string            `json:"dial_address"`
	Cost        int32             `json:"cost"`
	Connections []*LinkConnection `json:"connections,omitempty"`
}

func (*LinkEvent) String added in v0.19.28

func (event *LinkEvent) String() string

type LinkEventHandler added in v0.19.28

type LinkEventHandler interface {
	AcceptLinkEvent(event *LinkEvent)
}

type LinkEventType added in v0.19.28

type LinkEventType string
const (
	LinkEventsNs = "fabric.links"

	LinkDialed                     LinkEventType = "dialed"
	LinkFault                      LinkEventType = "fault"
	LinkConnected                  LinkEventType = "connected"
	LinkFromRouterNew              LinkEventType = "routerLinkNew"
	LinkFromRouterKnown            LinkEventType = "routerLinkKnown"
	LinkFromRouterDisconnectedDest LinkEventType = "routerLinkDisconnectedDest"
)

type MetricsEvent added in v0.19.28

type MetricsEvent struct {
	MetricType     string                 `json:"metric_type" mapstructure:"metric_type"`
	Namespace      string                 `json:"namespace"`
	SourceAppId    string                 `json:"source_id" mapstructure:"source_id"`
	SourceEntityId string                 `json:"source_entity_id,omitempty"  mapstructure:"source_entity_id,omitempty"`
	Version        uint32                 `json:"version"`
	Timestamp      *timestamppb.Timestamp `json:"timestamp"`
	Metric         string                 `json:"metric"`
	Metrics        map[string]interface{} `json:"metrics"`
	Tags           map[string]string      `json:"tags,omitempty"`
	SourceEventId  string                 `json:"source_event_id" mapstructure:"source_event_id"`
}

type MetricsEventHandler added in v0.19.28

type MetricsEventHandler interface {
	AcceptMetricsEvent(event *MetricsEvent)
}

type MetricsEventHandlerF added in v0.19.28

type MetricsEventHandlerF func(event *MetricsEvent)

func (MetricsEventHandlerF) AcceptMetricsEvent added in v0.19.28

func (self MetricsEventHandlerF) AcceptMetricsEvent(event *MetricsEvent)

type MetricsMapper added in v0.19.28

type MetricsMapper func(msg *metrics_pb.MetricsMessage, event *MetricsEvent)

type MetricsMessageHandler added in v0.19.28

type MetricsMessageHandler interface {
	// AcceptMetricsMsg is called when new metrics become available
	AcceptMetricsMsg(message *metrics_pb.MetricsMessage)
}

type MetricsMessageHandlerF added in v0.19.28

type MetricsMessageHandlerF func(msg *metrics_pb.MetricsMessage)

func (MetricsMessageHandlerF) AcceptMetricsMsg added in v0.19.28

func (self MetricsMessageHandlerF) AcceptMetricsMsg(msg *metrics_pb.MetricsMessage)

type RegistrationHandler added in v0.19.28

type RegistrationHandler func(handler interface{}, config map[interface{}]interface{}) error

A RegistrationHandler can take a handler, which may implement multiple event handler interfaces, and configure it using the configuration map provided

type RouterEvent added in v0.19.28

type RouterEvent struct {
	Namespace    string          `json:"namespace"`
	EventType    RouterEventType `json:"event_type"`
	Timestamp    time.Time       `json:"timestamp"`
	RouterId     string          `json:"router_id"`
	RouterOnline bool            `json:"router_online"`
}

func (*RouterEvent) String added in v0.19.28

func (event *RouterEvent) String() string

type RouterEventHandler added in v0.19.28

type RouterEventHandler interface {
	AcceptRouterEvent(event *RouterEvent)
}

type RouterEventType added in v0.19.28

type RouterEventType string
const (
	RouterEventsNs = "fabric.routers"

	RouterOnline  RouterEventType = "router-online"
	RouterOffline RouterEventType = "router-offline"
)

type ServiceEvent added in v0.19.28

type ServiceEvent struct {
	Namespace        string `json:"namespace"`
	Version          uint32 `json:"version"`
	EventType        string `json:"event_type"`
	ServiceId        string `json:"service_id"`
	TerminatorId     string `json:"terminator_id"`
	Count            uint64 `json:"count"`
	IntervalStartUTC int64  `json:"interval_start_utc"`
	IntervalLength   uint64 `json:"interval_length"`
}

func (*ServiceEvent) String added in v0.19.28

func (event *ServiceEvent) String() string

type ServiceEventHandler added in v0.19.28

type ServiceEventHandler interface {
	AcceptServiceEvent(event *ServiceEvent)
}

type TerminatorEvent added in v0.19.28

type TerminatorEvent struct {
	Namespace                 string              `json:"namespace"`
	EventType                 TerminatorEventType `json:"event_type"`
	Timestamp                 time.Time           `json:"timestamp"`
	ServiceId                 string              `json:"service_id"`
	TerminatorId              string              `json:"terminator_id"`
	RouterId                  string              `json:"router_id"`
	RouterOnline              bool                `json:"router_online"`
	Precedence                string              `json:"precedence"`
	StaticCost                uint16              `json:"static_cost"`
	DynamicCost               uint16              `json:"dynamic_cost"`
	TotalTerminators          int                 `json:"total_terminators"`
	UsableDefaultTerminators  int                 `json:"usable_default_terminators"`
	UsableRequiredTerminators int                 `json:"usable_required_terminators"`
}

func (*TerminatorEvent) String added in v0.19.28

func (event *TerminatorEvent) String() string

type TerminatorEventHandler added in v0.19.28

type TerminatorEventHandler interface {
	AcceptTerminatorEvent(event *TerminatorEvent)
}

type TerminatorEventType added in v0.19.28

type TerminatorEventType string
const (
	TerminatorEventsNs = "fabric.terminators"

	TerminatorCreated       TerminatorEventType = "created"
	TerminatorUpdated       TerminatorEventType = "updated"
	TerminatorDeleted       TerminatorEventType = "deleted"
	TerminatorRouterOnline  TerminatorEventType = "router-online"
	TerminatorRouterOffline TerminatorEventType = "router-offline"
)

type UsageEvent added in v0.19.28

type UsageEvent struct {
	Namespace        string `json:"namespace"`
	Version          uint32 `json:"version"`
	EventType        string `json:"event_type"`
	SourceId         string `json:"source_id"`
	CircuitId        string `json:"circuit_id"`
	Usage            uint64 `json:"usage"`
	IntervalStartUTC int64  `json:"interval_start_utc"`
	IntervalLength   uint64 `json:"interval_length"`
}

func (*UsageEvent) String added in v0.19.28

func (event *UsageEvent) String() string

type UsageEventHandler added in v0.19.28

type UsageEventHandler interface {
	AcceptUsageEvent(event *UsageEvent)
}

Jump to

Keyboard shortcuts

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