stats

package
v0.2.23 Latest Latest
Warning

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

Go to latest
Published: May 14, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultStatsPrefix          = "/stats"
	DefaultOplogPushStatsPrefix = DefaultStatsPrefix + "/oplog_push"
)

Variables

This section is empty.

Functions

func RefreshWithInterval

func RefreshWithInterval(ctx context.Context, interval time.Duration, stats OplogPushUpdater, logger logFunc)

RefreshWithInterval renews OplogPushUpdater with given time interval

Types

type OplogArchivedStatsReport

type OplogArchivedStatsReport struct {
	LastTS models.Timestamp `json:"last_ts"`
	Docs   uint64           `json:"docs"`
	Bytes  uint64           `json:"bytes"`
}

OplogArchivedStatsReport defines oplog archiving upload statistics report

type OplogArchivedStatsReporter

type OplogArchivedStatsReporter interface {
	Report() OplogArchivedStatsReport
}

OplogArchivedStatsReporter defines oplog archiving upload statistics fetching interface

type OplogPushReport

type OplogPushReport struct {
	Status   OplogPushStatus          `json:"status"`
	Archived OplogArchivedStatsReport `json:"archived"`
	Mongo    struct {
		LastKnownMajTS models.Timestamp `json:"last_known_maj_ts"`
	} `json:"mongo"`
}

OplogPushReport defines oplog-push statistics report

type OplogPushStats

type OplogPushStats struct {
	sync.Mutex
	// contains filtered or unexported fields
}

OplogPushStats implements OplogPushUpdater

func NewOplogPushStats

NewOplogPushStats builds OplogPushStats

func (*OplogPushStats) RunLogging

func (st *OplogPushStats) RunLogging(logInterval time.Duration, logger logFunc)

RunLogging executes logFunc every logInterval with current stats

func (*OplogPushStats) ServeHTTP

func (st *OplogPushStats) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements stats http-handler

func (*OplogPushStats) Update

func (st *OplogPushStats) Update() error

Update initiates stats update from underlying reports

type OplogPushStatsOption

type OplogPushStatsOption func(*OplogPushStats)

func EnableHTTPHandler

func EnableHTTPHandler(httpPattern string, srv webserver.WebServer) OplogPushStatsOption

EnableHTTPHandler registers stats handler at given web server

func EnableLogReport

func EnableLogReport(logInterval time.Duration, logger logFunc) OplogPushStatsOption

EnableLogReport runs logging stats procedure in new goroutine

type OplogPushStatus

type OplogPushStatus string
const (
	OplogPushStandBy   OplogPushStatus = "standby"
	OplogPushArchiving OplogPushStatus = "archiving"
)

type OplogPushUpdater

type OplogPushUpdater interface {
	Update() error
}

OplogPushUpdater defines oplog-push procedure statistics update interface

type OplogUploadStats

type OplogUploadStats struct {
	sync.Mutex
	// contains filtered or unexported fields
}

OplogUploadStats implements OplogUploadStats -Reporter and -OplogPushUpdater

func NewOplogUploadStats

func NewOplogUploadStats(lastUploadedTS models.Timestamp) *OplogUploadStats

NewOplogUploadStats builds OplogUploadStats

func (*OplogUploadStats) Report

Report ...

func (*OplogUploadStats) Update

func (r *OplogUploadStats) Update(batchDocs, batchBytes int, lastArchivedTS models.Timestamp)

Update ...

type OplogUploadStatsUpdater

type OplogUploadStatsUpdater interface {
	Update(batchDocs, batchBytes int, lastArchivedTS models.Timestamp)
}

OplogUploadStatsUpdater defines oplog archiving upload statistics update interface

Jump to

Keyboard shortcuts

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