mongotop

package
v0.0.0-...-ac81b06 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2015 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package mongotop provides a method to track the amount of time a MongoDB instance spends reading and writing data.

Index

Constants

This section is empty.

Variables

View Source
var Usage = `` /* 178-byte string literal not displayed */

Functions

This section is empty.

Types

type FormattableDiff

type FormattableDiff interface {
	// Generate a JSON representation of the diff
	JSON() string
	// Generate a table-like representation which can be printed to a terminal
	Grid() string
}

FormattableDiff represents a diff of two samples taken by mongotop, which can be printed to output in various formats.

type LockDelta

type LockDelta struct {
	Read  int64 `json:"read"`
	Write int64 `json:"write"`
}

LockDelta represents the differences in read/write lock times between two samples.

type LockStats

type LockStats struct {
	AcquireCount        *ReadWriteLockTimes `bson:"acquireCount"`
	TimeLockedMicros    ReadWriteLockTimes  `bson:"timeLockedMicros"`
	TimeAcquiringMicros ReadWriteLockTimes  `bson:"timeAcquiringMicros"`
}

LockStats contains information on time spent acquiring and holding a lock.

type MongoTop

type MongoTop struct {
	// Generic mongo tool options
	Options *options.ToolOptions

	// Mongotop-specific output options
	OutputOptions *Output

	// for connecting to the db
	SessionProvider *db.SessionProvider

	// Length of time to sleep between each polling.
	Sleeptime time.Duration
	// contains filtered or unexported fields
}

MongoTop is a container for the user-specified options and internal state used for running mongotop.

func (*MongoTop) Run

func (mt *MongoTop) Run() error

Run executes the mongotop program.

type NSTopInfo

type NSTopInfo struct {
	Total TopField `bson:"total" json:"total"`
	Read  TopField `bson:"readLock" json:"read"`
	Write TopField `bson:"writeLock" json:"write"`
}

NSTopInfo holds information about a single namespace.

type Output

type Output struct {
	Locks    bool `long:"locks" description:"report on use of per-database locks"`
	RowCount int  `long:"rowcount" short:"n" description:"number of stats lines to print (0 for indefinite)"`
	Json     bool `long:"json" description:"format output as JSON"`
}

Output defines the set of options to use in displaying data from the server.

func (*Output) Name

func (_ *Output) Name() string

Name returns a human-readable group name for output options.

type ReadWriteLockTimes

type ReadWriteLockTimes struct {
	Read       int64 `bson:"R"`
	Write      int64 `bson:"W"`
	ReadLower  int64 `bson:"r"`
	WriteLower int64 `bson:"w"`
}

ReadWriteLockTimes contains read/write lock times on a database.

type ServerStatus

type ServerStatus struct {
	Locks map[string]LockStats `bson:"locks,omitempty"`
}

ServerStatus represents the results of the "serverStatus" command.

func (ServerStatus) Diff

func (ss ServerStatus) Diff(previous ServerStatus) ServerStatusDiff

Diff takes an older ServerStatus sample, and produces a ServerStatusDiff representing the deltas of each metric between the two samples.

type ServerStatusDiff

type ServerStatusDiff struct {
	// namespace -> lock times
	Totals map[string]LockDelta `json:"totals"`
	Time   time.Time            `json:"time"`
}

ServerStatusDiff contains a map of the lock time differences for each database.

func (ServerStatusDiff) Grid

func (ssd ServerStatusDiff) Grid() string

Grid returns a tabular representation of the ServerStatusDiff.

func (ServerStatusDiff) JSON

func (ssd ServerStatusDiff) JSON() string

JSON returns a JSON representation of the ServerStatusDiff.

type Top

type Top struct {
	Totals map[string]NSTopInfo `bson:"totals"`
}

Top holds raw output of the "top" command.

func (Top) Diff

func (top Top) Diff(previous Top) TopDiff

Diff takes an older Top sample, and produces a TopDiff representing the deltas of each metric between the two samples.

type TopDiff

type TopDiff struct {
	// namespace -> totals
	Totals map[string]NSTopInfo `json:"totals"`
	Time   time.Time            `json:"time"`
}

TopDiff contains a map of the differences between top samples for each namespace.

func (TopDiff) Grid

func (td TopDiff) Grid() string

Grid returns a tabular representation of the TopDiff.

func (TopDiff) JSON

func (td TopDiff) JSON() string

JSON returns a JSON representation of the TopDiff.

type TopField

type TopField struct {
	Time  int `bson:"time" json:"time"`
	Count int `bson:"count" json:"count"`
}

TopField contains the timing and counts for a single lock statistic within the "top" command.

Directories

Path Synopsis
Main package for the mongotop tool.
Main package for the mongotop tool.

Jump to

Keyboard shortcuts

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