Documentation
¶
Index ¶
Constants ¶
View Source
const Name = "mongo"
Variables ¶
View Source
var CommandMonitor = event.CommandMonitor{ Started: func(ctx context.Context, e *event.CommandStartedEvent) { }, Succeeded: func(ctx context.Context, e *event.CommandSucceededEvent) { }, Failed: func(ctx context.Context, e *event.CommandFailedEvent) { }, }
Command metrics
View Source
var PoolMonitor = event.PoolMonitor{ Event: func(e *event.PoolEvent) { switch e.Type { case "ConnectionCreated": connectionsCreatedTotal.WithLabelValues(e.Address).Inc() connectionPoolSize.WithLabelValues(e.Address).Inc() case "ConnectionClosedEvent": connectionsClosedTotal.WithLabelValues(e.Address).Inc() connectionPoolSize.WithLabelValues(e.Address).Dec() case "ConnectionCheckedOut": connectionPoolSize.WithLabelValues(e.Address).Dec() inUseConnections.WithLabelValues(e.Address).Inc() case "ConnectionCheckedIn": connectionPoolSize.WithLabelValues(e.Address).Inc() inUseConnections.WithLabelValues(e.Address).Dec() } }, }
Pool Metrics
Functions ¶
Types ¶
type MongoPlugin ¶
type MongoPlugin struct {
// contains filtered or unexported fields
}
This is a plugin that handles sending the request to the acutual downstream mongo
func (*MongoPlugin) Configure ¶
func (p *MongoPlugin) Configure(d bson.D) error
Configure configures this plugin with the given configuration object. Returns an error if the configuration is invalid for the plugin.
func (*MongoPlugin) Name ¶
func (p *MongoPlugin) Name() string
type MongoPluginConfig ¶
type MongoPluginConfig struct {
MongoAddr string `bson:"mongoAddr"`
// Default 30s
ConnectTimeout *string `bson:"connectTimeout"`
// zstd,zlib,snappy
Compressors []string `bson:"compressors"`
// Default 10s
HeartbeatInterval *string `bson:"heartbeatInterval"`
// Default is 0 (indefinite)
MaxConnIdleTime *string `bson:"maxConnIdleTime"`
// Default is 100
MaxPoolSize *uint64 `bson:"maxPoolSize"`
// Default is 0
MinPoolSize *uint64 `bson:"minPoolSize"`
// Default 30s (waiting for available connection)
ServerSelectionTimeout *string `bson:"serverSelectionTimeout"`
// How long to wait for socket operations. Default is 0 (infinite)
SocketTimeout *string `bson:"socketTimeout"`
// EnableDNSDiscovery enables background resolution of the DNS results to set the host list of the mongo driver
EnableDNSDiscovery bool `bson:"enableDNSDiscovery"`
}
Click to show internal directories.
Click to hide internal directories.