Documentation ¶
Index ¶
- func FindPromMetric(metrics map[string]*promdata.MetricFamily, name string, ...) *promdata.Metric
- func FindPromMetricCounter(metrics map[string]*promdata.MetricFamily, name string, ...) int
- func PromMetricOplogEntriesProcessed(metrics map[string]*promdata.MetricFamily) int
- func RunInserts(client *mgo.Database, numInserts int, frequency time.Duration) []string
- type BackgroundInserter
- type MongoServer
- type OTRProcess
- type RedisServer
- type RedisVerifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindPromMetric ¶
func FindPromMetric(metrics map[string]*promdata.MetricFamily, name string, labels map[string]string) *promdata.Metric
FindPromMetric is a helper to take the metrics scraped from oplogtoredis, and get a particular metric partition
func FindPromMetricCounter ¶
func FindPromMetricCounter(metrics map[string]*promdata.MetricFamily, name string, labels map[string]string) int
FindPromMetricCounter is like FindPromMetric, but then extracts an integer ounter value
func PromMetricOplogEntriesProcessed ¶
func PromMetricOplogEntriesProcessed(metrics map[string]*promdata.MetricFamily) int
PromMetricOplogEntriesProcessed finds specifically the value of the otr_oplog_entries_received metric, and returns the value of the {database: "testdb", status: "processed"} partition
Types ¶
type BackgroundInserter ¶
type BackgroundInserter struct {
// contains filtered or unexported fields
}
BackgroundInserter represents a run of RunInserts that's running in a background goroutine
func Run100InsertsInBackground ¶
func Run100InsertsInBackground(client *mgo.Database) *BackgroundInserter
Run100InsertsInBackground runs RunInserts in a background goroutine It attempts 100 inserts over at least 10 seconds.
func RunInsertsInBackground ¶
func RunInsertsInBackground(client *mgo.Database, numInserts int, frequency time.Duration) *BackgroundInserter
RunInsertsInBackground is a more customizable version of Run100InsertsInBackground allowing you to set the number of inserts and how fast to perform them.
func (*BackgroundInserter) Result ¶
func (inserter *BackgroundInserter) Result() []string
Result waits for the inserter to finish, and then returns the result
type MongoServer ¶
type MongoServer struct { Addr string // contains filtered or unexported fields }
MongoServer represents a 3-node Mongo replica set running on this host
func StartMongoServer ¶
func StartMongoServer() *MongoServer
StartMongoServer starts a mongo replica set and returns a MongoServer for further operations
func (*MongoServer) Client ¶
func (server *MongoServer) Client() *mgo.Session
Client returns an mgo.Session configured to talk to the replica set
func (*MongoServer) Start ¶
func (server *MongoServer) Start()
Start starts up the Mongo replica set. This is automatically called by StartMongoServer, so you should only need to call this if you've stopped the replica set.
This function does not return until the replica set is up and ready to accept connections.
func (*MongoServer) StepDown ¶
func (server *MongoServer) StepDown()
StepDown triggers a step-down of the primary
type OTRProcess ¶
type OTRProcess struct {
// contains filtered or unexported fields
}
OTRProcess represents a running oplogtoredis process
func StartOTRProcess ¶
func StartOTRProcess(mongoURL string, redisURL string, port int) *OTRProcess
StartOTRProcess starts a Redis proc and returns a OTRProcess for further operations
func StartOTRProcessWithEnv ¶
func StartOTRProcessWithEnv(mongoURL string, redisURL string, port int, extraEnv []string) *OTRProcess
StartOTRProcessWithEnv is like StartOTRProcess, but lets you customize the environment variables for oplogtoredis. OTR_MONGO_URL, OTR_REDIS_URL, OTR_LOG_DEBUG, and OTR_HTTP_SERVER_ADDR are always set for you, so you only need this function if you want to set options other than those.
func (*OTRProcess) GetPromMetrics ¶
func (proc *OTRProcess) GetPromMetrics() map[string]*promdata.MetricFamily
GetPromMetrics scrapes the prometheus metrics from the OTR process
func (*OTRProcess) Start ¶
func (proc *OTRProcess) Start()
Start starts up the OTR process. This is automatically called by StartOTRProcess, so you should only need to call this if you've stopped the process.
type RedisServer ¶
type RedisServer struct { Addr string // contains filtered or unexported fields }
RedisServer represents a running Redis server
func StartRedisServer ¶
func StartRedisServer() *RedisServer
StartRedisServer starts a Redis server and returns a RedisServer for further operations
func (*RedisServer) Client ¶
func (server *RedisServer) Client() redis.UniversalClient
Client returns a go-redis client for this redis server
func (*RedisServer) Start ¶
func (server *RedisServer) Start()
Start starts up the Redis server. This is automatically called by StartRedisServer, so you should only need to call this if you've stopped the server.
This function does not return until the server is up and ready to accept connections.
type RedisVerifier ¶
type RedisVerifier struct {
// contains filtered or unexported fields
}
RedisVerifier subscribes to the publications that a BackgroundInserter should be making, and verifies that they were made.
func NewRedisVerifier ¶
func NewRedisVerifier(client redis.UniversalClient) *RedisVerifier
NewRedisVerifier creates a RedisVerifier and starts reading messages from Redis
func (*RedisVerifier) ReceivedCount ¶
func (verifier *RedisVerifier) ReceivedCount() int
ReceivedCount returns the number of Redis message received by this verifier