oplog

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2019 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Overview

Package oplog tails a MongoDB oplog, process each message, and generates the message that should be sent to Redis. It writes these to an output channel that should be read by package redispub and sent to the Redis server.

Index

Constants

View Source
const DefaultInterval = 1 * time.Minute

DefaultInterval is the default collection interval for IntervalMaxMetric.

View Source
const DefaultMaxVecGCInterval = 5 * time.Second

DefaultMaxVecGCInterval is the default interval for cleaning up old state in IntervalMaxMetricVec.

Variables

View Source
var ErrUnsupportedDocIDType = errors.New("unsupported document _id type")

Functions

This section is empty.

Types

type IntervalMaxMetric added in v1.1.0

type IntervalMaxMetric struct {
	// contains filtered or unexported fields
}

IntervalMaxMetric is a prometheus metric that reports the maximum value reported to it within a configurable interval. These intervals are disjoint windows, and the *last* completed window is reported, if it immediately precedes the current one.

func NewIntervalMaxMetric added in v1.1.0

func NewIntervalMaxMetric(opts *IntervalMaxOpts, labels []string, labelValues []string) *IntervalMaxMetric

NewIntervalMaxMetric constructs a new IntervalMaxMetric.

func (*IntervalMaxMetric) Collect added in v1.1.0

func (c *IntervalMaxMetric) Collect(mtcs chan<- prometheus.Metric)

Collect implements the prometheus.Collector interface.

func (*IntervalMaxMetric) Describe added in v1.1.0

func (c *IntervalMaxMetric) Describe(descs chan<- *prometheus.Desc)

Describe implements the prometheus.Collector interface.

func (*IntervalMaxMetric) Report added in v1.1.0

func (c *IntervalMaxMetric) Report(value float64)

Report reports a value to the IntervalMaxMetric. If it is the greatest seen so far in the current window, it will be recorded as such until either another, greater value is reported, or the window ends (it will then be the value this IntervalMaxMetric returns when polled via Collect, until another window elapses).

type IntervalMaxMetricVec added in v1.1.0

type IntervalMaxMetricVec struct {
	// contains filtered or unexported fields
}

IntervalMaxMetricVec is a Vec version of IntervalMaxMetric.

func NewIntervalMaxMetricVec added in v1.1.0

func NewIntervalMaxMetricVec(opts *IntervalMaxVecOpts, labels []string) *IntervalMaxMetricVec

NewIntervalMaxMetricVec constructs a new IntervalMaxMetricVec.

func (*IntervalMaxMetricVec) Collect added in v1.1.0

func (c *IntervalMaxMetricVec) Collect(coll chan<- prometheus.Metric)

Collect implements the prometheus.Collector interface.

func (*IntervalMaxMetricVec) Describe added in v1.1.0

func (c *IntervalMaxMetricVec) Describe(descs chan<- *prometheus.Desc)

Describe implements the prometheus.Collector interface.

func (*IntervalMaxMetricVec) Report added in v1.1.0

func (c *IntervalMaxMetricVec) Report(value float64, labelValues ...string)

Report reports a value to this collector. See IntervalMaxMetric.Report for details.

type IntervalMaxOpts added in v1.1.0

type IntervalMaxOpts struct {
	prometheus.Opts

	// ReportInterval is the interval by which reports will be bucketed. Default 1m.
	ReportInterval time.Duration
	// contains filtered or unexported fields
}

IntervalMaxOpts are options for IntervalMaxMetric.

type IntervalMaxVecOpts added in v1.1.0

type IntervalMaxVecOpts struct {
	IntervalMaxOpts

	// GCInterval is the interval on which the IntervalMaxMetricVec will clean up old state. This operation acquires
	// an exclusive lock on the entire metric, so this should be relatively long. Default 5s.
	GCInterval time.Duration
}

IntervalMaxVecOpts is options for IntervalMaxMetricVec.

type Tailer

type Tailer struct {
	MongoClient *mgo.Session
	RedisClient redis.UniversalClient
	RedisPrefix string
	MaxCatchUp  time.Duration
}

Tailer persistently tails the oplog of a Mongo cluster, handling reconnection and resumption of where it left off.

func (*Tailer) Tail

func (tailer *Tailer) Tail(out chan<- *redispub.Publication, stop <-chan bool)

Tail begins tailing the oplog. It doesn't return unless it receives a message on the stop channel, in which case it wraps up its work and then returns.

Jump to

Keyboard shortcuts

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