Documentation ¶
Index ¶
- Constants
- func RefreshWithInterval(ctx context.Context, interval time.Duration, stats OplogPushUpdater, ...)
- type OplogArchivedStatsReport
- type OplogArchivedStatsReporter
- type OplogPushReport
- type OplogPushStats
- type OplogPushStatsOption
- type OplogPushStatus
- type OplogPushUpdater
- type OplogUploadStats
- type OplogUploadStatsUpdater
Constants ¶
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 ¶
OplogPushStats implements OplogPushUpdater
func NewOplogPushStats ¶
func NewOplogPushStats(ctx context.Context, opRep OplogArchivedStatsReporter, mc client.MongoDriver, opts ...OplogPushStatsOption) *OplogPushStats
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 ¶
OplogUploadStats implements OplogUploadStats -Reporter and -OplogPushUpdater
func NewOplogUploadStats ¶
func NewOplogUploadStats(lastUploadedTS models.Timestamp) *OplogUploadStats
NewOplogUploadStats builds OplogUploadStats
func (*OplogUploadStats) Report ¶
func (r *OplogUploadStats) Report() OplogArchivedStatsReport
Report ...
type OplogUploadStatsUpdater ¶
type OplogUploadStatsUpdater interface {
Update(batchDocs, batchBytes int, lastArchivedTS models.Timestamp)
}
OplogUploadStatsUpdater defines oplog archiving upload statistics update interface