Documentation
¶
Index ¶
- Constants
- Variables
- type ApiAddress
- type ApiSessionEvent
- type ApiSessionEventHandler
- type ApiSessionEventHandlerWrapper
- type AuthenticationEvent
- type AuthenticationEventHandler
- type AuthenticationEventHandlerWrapper
- type CircuitEvent
- type CircuitEventHandler
- type CircuitEventHandlerWrapper
- type CircuitEventType
- type CircuitPath
- type ClusterEvent
- type ClusterEventHandler
- type ClusterEventHandlerF
- type ClusterEventType
- type ClusterPeer
- type ConnectDestination
- type ConnectEvent
- type ConnectEventHandler
- type ConnectEventHandlerWrapper
- type ConnectSource
- type Dispatcher
- type DispatcherMock
- func (d DispatcherMock) AcceptApiSessionEvent(event *ApiSessionEvent)
- func (d DispatcherMock) AcceptAuthenticationEvent(event *AuthenticationEvent)
- func (d DispatcherMock) AcceptCircuitEvent(*CircuitEvent)
- func (d DispatcherMock) AcceptClusterEvent(*ClusterEvent)
- func (d DispatcherMock) AcceptConnectEvent(event *ConnectEvent)
- func (d DispatcherMock) AcceptEntityChangeEvent(event *EntityChangeEvent)
- func (d DispatcherMock) AcceptLinkEvent(*LinkEvent)
- func (d DispatcherMock) AcceptMetricsEvent(*MetricsEvent)
- func (d DispatcherMock) AcceptMetricsMsg(*metrics_pb.MetricsMessage)
- func (d DispatcherMock) AcceptRouterEvent(*RouterEvent)
- func (d DispatcherMock) AcceptSdkEvent(event *SdkEvent)
- func (d DispatcherMock) AcceptServiceEvent(*ServiceEvent)
- func (d DispatcherMock) AcceptSessionEvent(event *SessionEvent)
- func (d DispatcherMock) AcceptTerminatorEvent(*TerminatorEvent)
- func (d DispatcherMock) AcceptUsageEvent(*UsageEventV2)
- func (d DispatcherMock) AddApiSessionEventHandler(handler ApiSessionEventHandler)
- func (d DispatcherMock) AddAuthenticationEventHandler(handler AuthenticationEventHandler)
- func (d DispatcherMock) AddCircuitEventHandler(CircuitEventHandler)
- func (d DispatcherMock) AddClusterEventHandler(ClusterEventHandler)
- func (d DispatcherMock) AddEntityChangeEventHandler(handler EntityChangeEventHandler)
- func (d DispatcherMock) AddEntityChangeSource(store boltz.Store)
- func (d DispatcherMock) AddEntityCountEventHandler(handler EntityCountEventHandler, interval time.Duration, onlyLeaderEvents bool)
- func (d DispatcherMock) AddGlobalEntityChangeMetadata(k string, v any)
- func (d DispatcherMock) AddLinkEventHandler(LinkEventHandler)
- func (d DispatcherMock) AddMetricsEventHandler(MetricsEventHandler)
- func (d DispatcherMock) AddMetricsMapper(MetricsMapper)
- func (d DispatcherMock) AddMetricsMessageHandler(MetricsMessageHandler)
- func (d DispatcherMock) AddRouterEventHandler(RouterEventHandler)
- func (d DispatcherMock) AddServiceEventHandler(ServiceEventHandler)
- func (d DispatcherMock) AddSessionEventHandler(handler SessionEventHandler)
- func (d DispatcherMock) AddTerminatorEventHandler(TerminatorEventHandler)
- func (d DispatcherMock) AddUsageEventHandler(UsageEventHandler)
- func (d DispatcherMock) GetFormatterFactory(formatterType string) FormatterFactory
- func (d DispatcherMock) NewFilteredMetricsAdapter(*regexp.Regexp, *regexp.Regexp, MetricsEventHandler) MetricsMessageHandler
- func (d DispatcherMock) ProcessSubscriptions(interface{}, []*Subscription) error
- func (d DispatcherMock) RegisterEventHandlerFactory(string, HandlerFactory)
- func (d DispatcherMock) RegisterEventType(string, TypeRegistrar)
- func (d DispatcherMock) RegisterEventTypeFunctions(string, RegistrationHandler, UnregistrationHandler)
- func (d DispatcherMock) RegisterFormatterFactory(string, FormatterFactory)
- func (d DispatcherMock) RemoveAllSubscriptions(interface{})
- func (d DispatcherMock) RemoveApiSessionEventHandler(handler ApiSessionEventHandler)
- func (d DispatcherMock) RemoveAuthenticationEventHandler(handler AuthenticationEventHandler)
- func (d DispatcherMock) RemoveCircuitEventHandler(CircuitEventHandler)
- func (d DispatcherMock) RemoveClusterEventHandler(ClusterEventHandler)
- func (d DispatcherMock) RemoveEntityChangeEventHandler(handler EntityChangeEventHandler)
- func (d DispatcherMock) RemoveEntityCountEventHandler(handler EntityCountEventHandler)
- func (d DispatcherMock) RemoveLinkEventHandler(LinkEventHandler)
- func (d DispatcherMock) RemoveMetricsEventHandler(MetricsEventHandler)
- func (d DispatcherMock) RemoveMetricsMessageHandler(MetricsMessageHandler)
- func (d DispatcherMock) RemoveRouterEventHandler(RouterEventHandler)
- func (d DispatcherMock) RemoveServiceEventHandler(ServiceEventHandler)
- func (d DispatcherMock) RemoveSessionEventHandler(handler SessionEventHandler)
- func (d DispatcherMock) RemoveTerminatorEventHandler(TerminatorEventHandler)
- func (d DispatcherMock) RemoveUsageEventHandler(UsageEventHandler)
- type EntityChangeEvent
- type EntityChangeEventHandler
- type EntityChangeEventHandlerWrapper
- type EntityChangeEventType
- type EntityCountEvent
- type EntityCountEventHandler
- type EntityCountEventHandlerWrapper
- type FormattedEventSink
- type FormatterFactory
- type FormatterFactoryF
- type HandlerFactory
- type LinkConnection
- type LinkEvent
- type LinkEventHandler
- type LinkEventHandlerWrapper
- type LinkEventType
- type MetricsEvent
- type MetricsEventHandler
- type MetricsEventHandlerF
- type MetricsEventHandlerWrapper
- type MetricsMapper
- type MetricsMessageHandler
- type MetricsMessageHandlerF
- type MetricsMessageHandlerWrapper
- type RegistrationHandler
- type RouterEvent
- type RouterEventHandler
- type RouterEventHandlerWrapper
- type RouterEventType
- type SdkEvent
- type SdkEventHandler
- type SdkEventHandlerWrapper
- type SdkEventType
- type ServiceEvent
- type ServiceEventHandler
- type ServiceEventHandlerWrapper
- type SessionEvent
- type SessionEventHandler
- type SessionEventHandlerWrapper
- type Subscription
- type TerminatorEvent
- type TerminatorEventHandler
- type TerminatorEventHandlerWrapper
- type TerminatorEventType
- type TypeRegistrar
- type UnregistrationHandler
- type UsageEventHandler
- type UsageEventHandlerWrapper
- type UsageEventV2
- type UsageEventV3
- type UsageEventV3Handler
- type UsageEventV3HandlerWrapper
Constants ¶
const ( AuthenticationEventNS = "authentication" AuthenticationEventTypeFail = "fail" AuthenticationEventTypeSuccess = "success" )
const ( ConnectEventNS = "connect" ConnectSourceRouter ConnectSource = "router" ConnectSourcePeer ConnectSource = "peer" ConnectSourceIdentity ConnectSource = "identity" ConnectDestinationController ConnectDestination = "ctrl" ConnectDestinationRouter ConnectDestination = "router" )
const ( MetricsEventNS = "metrics" MetricsEventsVersion = 3 )
const ( UsageEventNS = "usage" UsageEventsVersion = 2 )
const ApiSessionEventNS = "apiSession"
const ApiSessionEventTypeCreated = "created"
const ApiSessionEventTypeDeleted = "deleted"
const ApiSessionEventTypeExchanged = "exchanged"
const ApiSessionEventTypeRefreshed = "refreshed"
const ApiSessionTypeJwt = "jwt"
const ApiSessionTypeLegacy = "legacy"
const EntityCountEventNS = "entityCount"
const (
ServiceEventNS = "service"
)
const SessionEventNS = "session"
const SessionEventTypeCreated = "created"
const SessionEventTypeDeleted = "deleted"
const SessionProviderJwt = "jwt"
const SessionProviderLegacy = "legacy"
Variables ¶
var CircuitEventTypes = []CircuitEventType{CircuitCreated, CircuitUpdated, CircuitDeleted, CircuitFailed}
Functions ¶
This section is empty.
Types ¶
type ApiAddress ¶ added in v0.34.2
type ApiAddress struct { // The URL of the API endpoint. Url string `json:"url"` // The version of the API endpoint. Endpoints are versioned independently of // the controller version as these are expected to be stable over long periods. Version string `json:"version"` }
An ApiAddress represents an endpoint on a controller. This may include things like REST management services and health checks.
type ApiSessionEvent ¶
type ApiSessionEvent struct { Namespace string `json:"namespace"` EventSrcId string `json:"event_src_id"` Timestamp time.Time `json:"timestamp"` // The type api session event. See above for valid values. EventType string `json:"event_type"` // Id is the api session id. Id string `json:"id"` // Type is the api session type. See above for valid values. Type string `json:"type"` // The api session token. Token string `json:"token"` // The id of the identity that the api session belongs to. IdentityId string `json:"identity_id"` // The IP address from which the identity to connected to require the api session. IpAddress string `json:"ip_address"` }
An ApiSessionEvent is emitted whenever an api session is created, deleted, refreshed or exchanged. Legacy sessions are only ever created or deleted. JWT sessions are created, refreshed and exchanged.
Note: In version prior to 1.4.0, the namespace was `edge.apiSessions`
Valid api session event types are:
- created
- deleted
- refreshed
- exchanged
Valid api session types are:
- jwt
- legacy
Example: Api Session Created Event
{ "namespace": "apiSession", "event_src_id" : "ctrl1", "timestamp": "2021-11-08T14:45:45.785561479-05:00", "event_type": "created", "id": "ckvr2r4fs0001oigd6si4akc8", "token": "77cffde5-f68e-4ef0-bbb5-731db36145f5", "identity_id": "76BB.shC0", "ip_address": "127.0.0.1" }
func (*ApiSessionEvent) String ¶
func (event *ApiSessionEvent) String() string
type ApiSessionEventHandler ¶
type ApiSessionEventHandler interface {
AcceptApiSessionEvent(event *ApiSessionEvent)
}
type ApiSessionEventHandlerWrapper ¶
type ApiSessionEventHandlerWrapper interface { ApiSessionEventHandler IsWrapping(value ApiSessionEventHandler) bool }
type AuthenticationEvent ¶ added in v1.6.2
type AuthenticationEvent struct { Namespace string `json:"namespace"` EventSrcId string `json:"event_src_id"` Timestamp time.Time `json:"timestamp"` // The type of the authentication event. See above for valid values. EventType string `json:"event_type"` // method is the authentication method type. See above for valid values. Method string `json:"type"` // The id of the authenticator associated with the authentication attempt, may be empty (e.g. for etx-jwt) AuthenticatorId string `json:"authenticator_id"` // ExternalJwtSignerId is the external jwt signer id triggered, may be empty (e.g. for cert) ExternalJwtSignerId string `json:"external_jwt_signer_id"` // The id of the identity that the authentication is attempted for, may be blank of no identity is resolved IdentityId string `json:"identity_id"` // The id of the authentication policy which allowed access, may be blank if no auth policy is resolved (e.g. identity is also blank) AuthPolicyId string `json:"auth_policy_id"` // The remote address from which the authentication request was issues RemoteAddress string `json:"remote_address"` // Success is true if the Authentication and associated authentication policies provide access, false otherwise Success bool `json:"success"` // FailureReason contains the reason the Authentication failed FailureReason string `json:"reason"` // ImproperClientCertChain is false for all authentication methods other than cert. When true, it indicates // a network issued certificate was used during authentication and its chain was not provided or did not map // to the network root CA. This indicates enrollment with an older controller or SDK that did not send/save // the proper chain. ImproperClientCertChain bool `json:"improper_client_cert_chain"` }
An AuthenticationEvent is emitted when an authentication attempt is made
Types of authentication events
- fail - authentication failed
- success - authentication succeeded
Types of authentication methods
- updb - username password from the internal database
- cert - a certificate, either first party or 3rd party
- ext-jwt - an external JWT from an IDP
Example: Authentication Failed Event
{ "namespace": "authentication", "event_src_id": "ctrl1", "timestamp": "2025-05-12T14:30:00Z", "event_type": "failed", "type": "updb", "authenticator_id": "auth01", "external_jwt_signer_id": "", "identity_id": "id42", "auth_policy_id": "pol7", "ip_address": "192.0.2.10", "success": false, "reason": "invalid password", "improper_client_cert_chain": "false" }
func (*AuthenticationEvent) String ¶ added in v1.6.2
func (event *AuthenticationEvent) String() string
type AuthenticationEventHandler ¶ added in v1.6.2
type AuthenticationEventHandler interface {
AcceptAuthenticationEvent(event *AuthenticationEvent)
}
type AuthenticationEventHandlerWrapper ¶ added in v1.6.2
type AuthenticationEventHandlerWrapper interface { AuthenticationEventHandler IsWrapping(value AuthenticationEventHandler) bool }
type CircuitEvent ¶
type CircuitEvent struct { Namespace string `json:"namespace"` EventSrcId string `json:"event_src_id"` Timestamp time.Time `json:"timestamp"` // The event format version. The most recent version is 2. Version uint32 `json:"version"` // The circuit event type. See above for valid circuit event types. EventType CircuitEventType `json:"event_type"` // The circuit id. CircuitId string `json:"circuit_id"` // Who the circuit was created for. Usually an edge session id. ClientId string `json:"client_id"` // The id of the circuit's service. ServiceId string `json:"service_id"` // The terminator the circuit is using. TerminatorId string `json:"terminator_id"` // The instance id of the terminator. InstanceId string `json:"instance_id"` // How long it took to create the circuit. CreationTimespan *time.Duration `json:"creation_timespan,omitempty"` // The circuit's path. Path CircuitPath `json:"path"` // How many links the circuit is using. LinkCount int `json:"link_count"` // The circuit's cost at the time of creation or update. Cost *uint32 `json:"path_cost,omitempty"` // The reason the circuit failed. Only populated for circuit failures. FailureCause *string `json:"failure_cause,omitempty"` // How long the circuit has been up. Not populated for circuit creates. Duration *time.Duration `json:"duration,omitempty"` // Contains circuit enrichment data. May contain information like the client and/or host // identity ids. Tags map[string]string `json:"tags"` }
A CircuitEvent is emitted for various stages of a circuit lifecycle.
Note: In version prior to 1.4.0, the namespace was `fabric.circuits`
Valid circuit event types are:
- created
- pathUpdated
- deleted
- failed
Example: Circuit Created Event
{ "namespace": "circuit", "event_src_id": "ctrl_client", "timestamp": "2025-01-17T14:09:13.603009739-05:00", "version": 2, "event_type": "created", "circuit_id": "rqrucElFe", "client_id": "cm614ve9h00fb1xj9dfww20le", "service_id": "3pjMOKY2icS8fkQ1lfHmrP", "terminator_id": "7JgrjMgEAis7V5q1wjvoB4", "instance_id": "", "creation_timespan": 1035941, "path": { "nodes": [ "5g2QrZxFcw" ], "links": null, "ingress_id": "8dN7", "egress_id": "ZnXG" }, "link_count": 0, "path_cost": 262140, "tags": { "clientId": "haxn9lB0uc", "hostId": "IahyE.5Scw", "serviceId": "3pjMOKY2icS8fkQ1lfHmrP" } }
Example: Circuit Deleted Event
{ "namespace": "circuit", "event_src_id": "ctrl_client", "timestamp": "2025-01-17T14:09:15.138049308-05:00", "version": 2, "event_type": "deleted", "circuit_id": "rqrucElFe", "client_id": "cm614ve9h00fb1xj9dfww20le", "service_id": "3pjMOKY2icS8fkQ1lfHmrP", "terminator_id": "7JgrjMgEAis7V5q1wjvoB4", "instance_id": "", "path": { "nodes": [ "5g2QrZxFcw" ], "links": null, "ingress_id": "8dN7", "egress_id": "ZnXG" }, "link_count": 0, "duration": 1535040544, "tags": { "clientId": "haxn9lB0uc", "hostId": "IahyE.5Scw", "serviceId": "3pjMOKY2icS8fkQ1lfHmrP" } }
Example: Circuit Failed Event
{ "namespace": "circuit", "event_src_id": "ctrl_client", "timestamp": "2025-01-17T14:09:30.563045771-05:00", "version": 2, "event_type": "failed", "circuit_id": "JvIucEQHe", "client_id": "cm614vrcd00fu1xj931hzepec", "service_id": "3pjMOKY2icS8fkQ1lfHmrP", "terminator_id": "", "instance_id": "", "creation_timespan": 20701, "path": { "nodes": null, "links": null, "ingress_id": "", "egress_id": "" }, "link_count": 0, "failure_cause": "NO_TERMINATORS", "tags": { "clientId": "haxn9lB0uc", "serviceId": "3pjMOKY2icS8fkQ1lfHmrP" } }
func (*CircuitEvent) String ¶
func (event *CircuitEvent) String() string
type CircuitEventHandler ¶
type CircuitEventHandler interface {
AcceptCircuitEvent(event *CircuitEvent)
}
type CircuitEventHandlerWrapper ¶
type CircuitEventHandlerWrapper interface { CircuitEventHandler IsWrapping(value CircuitEventHandler) bool }
type CircuitEventType ¶
type CircuitEventType string
const ( CircuitEventNS = "circuit" CircuitEventsVersion = 2 CircuitCreated CircuitEventType = "created" CircuitUpdated CircuitEventType = "pathUpdated" CircuitDeleted CircuitEventType = "deleted" CircuitFailed CircuitEventType = "failed" )
type CircuitPath ¶
type CircuitPath struct { // The routers traversed in the path, going from initiating router to terminating router. Nodes []string `json:"nodes"` // The links traversed in the path, going from initiating router to terminating router. // If the initiating and terminating routers are the same, this will be empty. Links []string `json:"links"` // The xgress identifier used on the initiating router. IngressId string `json:"ingress_id"` // The xgress identifier used on the terminating router. EgressId string `json:"egress_id"` // The local address of the connection to the first ziti component. InitiatorLocalAddr string `json:"initiator_local_addr,omitempty"` // The remote address of the connection to the first ziti component. InitiatorRemoteAddr string `json:"initiator_remote_addr,omitempty"` // The local address on the terminating ziti component. TerminatorLocalAddr string `json:"terminator_local_addr,omitempty"` // The remote address on the terminating ziti component. TerminatorRemoteAddr string `json:"terminator_remote_addr,omitempty"` }
A CircuitPath encapsulates information about the circuit's path.
func (*CircuitPath) String ¶
func (self *CircuitPath) String() string
type ClusterEvent ¶
type ClusterEvent struct { Namespace string `json:"namespace"` EventSrcId string `json:"event_src_id"` Timestamp time.Time `json:"timestamp"` // The cluster event type. See above for set of valid types. EventType ClusterEventType `json:"eventType"` // The raft index associated with the event. Index uint64 `json:"index,omitempty"` // This field is populated with all peers when membership change events // or leadership is gained. It is populated with the connecting peer for connect events and the // disconnecting peer for disconnect events. For other types it is omitted. Peers []*ClusterPeer `json:"peers,omitempty"` // The leader id. Only populated for state.has_leader events. LeaderId string `json:"leaderId,omitempty"` }
A ClusterEvent marks a change to the controller HA cluster. ClusterEvents can be of the following types:
- peer.connected - a peer connected
- peer.disconnected - a peer disconnected
- peer.not_member - a peer connected, but was not a member and didn't join the cluster
- members.changed - A peer was added to or removed from the cluster
- leadership.gained - The node become the cluster leader
- leadership.lost - The node lost cluster leadership
- state.has_leader - The cluster gained a leader
- state.is_leaderless - The cluster became leaderless
- state.ro - The cluster is not accepting state changes, likely due to version mismatches in cluster members
- state.rw - The cluster is accepting state changes
Example: Cluster Members Changed Event
{ "namespace": "cluster", "event_src_id": "ctrl1", "timestamp": "2025-01-17T13:41:25.817205826-05:00", "eventType": "members.changed", "index": 7, "peers": [ { "id": "ctrl1", "addr": "tls:localhost:6262", "apiAddresses": null }, { "id": "ctrl2", "addr": "tls:localhost:6363", "apiAddresses": null } ] }
Example: Peer Connected Event
{ "namespace": "cluster", "event_src_id": "ctrl1", "timestamp": "2025-01-17T13:41:25.838625953-05:00", "eventType": "peer.connected", "peers": [ { "id": "ctrl2", "addr": "tls:localhost:6363", "version": "v0.0.0", "apiAddresses": { "edge-client": [ { "url": "https://127.0.0.1:1380/edge/client/v1", "version": "v1" } ], "edge-management": [ { "url": "https://127.0.0.1:1380/edge/management/v1", "version": "v1" } ], "edge-oidc": [ { "url": "https://127.0.0.1:1380/oidc", "version": "v1" } ], "fabric": [ { "url": "https://127.0.0.1:1380/fabric/v1", "version": "v1" } ], "health-checks": [ { "url": "https://127.0.0.1:1380/health-checks", "version": "v1" } ] } } ] }
func NewClusterEvent ¶
func NewClusterEvent(eventType ClusterEventType) *ClusterEvent
func (*ClusterEvent) String ¶
func (event *ClusterEvent) String() string
type ClusterEventHandler ¶
type ClusterEventHandler interface {
AcceptClusterEvent(event *ClusterEvent)
}
type ClusterEventHandlerF ¶
type ClusterEventHandlerF func(event *ClusterEvent)
func (ClusterEventHandlerF) AcceptClusterEvent ¶
func (f ClusterEventHandlerF) AcceptClusterEvent(event *ClusterEvent)
type ClusterEventType ¶
type ClusterEventType string
const ( ClusterEventNS = "cluster" ClusterPeerConnected ClusterEventType = "peer.connected" ClusterPeerDisconnected ClusterEventType = "peer.disconnected" ClusterMembersChanged ClusterEventType = "members.changed" ClusterLeadershipGained ClusterEventType = "leadership.gained" ClusterLeadershipLost ClusterEventType = "leadership.lost" ClusterHasLeader ClusterEventType = "state.has_leader" ClusterIsLeaderless ClusterEventType = "state.is_leaderless" ClusterStateReadOnly ClusterEventType = "state.ro" ClusterStateReadWrite ClusterEventType = "state.rw" ClusterPeerNotMember ClusterEventType = "peer.not_member" )
type ClusterPeer ¶
type ClusterPeer struct { // The controller id. Id string `json:"id,omitempty"` // The address at which the controller can be reached. Addr string `json:"addr,omitempty"` // The version of the controller. Version string `json:"version,omitempty"` ServerCert []*x509.Certificate `json:"-"` // The set of api addresses presented by the controller. ApiAddresses map[string][]ApiAddress `json:"apiAddresses"` }
A ClusterPeer represents a controller which is a member of the cluster.
func (*ClusterPeer) String ¶
func (self *ClusterPeer) String() string
type ConnectDestination ¶ added in v1.2.0
type ConnectDestination string
type ConnectEvent ¶ added in v1.2.0
type ConnectEvent struct { Namespace string `json:"namespace"` EventSrcId string `json:"event_src_id"` Timestamp time.Time `json:"timestamp"` // The type of software initiating the connection. SrcType ConnectSource `json:"src_type"` // The type of software receiving the connection. DstType ConnectDestination `json:"dst_type"` // The id of the initiating component. SrcId string `json:"src_id"` // The source address of the connection. SrcAddr string `json:"src_addr"` // The id of the receiving component. DstId string `json:"dst_id"` // The destination address of the connection. DstAddr string `json:"dst_addr"` }
A ConnectEvent is emitted when a connection is made to a ziti controller or router.
Valid source types are:
- router - router connecting to a controller or another router)
- peer - controller connecting to another controller
- identity - identity connecting to a router or controller
Valid destination types are:
- ctrl - connection is being made to a controller
- router - connection is being made to a router
Example: Identity Connected to Controller Event
{ "namespace": "connect", "event_src_id": "ctrl_client", "timestamp": "2024-10-02T12:17:39.501821249-04:00" "src_type": "identity", "src_id": "ji2Rt8KJ4", "src_addr": "127.0.0.1:59336", "dst_id": "ctrl_client", "dst_addr": "localhost:1280/edge/management/v1/edge-routers/2L7NeVuGBU", }
Example: Router Connected to Controller Event
{ "namespace": "connect", "event_src_id": "ctrl_client", "timestamp": "2024-10-02T12:17:40.529865849-04:00" "src_type": "router", "src_id": "2L7NeVuGBU", "src_addr": "127.0.0.1:42702", "dst_id": "ctrl_client", "dst_addr": "127.0.0.1:6262", }
Example: Controller Connected to Controller Event
{ "namespace": "connect", "event_src_id": "ctrl1", "timestamp": "2024-10-02T12:37:04.490859197-04:00" "src_type": "peer", "src_id": "ctrl2", "src_addr": "127.0.0.1:40056", "dst_id": "ctrl1", "dst_addr": "127.0.0.1:6262", }
type ConnectEventHandler ¶ added in v1.2.0
type ConnectEventHandler interface {
AcceptConnectEvent(event *ConnectEvent)
}
type ConnectEventHandlerWrapper ¶ added in v1.2.0
type ConnectEventHandlerWrapper interface { ConnectEventHandler IsWrapping(value ConnectEventHandler) bool }
type ConnectSource ¶ added in v1.2.0
type ConnectSource string
type Dispatcher ¶
type Dispatcher interface { RegisterEventType(eventType string, registrar TypeRegistrar) RegisterEventTypeFunctions(eventType string, registrationHandler RegistrationHandler, unregistrationHandler UnregistrationHandler) RegisterEventHandlerFactory(eventHandlerType string, factory HandlerFactory) RegisterFormatterFactory(formatterType string, factory FormatterFactory) GetFormatterFactory(formatterType string) FormatterFactory ProcessSubscriptions(handler interface{}, subscriptions []*Subscription) error RemoveAllSubscriptions(handler interface{}) 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) AddClusterEventHandler(handler ClusterEventHandler) RemoveClusterEventHandler(handler ClusterEventHandler) AddEntityChangeEventHandler(handler EntityChangeEventHandler) RemoveEntityChangeEventHandler(handler EntityChangeEventHandler) AddEntityChangeSource(store boltz.Store) AddGlobalEntityChangeMetadata(k string, v any) AddApiSessionEventHandler(handler ApiSessionEventHandler) RemoveApiSessionEventHandler(handler ApiSessionEventHandler) AddSessionEventHandler(handler SessionEventHandler) RemoveSessionEventHandler(handler SessionEventHandler) AddAuthenticationEventHandler(handler AuthenticationEventHandler) RemoveAuthenticationEventHandler(handler AuthenticationEventHandler) AddEntityCountEventHandler(handler EntityCountEventHandler, interval time.Duration, onlyLeaderEvents bool) RemoveEntityCountEventHandler(handler EntityCountEventHandler) ApiSessionEventHandler AuthenticationEventHandler CircuitEventHandler ConnectEventHandler ClusterEventHandler EntityChangeEventHandler LinkEventHandler MetricsEventHandler MetricsMessageHandler RouterEventHandler SdkEventHandler SessionEventHandler ServiceEventHandler TerminatorEventHandler UsageEventHandler }
The Dispatcher interface manages handlers for a number of events as well as dispatching events to those handlers
type DispatcherMock ¶
type DispatcherMock struct{}
func (DispatcherMock) AcceptApiSessionEvent ¶ added in v1.1.14
func (d DispatcherMock) AcceptApiSessionEvent(event *ApiSessionEvent)
func (DispatcherMock) AcceptAuthenticationEvent ¶ added in v1.6.2
func (d DispatcherMock) AcceptAuthenticationEvent(event *AuthenticationEvent)
func (DispatcherMock) AcceptCircuitEvent ¶
func (d DispatcherMock) AcceptCircuitEvent(*CircuitEvent)
func (DispatcherMock) AcceptClusterEvent ¶
func (d DispatcherMock) AcceptClusterEvent(*ClusterEvent)
func (DispatcherMock) AcceptConnectEvent ¶ added in v1.2.0
func (d DispatcherMock) AcceptConnectEvent(event *ConnectEvent)
func (DispatcherMock) AcceptEntityChangeEvent ¶
func (d DispatcherMock) AcceptEntityChangeEvent(event *EntityChangeEvent)
func (DispatcherMock) AcceptLinkEvent ¶
func (d DispatcherMock) AcceptLinkEvent(*LinkEvent)
func (DispatcherMock) AcceptMetricsEvent ¶
func (d DispatcherMock) AcceptMetricsEvent(*MetricsEvent)
func (DispatcherMock) AcceptMetricsMsg ¶
func (d DispatcherMock) AcceptMetricsMsg(*metrics_pb.MetricsMessage)
func (DispatcherMock) AcceptRouterEvent ¶
func (d DispatcherMock) AcceptRouterEvent(*RouterEvent)
func (DispatcherMock) AcceptSdkEvent ¶ added in v1.2.0
func (d DispatcherMock) AcceptSdkEvent(event *SdkEvent)
func (DispatcherMock) AcceptServiceEvent ¶
func (d DispatcherMock) AcceptServiceEvent(*ServiceEvent)
func (DispatcherMock) AcceptSessionEvent ¶ added in v1.6.8
func (d DispatcherMock) AcceptSessionEvent(event *SessionEvent)
func (DispatcherMock) AcceptTerminatorEvent ¶
func (d DispatcherMock) AcceptTerminatorEvent(*TerminatorEvent)
func (DispatcherMock) AcceptUsageEvent ¶
func (d DispatcherMock) AcceptUsageEvent(*UsageEventV2)
func (DispatcherMock) AddApiSessionEventHandler ¶
func (d DispatcherMock) AddApiSessionEventHandler(handler ApiSessionEventHandler)
func (DispatcherMock) AddAuthenticationEventHandler ¶ added in v1.6.2
func (d DispatcherMock) AddAuthenticationEventHandler(handler AuthenticationEventHandler)
func (DispatcherMock) AddCircuitEventHandler ¶
func (d DispatcherMock) AddCircuitEventHandler(CircuitEventHandler)
func (DispatcherMock) AddClusterEventHandler ¶
func (d DispatcherMock) AddClusterEventHandler(ClusterEventHandler)
func (DispatcherMock) AddEntityChangeEventHandler ¶
func (d DispatcherMock) AddEntityChangeEventHandler(handler EntityChangeEventHandler)
func (DispatcherMock) AddEntityChangeSource ¶
func (d DispatcherMock) AddEntityChangeSource(store boltz.Store)
func (DispatcherMock) AddEntityCountEventHandler ¶
func (d DispatcherMock) AddEntityCountEventHandler(handler EntityCountEventHandler, interval time.Duration, onlyLeaderEvents bool)
func (DispatcherMock) AddGlobalEntityChangeMetadata ¶
func (d DispatcherMock) AddGlobalEntityChangeMetadata(k string, v any)
func (DispatcherMock) AddLinkEventHandler ¶
func (d DispatcherMock) AddLinkEventHandler(LinkEventHandler)
func (DispatcherMock) AddMetricsEventHandler ¶
func (d DispatcherMock) AddMetricsEventHandler(MetricsEventHandler)
func (DispatcherMock) AddMetricsMapper ¶
func (d DispatcherMock) AddMetricsMapper(MetricsMapper)
func (DispatcherMock) AddMetricsMessageHandler ¶
func (d DispatcherMock) AddMetricsMessageHandler(MetricsMessageHandler)
func (DispatcherMock) AddRouterEventHandler ¶
func (d DispatcherMock) AddRouterEventHandler(RouterEventHandler)
func (DispatcherMock) AddServiceEventHandler ¶
func (d DispatcherMock) AddServiceEventHandler(ServiceEventHandler)
func (DispatcherMock) AddSessionEventHandler ¶
func (d DispatcherMock) AddSessionEventHandler(handler SessionEventHandler)
func (DispatcherMock) AddTerminatorEventHandler ¶
func (d DispatcherMock) AddTerminatorEventHandler(TerminatorEventHandler)
func (DispatcherMock) AddUsageEventHandler ¶
func (d DispatcherMock) AddUsageEventHandler(UsageEventHandler)
func (DispatcherMock) GetFormatterFactory ¶
func (d DispatcherMock) GetFormatterFactory(formatterType string) FormatterFactory
func (DispatcherMock) NewFilteredMetricsAdapter ¶
func (d DispatcherMock) NewFilteredMetricsAdapter(*regexp.Regexp, *regexp.Regexp, MetricsEventHandler) MetricsMessageHandler
func (DispatcherMock) ProcessSubscriptions ¶
func (d DispatcherMock) ProcessSubscriptions(interface{}, []*Subscription) error
func (DispatcherMock) RegisterEventHandlerFactory ¶
func (d DispatcherMock) RegisterEventHandlerFactory(string, HandlerFactory)
func (DispatcherMock) RegisterEventType ¶
func (d DispatcherMock) RegisterEventType(string, TypeRegistrar)
func (DispatcherMock) RegisterEventTypeFunctions ¶
func (d DispatcherMock) RegisterEventTypeFunctions(string, RegistrationHandler, UnregistrationHandler)
func (DispatcherMock) RegisterFormatterFactory ¶
func (d DispatcherMock) RegisterFormatterFactory(string, FormatterFactory)
func (DispatcherMock) RemoveAllSubscriptions ¶
func (d DispatcherMock) RemoveAllSubscriptions(interface{})
func (DispatcherMock) RemoveApiSessionEventHandler ¶
func (d DispatcherMock) RemoveApiSessionEventHandler(handler ApiSessionEventHandler)
func (DispatcherMock) RemoveAuthenticationEventHandler ¶ added in v1.6.2
func (d DispatcherMock) RemoveAuthenticationEventHandler(handler AuthenticationEventHandler)
func (DispatcherMock) RemoveCircuitEventHandler ¶
func (d DispatcherMock) RemoveCircuitEventHandler(CircuitEventHandler)
func (DispatcherMock) RemoveClusterEventHandler ¶
func (d DispatcherMock) RemoveClusterEventHandler(ClusterEventHandler)
func (DispatcherMock) RemoveEntityChangeEventHandler ¶
func (d DispatcherMock) RemoveEntityChangeEventHandler(handler EntityChangeEventHandler)
func (DispatcherMock) RemoveEntityCountEventHandler ¶
func (d DispatcherMock) RemoveEntityCountEventHandler(handler EntityCountEventHandler)
func (DispatcherMock) RemoveLinkEventHandler ¶
func (d DispatcherMock) RemoveLinkEventHandler(LinkEventHandler)
func (DispatcherMock) RemoveMetricsEventHandler ¶
func (d DispatcherMock) RemoveMetricsEventHandler(MetricsEventHandler)
func (DispatcherMock) RemoveMetricsMessageHandler ¶
func (d DispatcherMock) RemoveMetricsMessageHandler(MetricsMessageHandler)
func (DispatcherMock) RemoveRouterEventHandler ¶
func (d DispatcherMock) RemoveRouterEventHandler(RouterEventHandler)
func (DispatcherMock) RemoveServiceEventHandler ¶
func (d DispatcherMock) RemoveServiceEventHandler(ServiceEventHandler)
func (DispatcherMock) RemoveSessionEventHandler ¶
func (d DispatcherMock) RemoveSessionEventHandler(handler SessionEventHandler)
func (DispatcherMock) RemoveTerminatorEventHandler ¶
func (d DispatcherMock) RemoveTerminatorEventHandler(TerminatorEventHandler)
func (DispatcherMock) RemoveUsageEventHandler ¶
func (d DispatcherMock) RemoveUsageEventHandler(UsageEventHandler)
type EntityChangeEvent ¶
type EntityChangeEvent struct { Namespace string `json:"namespace"` EventSrcId string `json:"event_src_id"` Timestamp time.Time `json:"timestamp"` // An identifier shared by all changes in a given transaction. EventId string `json:"eventId"` // The entity change event type. See above for valid values. EventType EntityChangeEventType `json:"eventType"` // Metadata will include information about who initiated the change and how. Metadata map[string]any `json:"metadata,omitempty"` // The type of the entity being changed. EntityType string `json:"entityType,omitempty"` // True if the entity type has a parent type (like services and routers), and // this event only contains the parent data. IsParentEvent *bool `json:"isParentEvent,omitempty"` // The state before the change. Will be empty for creates. InitialState any `json:"initialState,omitempty"` // The state after the change. Will be empty for deletes. FinalState any `json:"finalState,omitempty"` PropagateIndicator bool `json:"-"` IsRecoveryEvent bool `json:"-"` }
An EntityChangeEvent is emitted when a entity in the data model changes.
Valid entity change event types are:
- created
- updated
- deleted
- committed
Entity change events happen in two parts. First the created,updated or deleted event is emitted. This happens inside a transaction. After the transaction is committed, a committed event with the same event id is generated. This lets the event consumer know that the event is finalized. All changes within a transaction will share the same event id. If a new event id is seen before the previous event is committed, that indicates that the transaction was rolled back.
Example: Service Created Event
{ "namespace": "entityChange", "event_src_id": "ctrl1", "timestamp": "2023-05-11T21:41:47.128588927-04:00", "eventId": "326faf6c-8123-42ae-9ed8-6fd9560eb567", "eventType": "created", "metadata": { "author": { "type": "identity", "id": "ji2Rt8KJ4", "name": "Default Admin" }, "source": { "type": "rest", "auth": "edge", "localAddr": "localhost:1280", "remoteAddr": "127.0.0.1:37578", "method": "POST" }, "version": "v0.0.0" }, "entityType": "services", "isParentEvent": false, "initialState": null, "finalState": { "id": "6S0bCGWb6yrAutXwSQaLiv", "createdAt": "2023-05-12T01:41:47.128138887Z", "updatedAt": "2023-05-12T01:41:47.128138887Z", "tags": {}, "isSystem": false, "name": "test", "terminatorStrategy": "smartrouting", "roleAttributes": [ "goodbye", "hello" ], "configs": null, "encryptionRequired": true } }
Example: Change Committed Event
{ "namespace": "entityChange", "event_src_id": "ctrl1", "timestamp": "2023-05-11T21:41:47.129235443-04:00" "eventId": "326faf6c-8123-42ae-9ed8-6fd9560eb567", "eventType": "committed", }
type EntityChangeEventHandler ¶
type EntityChangeEventHandler interface {
AcceptEntityChangeEvent(event *EntityChangeEvent)
}
type EntityChangeEventHandlerWrapper ¶
type EntityChangeEventHandlerWrapper interface { EntityChangeEventHandler IsWrapping(value EntityChangeEventHandler) bool }
type EntityChangeEventType ¶
type EntityChangeEventType string
const ( EntityChangeEventNS = "entityChange" EntityChangeTypeEntityCreated EntityChangeEventType = "created" EntityChangeTypeEntityUpdated EntityChangeEventType = "updated" EntityChangeTypeEntityDeleted EntityChangeEventType = "deleted" EntityChangeTypeCommitted EntityChangeEventType = "committed" )
type EntityCountEvent ¶
type EntityCountEvent struct { Namespace string `json:"namespace"` EventSrcId string `json:"event_src_id"` Timestamp time.Time `json:"timestamp"` // Map of entity type to the number of entities of that type that currently exist in the data model. Counts map[string]int64 `json:"counts"` // If an error is encountered while collecting entity counts, // it will be reported here. Error string `json:"error,omitempty"` }
A EntityCountEvent is emitted on a configurable interval. It contains the entity counts for all the entity types in the data model.
Note: In version prior to 1.4.0, the namespace was `edge.entityCounts`
Example: Entity Count Event
{ "namespace": "entityCount", "event_src_id": "ctrl_client", "timestamp": "2025-01-16T20:34:47.281325752-05:00", "counts": { "apiSessionCertificates": 0, "apiSessions": 1, "authPolicies": 1, "authenticators": 5, "cas": 0, "configTypes": 6, "configs": 4, "controllers": 0, "edgeRouterPolicies": 7, "enrollments": 11, "eventualEvents": 0, "externalJwtSigners": 0, "identities": 16, "identityTypes": 2, "mfas": 0, "postureCheckTypes": 5, "postureChecks": 0, "revocations": 0, "routers": 7, "routers.edge": 7, "serviceEdgeRouterPolicies": 1, "servicePolicies": 4, "services": 2, "services.edge": 2, "sessions": 0, "terminators": 0 }, "error": "" }
func (*EntityCountEvent) String ¶
func (event *EntityCountEvent) String() string
type EntityCountEventHandler ¶
type EntityCountEventHandler interface {
AcceptEntityCountEvent(event *EntityCountEvent)
}
type EntityCountEventHandlerWrapper ¶ added in v1.4.0
type EntityCountEventHandlerWrapper interface { EntityCountEventHandler IsWrapping(value EntityCountEventHandler) bool }
type FormattedEventSink ¶
A FormattedEventSink accepts formatted events, i.e. events that have been turned into string or binary representations
type FormatterFactory ¶
type FormatterFactory interface {
NewFormatter(sink FormattedEventSink) io.Closer
}
A FormatterFactory returns a formatter which will send events to the given FormattedEventSink
type FormatterFactoryF ¶
type FormatterFactoryF func(sink FormattedEventSink) io.Closer
FormatterFactoryF is a function version of FormatterFactory
func (FormatterFactoryF) NewFormatter ¶
func (self FormatterFactoryF) NewFormatter(sink FormattedEventSink) io.Closer
type HandlerFactory ¶
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 ¶
type LinkConnection struct { // The connection identifier. Id string `json:"id"` // The connection address on dialing router side. LocalAddr string `json:"local_addr"` // The connection address on accepting router side. RemoteAddr string `json:"remote_addr"` }
A LinkConnection describes a physical connection that forms a link. A Link may be made up of multiple LinkConnections.
Link ids currently have three valid values:
- single - meaning the link has a single connection
- payload - a connection used only for payloads
- ack - a connection used only for acks
type LinkEvent ¶
type LinkEvent struct { Namespace string `json:"namespace"` EventSrcId string `json:"event_src_id"` Timestamp time.Time `json:"timestamp"` // The link event type. See above for valid values. EventType LinkEventType `json:"event_type"` // The link identifier. LinkId string `json:"link_id"` // The id of the dialing router. SrcRouterId string `json:"src_router_id,omitempty"` // The id of the accepting router. DstRouterId string `json:"dst_router_id,omitempty"` // The link protocol. Protocol string `json:"protocol,omitempty"` // The address dialed. DialAddress string `json:"dial_address,omitempty"` // The link cost. Cost int32 `json:"cost,omitempty"` // The connections making up the link. Connections []*LinkConnection `json:"connections,omitempty"` }
A LinkEvent will be emitted for various link lifecycle events.
Note: In version prior to 1.4.0, the namespace was `fabric.links`
Valid values for link event types are:
- routerLinkNew - A router established a new link, or is syncing the controller with link information after a restart/reconnect.
- fault - a link has closed due to a link fault
- duplicate - a link was removed because it was a duplicate. Happens when routers dial each other at the same time.
- routerLinkKnown - A router informed the controller of a link, but the controller already knew about it.
- routerLinkDisconnectedDest - A router created a link, but the destination router isn't currently connected to the controller.
- dialed - Deprecated. Happens when a link listener has been dialed. Only relevant if using legacy controller managed links.
- connected - Deprecated. Happens when a link is connected. Only generated when using legacy controller managed links.
Example: Router Link New Event
{ "namespace": "fabric.links", "event_src_id": "ctrl_client", "timestamp": "2025-01-23T16:19:26.879417243-05:00", "event_type": "routerLinkNew", "link_id": "2Wea35TgSfWbh3P1wmEyLd", "src_router_id": "5g2QrZxFcw", "dst_router_id": "E0IAgBVdmn", "protocol": "dtls", "dial_address": "dtls:127.0.0.1:4024", "cost": 1 }
Example: Link Faulted Event
{ "namespace": "link", "event_src_id": "ctrl1", "timestamp": "2022-07-15T18:10:19.973867809-04:00", "event_type": "fault", "link_id": "6slUYCqOB85YTfdiD8I5pl", "src_router_id": "YPpTEd8JP", "dst_router_id": "niY.XmLArx", "protocol": "tls", "dial_address": "tls:127.0.0.1:4023", "cost": 1 }
Example: Router Link Known Event
{ "namespace": "link", "event_src_id": "ctrl1", "timestamp": "2022-07-15T18:10:19.974177638-04:00", "event_type": "routerLinkKnown", "link_id": "47kGIApCXI29VQoCA1xXWI", "src_router_id": "niY.XmLArx", "dst_router_id": "YPpTEd8JP", "protocol": "tls", "dial_address": "tls:127.0.0.1:4024", "cost": 1 }
type LinkEventHandler ¶
type LinkEventHandler interface {
AcceptLinkEvent(event *LinkEvent)
}
type LinkEventHandlerWrapper ¶ added in v1.4.0
type LinkEventHandlerWrapper interface { LinkEventHandler IsWrapping(value LinkEventHandler) bool }
type LinkEventType ¶
type LinkEventType string
const ( LinkEventNS = "link" LinkFault LinkEventType = "fault" LinkDuplicate LinkEventType = "duplicate" LinkFromRouterNew LinkEventType = "routerLinkNew" LinkFromRouterKnown LinkEventType = "routerLinkKnown" LinkFromRouterDisconnectedDest LinkEventType = "routerLinkDisconnectedDest" LinkConnectionsChanged LinkEventType = "connectionsChanged" // LinkDialed is only used when legacy controller link management is enabled LinkDialed LinkEventType = "dialed" // LinkConnected is only used when legacy controller link management is enabled LinkConnected LinkEventType = "connected" )
type MetricsEvent ¶
type MetricsEvent struct { Namespace string `json:"namespace"` EventSrcId string `json:"event_src_id"` Timestamp time.Time `json:"timestamp"` // The type of metrics event. See above for valid values. MetricType string `json:"metric_type" mapstructure:"metric_type"` // The id of the router or controller which emitted the metric. SourceAppId string `json:"source_id" mapstructure:"source_id"` // If this metric is associated with an entity, such as link, this will // contain the entity id. SourceEntityId string `json:"source_entity_id,omitempty" mapstructure:"source_entity_id,omitempty"` // The version of the metrics format. The current version is 3. Version uint32 `json:"version"` // The name of the metric. Metric string `json:"metric"` // The values that copmrise the metrics. Metrics map[string]any `json:"metrics"` // Some metrics include additional metadata. // For example link metrics may include source and destination. Tags map[string]string `json:"tags,omitempty"` // Events will often be collected together on a schedule. This is a correlation id // so that events can be tied together with other events emitted at the same time. SourceEventId string `json:"source_event_id" mapstructure:"source_event_id"` }
A MetricsEvent represents a point in time snapshot of a metric from a controller or router.
Valid values for metric type are:
- intValue
- floatValue
- meter
- histogram
- timer
Example: The service policy enforcer deletes meter
{ "namespace": "metrics", "event_src_id": "ctrl_client", "timestamp": "2025-01-17T02:45:21.890823877Z", "metric_type": "meter", "source_id": "ctrl_client", "version": 3, "metric": "service.policy.enforcer.run.deletes", "metrics": { "count": 0, "m15_rate": 0, "m1_rate": 0, "m5_rate": 0, "mean_rate": 0 }, "source_event_id": "c41fbf8d-cd14-4b8b-ae7b-0f0e93e2021d" }
Example: The api session create timer
{ "namespace": "metrics", "event_src_id": "ctrl_client", "timestamp": "2025-01-17T02:45:21.890823877Z", "metric_type": "timer", "source_id": "ctrl_client", "version": 3, "metric": "api-session.create", "metrics": { "count": 1, "m15_rate": 0.0006217645754885097, "m1_rate": 0.000002754186169011774, "m5_rate": 0.0005841004612303224, "max": 7598246, "mean": 7598246, "mean_rate": 0.0018542395091967903, "min": 7598246, "p50": 7598246, "p75": 7598246, "p95": 7598246, "p99": 7598246, "p999": 7598246, "p9999": 7598246, "std_dev": 0, "variance": 0 }, "source_event_id": "c41fbf8d-cd14-4b8b-ae7b-0f0e93e2021d" }
type MetricsEventHandler ¶
type MetricsEventHandler interface {
AcceptMetricsEvent(event *MetricsEvent)
}
type MetricsEventHandlerF ¶
type MetricsEventHandlerF func(event *MetricsEvent)
func (MetricsEventHandlerF) AcceptMetricsEvent ¶
func (self MetricsEventHandlerF) AcceptMetricsEvent(event *MetricsEvent)
type MetricsEventHandlerWrapper ¶
type MetricsEventHandlerWrapper interface { MetricsEventHandler IsWrapping(value MetricsEventHandler) bool }
type MetricsMapper ¶
type MetricsMapper func(msg *metrics_pb.MetricsMessage, event *MetricsEvent)
type MetricsMessageHandler ¶
type MetricsMessageHandler interface { // AcceptMetricsMsg is called when new metrics become available AcceptMetricsMsg(message *metrics_pb.MetricsMessage) }
type MetricsMessageHandlerF ¶
type MetricsMessageHandlerF func(msg *metrics_pb.MetricsMessage)
func (MetricsMessageHandlerF) AcceptMetricsMsg ¶
func (self MetricsMessageHandlerF) AcceptMetricsMsg(msg *metrics_pb.MetricsMessage)
type MetricsMessageHandlerWrapper ¶
type MetricsMessageHandlerWrapper interface { MetricsMessageHandler IsWrapping(value MetricsEventHandler) bool }
type RegistrationHandler ¶
type RegistrationHandler func(eventType string, handler interface{}, config map[string]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 ¶
type RouterEvent struct { Namespace string `json:"namespace"` Timestamp time.Time `json:"timestamp"` EventSrcId string `json:"event_src_id"` // The router event type. EventType RouterEventType `json:"event_type"` // The router identifier. RouterId string `json:"router_id"` // Indicates whether the router is online or not. Redundant given // the router event type. Should likely be removed. RouterOnline bool `json:"router_online"` }
A RouterEvent is generated when a router comes online or goes offline.
Note: In version prior to 1.4.0, the namespace was `fabric.routers`
Valid values for router event type are:
- router-online
- router-offline
Example: Router online event
{ "namespace": "router", "event_src_id": "ctrl1", "timestamp": "2021-04-22T11:26:31.99299884-04:00", "event_type": "router-online", "router_id": "JAoyjafljO", "router_online": true }
Example: Router offline event
{ "namespace": "router", "event_src_id": "ctrl1", "timestamp": "2021-04-22T11:26:41.335114358-04:00", "event_type": "router-offline", "router_id": "JAoyjafljO", "router_online": false }
func (*RouterEvent) String ¶
func (event *RouterEvent) String() string
type RouterEventHandler ¶
type RouterEventHandler interface {
AcceptRouterEvent(event *RouterEvent)
}
type RouterEventHandlerWrapper ¶ added in v1.4.0
type RouterEventHandlerWrapper interface { RouterEventHandler IsWrapping(value RouterEventHandler) bool }
type RouterEventType ¶
type RouterEventType string
const ( RouterEventNS = "router" RouterOnline RouterEventType = "router-online" RouterOffline RouterEventType = "router-offline" )
type SdkEvent ¶ added in v1.2.0
type SdkEvent struct { Namespace string `json:"namespace"` EventSrcId string `json:"event_src_id"` Timestamp time.Time `json:"timestamp"` // The sdk event type. See above for valid values. EventType SdkEventType `json:"event_type"` // The id of the identity whose connectivity state has changed. IdentityId string `json:"identity_id"` }
An SdkEvent is emitted when an sdk's connectivity to routers changes.
Valid values for sdk event type are:
- sdk-online - identity is online
- sdk-offline - identity is offline
- sdk-status-unknown - status is unknown because the routers that reported the identity online are not connected to the controller
Example: SDK identity is online
{ "namespace": "sdk", "event_src_id": "ctrl1", "event_type" : "sdk-online", "identity_id": "ji2Rt8KJ4", "timestamp": "2024-10-02T12:17:39.501821249-04:00" }
Example: SDK identity online status is unknown
{ "namespace": "sdk", "event_src_id": "ctrl1", "event_type" : "sdk-status-unknown", "identity_id": "ji2Rt8KJ4", "timestamp": "2024-10-02T12:17:40.501821249-04:00" }
Example: SDK identit is offline
{ "namespace": "sdk", "event_src_id": "ctrl1", "event_type" : "sdk-offline", "identity_id": "ji2Rt8KJ4", "timestamp": "2024-10-02T12:17:41.501821249-04:00" }
type SdkEventHandler ¶ added in v1.2.0
type SdkEventHandler interface {
AcceptSdkEvent(event *SdkEvent)
}
type SdkEventHandlerWrapper ¶ added in v1.2.0
type SdkEventHandlerWrapper interface { SdkEventHandler IsWrapping(value SdkEventHandler) bool }
type SdkEventType ¶ added in v1.2.0
type SdkEventType string
const ( SdkEventNS = "sdk" SdkOnline SdkEventType = "sdk-online" SdkOffline SdkEventType = "sdk-offline" SdkStatusUnknown SdkEventType = "sdk-status-unknown" )
type ServiceEvent ¶
type ServiceEvent struct { Namespace string `json:"namespace"` EventSrcId string `json:"event_src_id"` Timestamp time.Time `json:"timestamp"` // The event version. The current version is 2. Version uint32 `json:"version"` // The services event type. See above for valid values. EventType string `json:"event_type"` // The terminator id, if this is representing a terminator specific metric. TerminatorId string `json:"terminator_id"` // The service identifier. ServiceId string `json:"service_id"` // The number of events that have happened in the given time interval Count uint64 `json:"count"` // The start time of the interval. It is represented as Unix time, number of seconds // since the beginning of the current epoch. IntervalStartUTC int64 `json:"interval_start_utc"` // The interval length in seconds. IntervalLength uint64 `json:"interval_length"` }
A ServiceEvent is emitted for service and terminator level metrics which are collected per some interval.
Note: In version prior to 1.4.0, the config key was `services`, but the namespace was `service.events`
Value values for the service event type are:
- service.dial.success
- service.dial.fail
- service.dial.timeout
- service.dial.error_other
- service.dial.terminator.timeout
- service.dial.terminator.connection_refused
- service.dial.terminator.invalid
- service.dial.terminator.misconfigured
Example: Dial Success for a specific service and terminator
{ "namespace": "service", "event_src_id": "ctrl_client", "timestamp": "2024-10-02T12:17:40.501821249-04:00" "version": 2, "event_type": "service.dial.success", "terminator_id": "2xFBuwwzJzAXuw5lOPnDwr", "service_id": "3pjMOKY2icS8fkQ1lfHmrP", "count": 1, "interval_start_utc": 1737140460, "interval_length": 60 }
Example: Dail failures or type 'Other' for a specific service
{ "namespace": "service", "event_src_id": "ctrl_client", "timestamp": "2024-10-02T12:17:40.501821249-04:00" "version": 2, "event_type": "service.dial.error_other", "terminator_id": "", "service_id": "3pjMOKY2icS8fkQ1lfHmrP", "count": 1, "interval_start_utc": 1737140580, "interval_length": 60 }
func (*ServiceEvent) String ¶
func (event *ServiceEvent) String() string
type ServiceEventHandler ¶
type ServiceEventHandler interface {
AcceptServiceEvent(event *ServiceEvent)
}
type ServiceEventHandlerWrapper ¶ added in v1.4.0
type ServiceEventHandlerWrapper interface { ServiceEventHandler IsWrapping(value ServiceEventHandler) bool }
type SessionEvent ¶
type SessionEvent struct { Namespace string `json:"namespace"` EventSrcId string `json:"event_src_id"` Timestamp time.Time `json:"timestamp"` // The type of session event. See above for valid values. EventType string `json:"event_type"` // The session type (dial or bind). SessionType string `json:"session_type"` // Type is the session provider. See above for valid values. Provider string `json:"provider"` // The session identifier. Id string `json:"id"` // The session token. Token string `json:"token,omitempty"` // The id of the api session used to create this session. ApiSessionId string `json:"api_session_id"` // The id of the identity on whose behalf the session was created. IdentityId string `json:"identity_id"` // The id of the service that this session is claiming access to. ServiceId string `json:"service_id"` }
A SessionEvent is emitted when a session is created or deleted.
Note: In version prior to 1.4.0, the namespace was `edge.sessions`
Valid values for session type are:
- created
- deleted
Valid session provider are:
- jwt
- legacy
Example: Bind Session created event
{ "namespace": "session", "event_src_id": "ctrl_client", "timestamp": "2025-01-17T12:29:53.204988284-05:00", "event_type": "created", "provider" : "legacy", "session_type": "Bind", "id": "cm611bn75000jdhj9s5xrwynr", "token": "4ed77b84-650e-4b4b-9fbb-2466c9c94abb", "api_session_id": "cm611bn6l000hdhj9urp9xlnw", "identity_id": "IahyE.5Scw", "service_id": "3pjMOKY2icS8fkQ1lfHmrP" }
Example: Bind session deleted event
{ "namespace": "session", "event_src_id": "ctrl_client", "timestamp": "2025-01-17T12:30:08.593650693-05:00", "event_type": "deleted", "provider" : "legacy", "session_type": "Bind", "id": "cm611bgxa0008dhj9k3yo3vox", "token": "f8a447a2-2bd0-4821-8142-27c1770d06ab", "api_session_id": "cm611bgwn0006dhj9m4cv1obf", "identity_id": "IahyE.5Scw", "service_id": "3pjMOKY2icS8fkQ1lfHmrP" }
func (*SessionEvent) String ¶
func (event *SessionEvent) String() string
type SessionEventHandler ¶
type SessionEventHandler interface {
AcceptSessionEvent(event *SessionEvent)
}
type SessionEventHandlerWrapper ¶
type SessionEventHandlerWrapper interface { SessionEventHandler IsWrapping(value SessionEventHandler) bool }
type Subscription ¶
type Subscription struct { Type string `json:"type"` Options map[string]interface{} `json:"options"` }
A Subscription has information to configure an event handler. It contains the EventType to subscribe to and any optional configuration for the subscription. This might include things like event versions or event filtering
type TerminatorEvent ¶
type TerminatorEvent struct { Namespace string `json:"namespace"` EventSrcId string `json:"event_src_id"` Timestamp time.Time `json:"timestamp"` // The type of terminator event. For valid values see above. EventType TerminatorEventType `json:"event_type"` // The id of the service that this terminator belongs to. ServiceId string `json:"service_id"` // The terminator's identifier. TerminatorId string `json:"terminator_id"` // The id of router that the terminator lives on. RouterId string `json:"router_id"` // Optional identifier indicating what is hosting the terminator. If hosted by the edge, will be an identity id. HostId string `json:"host_id"` // The instance id of the terminator InstanceId string `json:"instance_id"` // Indicates if the terminator's router is online. RouterOnline bool `json:"router_online"` // The terminator precedence. Precedence string `json:"precedence"` // The terminator's static cost. StaticCost uint16 `json:"static_cost"` // The terminator's dynamic cost (usually based on the number of circuits currently on the terminator). DynamicCost uint16 `json:"dynamic_cost"` // The total number of terminators that the service has. TotalTerminators int `json:"total_terminators"` // The number of online terminators with a default precedence for the service. UsableDefaultTerminators int `json:"usable_default_terminators"` // The number of online terminators with a required precedence for the service. UsableRequiredTerminators int `json:"usable_required_terminators"` // For internal use. PropagateIndicator bool `json:"-"` }
A TerminatorEvent is emitted at various points in the terminator lifecycle.
Note: In version prior to 1.4.0, the namespace was `fabric.terminators`
Valid values for terminator event types are:
- created - Note: replaced by entity change events
- updated - Note: replaced by entity changes events
- deleted - Note: replaced by entity change events
- router-online
- router-offline
Example: Terminator created event
{ "namespace": "terminator", "event_type": "created", "event_src_id": "ctrl_client", "timestamp": "2025-01-17T12:35:33.691240129-05:00", "service_id": "3pjMOKY2icS8fkQ1lfHmrP", "terminator_id": "2c9DGllUFx2GIFWFF5g5FP", "router_id": "5g2QrZxFcw", "host_id": "IahyE.5Scw", "router_online": true, "precedence": "default", "static_cost": 0, "dynamic_cost": 0, "total_terminators": 1, "usable_default_terminators": 1, "usable_required_terminators": 0 }
Example: Terminator router offline event
{ "namespace": "terminator", "event_type": "router-offline", "event_src_id": "ctrl_client", "timestamp": "2025-01-17T12:35:41.120951142-05:00", "service_id": "3pjMOKY2icS8fkQ1lfHmrP", "terminator_id": "2c9DGllUFx2GIFWFF5g5FP", "router_id": "5g2QrZxFcw", "host_id": "IahyE.5Scw", "router_online": false, "precedence": "default", "static_cost": 0, "dynamic_cost": 0, "total_terminators": 1, "usable_default_terminators": 0, "usable_required_terminators": 0 }
Example: Terminator router online event
{ "namespace": "terminator", "event_type": "router-online", "event_src_id": "ctrl_client", "timestamp": "2025-01-17T12:35:42.438815052-05:00", "service_id": "3pjMOKY2icS8fkQ1lfHmrP", "terminator_id": "2c9DGllUFx2GIFWFF5g5FP", "router_id": "5g2QrZxFcw", "host_id": "IahyE.5Scw", "router_online": true, "precedence": "default", "static_cost": 0, "dynamic_cost": 0, "total_terminators": 1, "usable_default_terminators": 1, "usable_required_terminators": 0 }
Example: Terminator Deleted Event
{ "namespace": "terminator", "event_type": "deleted", "event_src_id": "ctrl_client", "timestamp": "2025-01-17T12:35:42.448238469-05:00", "service_id": "3pjMOKY2icS8fkQ1lfHmrP", "terminator_id": "2c9DGllUFx2GIFWFF5g5FP", "router_id": "5g2QrZxFcw", "host_id": "IahyE.5Scw", "router_online": true, "precedence": "default", "static_cost": 0, "dynamic_cost": 0, "total_terminators": 0, "usable_default_terminators": 0, "usable_required_terminators": 0 }
func (*TerminatorEvent) IsModelEvent ¶
func (event *TerminatorEvent) IsModelEvent() bool
func (*TerminatorEvent) String ¶
func (event *TerminatorEvent) String() string
type TerminatorEventHandler ¶
type TerminatorEventHandler interface {
AcceptTerminatorEvent(event *TerminatorEvent)
}
type TerminatorEventHandlerWrapper ¶
type TerminatorEventHandlerWrapper interface { TerminatorEventHandler IsWrapping(value TerminatorEventHandler) bool }
type TerminatorEventType ¶
type TerminatorEventType string
const ( TerminatorEventNS = "terminator" TerminatorCreated TerminatorEventType = "created" TerminatorUpdated TerminatorEventType = "updated" TerminatorDeleted TerminatorEventType = "deleted" TerminatorRouterOnline TerminatorEventType = "router-online" TerminatorRouterOffline TerminatorEventType = "router-offline" )
type TypeRegistrar ¶
type TypeRegistrar interface { // Register takes a handler, which may implement multiple event handler // interfaces, and configure it using the configuration map provided Register(eventType string, handler interface{}, config map[string]interface{}) error // Unregister will remove give handler, if implements the interface for // this event type and is registered to receive events of this type Unregister(handler interface{}) }
A TypeRegistrar handles registering and unregistering handlers for a given event type
type UnregistrationHandler ¶
type UnregistrationHandler func(handler interface{})
A UnregistrationHandler will remove give handler, if implements the interface for this event type and is registered to receive events of this type
type UsageEventHandler ¶
type UsageEventHandler interface {
AcceptUsageEvent(event *UsageEventV2)
}
type UsageEventHandlerWrapper ¶ added in v1.4.0
type UsageEventHandlerWrapper interface { UsageEventHandler IsWrapping(value UsageEventHandler) bool }
type UsageEventV2 ¶ added in v1.4.0
type UsageEventV2 struct { Namespace string `json:"namespace"` EventSrcId string `json:"event_src_id"` Timestamp time.Time `json:"timestamp"` // The usage events version, which will always be 2 for this format. Version uint32 `json:"version"` // The type of usage. For valid values see above. EventType string `json:"event_type"` // The id of the router reporting the usage SourceId string `json:"source_id"` // The circuit id whose usage is being reported. CircuitId string `json:"circuit_id"` // The number of bytes of usage in the interval. Usage uint64 `json:"usage"` // The start time of the interval. It is represented as Unix time, number of seconds // since the beginning of the current epoch. IntervalStartUTC int64 `json:"interval_start_utc"` // The interval length in seconds. IntervalLength uint64 `json:"interval_length"` // Metadata, which may include things like the client and hosting identities and the service id. Tags map[string]string `json:"tags"` }
A UsageEventV2 is emitted for service usage interval metrics in the v2 format.
Note: In version prior to 1.4.0, the namespace was `fabric.usage`
Valid values for the usage event v2 type are:
- usage.ingress.rx - A read from an external connection to an initiating router
- usage.ingress.tx - A write to an external connection from an initiating router
- usage.egress.rx - A read from an external connection to an egress router
- usage.egress.tx - A write to an external connection from an egress router
- usage.fabric.rx - A read from a fabric link to a router
- usage.fabric.tx - A write to a fabric link from a router
Example: Ingress Data Received Usage Event
{ "namespace": "usage", "event_src_id": "ctrl_client", "timestamp": "2025-01-17T12:35:42.448238469-05:00", "version": 2, "event_type": "usage.ingress.rx", "source_id": "5g2QrZxFcw", "circuit_id": "gZrStElHY", "usage": 47, "interval_start_utc": 1737145920, "interval_length": 60, "tags": { "clientId": "haxn9lB0uc", "hostId": "IahyE.5Scw", "serviceId": "3pjMOKY2icS8fkQ1lfHmrP" } }
Example: Fabric Data Sent Usage Event
{ "namespace": "usage", "event_src_id": "ctrl_client", "timestamp": "2025-01-17T12:35:42.448238469-05:00", "version": 2, "event_type": "usage.fabric.tx", "source_id": "5g2QrZxFcw", "circuit_id": "gZrStElHY", "usage": 47, "interval_start_utc": 1737145920, "interval_length": 60, "tags": null }
func (*UsageEventV2) String ¶ added in v1.4.0
func (event *UsageEventV2) String() string
type UsageEventV3 ¶
type UsageEventV3 struct { Namespace string `json:"namespace"` EventSrcId string `json:"event_src_id"` Timestamp time.Time `json:"timestamp"` // The usage events version, which will always be 3 for this format. Version uint32 `json:"version"` // The id of the router reporting the usage SourceId string `json:"source_id"` // The circuit id whose usage is being reported. CircuitId string `json:"circuit_id"` // Map of usage type to amount number of bytes used in the given interval. // For valid values for usage type, see above. Usage map[string]uint64 `json:"usage"` // The start time of the interval. It is represented as Unix time, number of seconds // since the beginning of the current epoch. IntervalStartUTC int64 `json:"interval_start_utc"` // The interval length in seconds. IntervalLength uint64 `json:"interval_length"` // Metadata, which may include things like the client and hosting identities and the service id. Tags map[string]string `json:"tags"` }
A UsageEventV3 is emitted for service usage interval metrics in the v3 format.
Note: In version prior to 1.4.0, the namespace was `fabric.usage`
Valid values for the usage types are:
- ingress.rx - A read from an external connection to an initiating router
- ingress.tx - A write to an external connection from an initiating router
- egress.rx - A read from an external connection to an egress router
- egress.tx - A write to an external connection from an egress router
- fabric.rx - A read from a fabric link to a router
- fabric.tx - A write to a fabric link from a router
Example: Untagged Usage Data Event
{ "namespace": "usage", "event_src_id": "ctrl_client", "timestamp": "2025-01-17T12:35:42.448238469-05:00", "version": 3, "source_id": "5g2QrZxFcw", "circuit_id": "bcRu0EQFe", "usage": { "fabric.rx": 47, "fabric.tx": 47 }, "interval_start_utc": 1737146220, "interval_length": 60, "tags": null }
Example: Tagged Usage Data Event
{ "namespace": "usage", "event_src_id": "ctrl_client", "timestamp": "2025-01-17T12:35:42.448238469-05:00", "version": 3, "source_id": "5g2QrZxFcw", "circuit_id": "bcRu0EQFe", "usage": { "ingress.rx": 47, "ingress.tx": 47 }, "interval_start_utc": 1737146220, "interval_length": 60, "tags": { "clientId": "haxn9lB0uc", "hostId": "IahyE.5Scw", "serviceId": "3pjMOKY2icS8fkQ1lfHmrP" } }
func (*UsageEventV3) String ¶
func (event *UsageEventV3) String() string
type UsageEventV3Handler ¶
type UsageEventV3Handler interface {
AcceptUsageEventV3(event *UsageEventV3)
}
type UsageEventV3HandlerWrapper ¶
type UsageEventV3HandlerWrapper interface { UsageEventV3Handler IsWrapping(value UsageEventV3Handler) bool }