package event
import "go.mongodb.org/mongo-driver/event"
Index ¶
- Constants
- type CommandFailedEvent
- type CommandFinishedEvent
- type CommandMonitor
- type CommandStartedEvent
- type CommandSucceededEvent
- type MonitorPoolOptions
- type PoolEvent
- type PoolMonitor
- type ServerClosedEvent
- type ServerDescriptionChangedEvent
- type ServerHeartbeatFailedEvent
- type ServerHeartbeatStartedEvent
- type ServerHeartbeatSucceededEvent
- type ServerMonitor
- type ServerOpeningEvent
- type TopologyClosedEvent
- type TopologyDescriptionChangedEvent
- type TopologyOpeningEvent
Constants ¶
const ( ReasonIdle = "idle" ReasonPoolClosed = "poolClosed" ReasonStale = "stale" ReasonConnectionErrored = "connectionError" ReasonTimedOut = "timeout" )
strings for pool command monitoring reasons
const ( ConnectionClosed = "ConnectionClosed" PoolCreated = "ConnectionPoolCreated" ConnectionCreated = "ConnectionCreated" ConnectionReady = "ConnectionReady" GetFailed = "ConnectionCheckOutFailed" GetSucceeded = "ConnectionCheckedOut" ConnectionReturned = "ConnectionCheckedIn" PoolCleared = "ConnectionPoolCleared" PoolClosedEvent = "ConnectionPoolClosed" )
strings for pool command monitoring types
Types ¶
type CommandFailedEvent ¶
type CommandFailedEvent struct {
CommandFinishedEvent
Failure string
}
CommandFailedEvent represents an event generated when a command's execution fails.
type CommandFinishedEvent ¶
type CommandFinishedEvent struct {
DurationNanos int64
CommandName string
RequestID int64
ConnectionID string
}
CommandFinishedEvent represents a generic command finishing.
type CommandMonitor ¶
type CommandMonitor struct {
Started func(context.Context, *CommandStartedEvent)
Succeeded func(context.Context, *CommandSucceededEvent)
Failed func(context.Context, *CommandFailedEvent)
}
CommandMonitor represents a monitor that is triggered for different events.
type CommandStartedEvent ¶
type CommandStartedEvent struct {
Command bson.Raw
DatabaseName string
CommandName string
RequestID int64
ConnectionID string
}
CommandStartedEvent represents an event generated when a command is sent to a server.
type CommandSucceededEvent ¶
type CommandSucceededEvent struct {
CommandFinishedEvent
Reply bson.Raw
}
CommandSucceededEvent represents an event generated when a command's execution succeeds.
type MonitorPoolOptions ¶
type MonitorPoolOptions struct {
MaxPoolSize uint64 `json:"maxPoolSize"`
MinPoolSize uint64 `json:"minPoolSize"`
WaitQueueTimeoutMS uint64 `json:"maxIdleTimeMS"`
}
MonitorPoolOptions contains pool options as formatted in pool events
type PoolEvent ¶
type PoolEvent struct {
Type string `json:"type"`
Address string `json:"address"`
ConnectionID uint64 `json:"connectionId"`
PoolOptions *MonitorPoolOptions `json:"options"`
Reason string `json:"reason"`
}
PoolEvent contains all information summarizing a pool event
type PoolMonitor ¶
type PoolMonitor struct {
Event func(*PoolEvent)
}
PoolMonitor is a function that allows the user to gain access to events occurring in the pool
type ServerClosedEvent ¶
type ServerClosedEvent struct {
Address address.Address
TopologyID primitive.ObjectID // A unique identifier for the topology this server is a part of
}
ServerClosedEvent is an event generated when the server is closed.
type ServerDescriptionChangedEvent ¶
type ServerDescriptionChangedEvent struct {
Address address.Address
TopologyID primitive.ObjectID // A unique identifier for the topology this server is a part of
PreviousDescription description.Server
NewDescription description.Server
}
ServerDescriptionChangedEvent represents a server description change.
type ServerHeartbeatFailedEvent ¶
type ServerHeartbeatFailedEvent struct {
DurationNanos int64
Failure error
ConnectionID string // The address this heartbeat was sent to with a unique identifier
Awaited bool // If this heartbeat was awaitable
}
ServerHeartbeatFailedEvent is an event generated when the heartbeat fails.
type ServerHeartbeatStartedEvent ¶
type ServerHeartbeatStartedEvent struct {
ConnectionID string // The address this heartbeat was sent to with a unique identifier
Awaited bool // If this heartbeat was awaitable
}
ServerHeartbeatStartedEvent is an event generated when the heartbeat is started.
type ServerHeartbeatSucceededEvent ¶
type ServerHeartbeatSucceededEvent struct {
DurationNanos int64
Reply description.Server
ConnectionID string // The address this heartbeat was sent to with a unique identifier
Awaited bool // If this heartbeat was awaitable
}
ServerHeartbeatSucceededEvent is an event generated when the heartbeat succeeds.
type ServerMonitor ¶
type ServerMonitor struct {
ServerDescriptionChanged func(*ServerDescriptionChangedEvent)
ServerOpening func(*ServerOpeningEvent)
ServerClosed func(*ServerClosedEvent)
// TopologyDescriptionChanged is called when the topology is locked, so the callback should
// not attempt any operation that requires server selection on the same client.
TopologyDescriptionChanged func(*TopologyDescriptionChangedEvent)
TopologyOpening func(*TopologyOpeningEvent)
TopologyClosed func(*TopologyClosedEvent)
ServerHeartbeatStarted func(*ServerHeartbeatStartedEvent)
ServerHeartbeatSucceeded func(*ServerHeartbeatSucceededEvent)
ServerHeartbeatFailed func(*ServerHeartbeatFailedEvent)
}
ServerMonitor represents a monitor that is triggered for different server events. The client will monitor changes on the MongoDB deployment it is connected to, and this monitor reports the changes in the client's representation of the deployment. The topology represents the overall deployment, and heartbeats are sent to individual servers to check their current status.
type ServerOpeningEvent ¶
type ServerOpeningEvent struct {
Address address.Address
TopologyID primitive.ObjectID // A unique identifier for the topology this server is a part of
}
ServerOpeningEvent is an event generated when the server is initialized.
type TopologyClosedEvent ¶
type TopologyClosedEvent struct {
TopologyID primitive.ObjectID // A unique identifier for the topology this server is a part of
}
TopologyClosedEvent is an event generated when the topology is closed.
type TopologyDescriptionChangedEvent ¶
type TopologyDescriptionChangedEvent struct {
TopologyID primitive.ObjectID // A unique identifier for the topology this server is a part of
PreviousDescription description.Topology
NewDescription description.Topology
}
TopologyDescriptionChangedEvent represents a topology description change.
type TopologyOpeningEvent ¶
type TopologyOpeningEvent struct {
TopologyID primitive.ObjectID // A unique identifier for the topology this server is a part of
}
TopologyOpeningEvent is an event generated when the topology is initialized.
Source Files ¶
monitoring.go
- Version
- v1.5.0-beta1
- Published
- Dec 16, 2020
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- now –
Tools for package owners.