stats

package
v3.2.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fingerprinter

type Fingerprinter interface {
	Fingerprint(doc proto.SystemProfile) (fingerprinter.Fingerprint, error)
}

type GroupKey

type GroupKey struct {
	Operation   string
	Namespace   string
	Fingerprint string
}

func (GroupKey) String

func (g GroupKey) String() string

type GroupKeys

type GroupKeys []GroupKey

func (GroupKeys) Len

func (a GroupKeys) Len() int

func (GroupKeys) Less

func (a GroupKeys) Less(i, j int) bool

func (GroupKeys) Swap

func (a GroupKeys) Swap(i, j int)

type Queries

type Queries []QueryInfoAndCounters

Queries is a slice of MongoDB statistics

func (Queries) CalcQueriesStats

func (q Queries) CalcQueriesStats(uptime int64) []QueryStats

CalcQueriesStats calculates QueryStats for given uptime

func (Queries) CalcTotalQueriesStats

func (q Queries) CalcTotalQueriesStats(uptime int64) QueryStats

CalcTotalQueriesStats calculates total QueryStats for given uptime

type QueryInfoAndCounters

type QueryInfoAndCounters struct {
	ID          string
	Namespace   string
	Operation   string
	Query       string
	Fingerprint string
	FirstSeen   time.Time
	LastSeen    time.Time
	TableScan   bool

	Count          int
	BlockedTime    Times
	LockTime       Times
	NReturned      []float64
	NScanned       []float64
	QueryTime      []float64 // in milliseconds
	ResponseLength []float64
}

type QueryStats

type QueryStats struct {
	ID          string
	Namespace   string
	Operation   string
	Query       string
	Fingerprint string
	FirstSeen   time.Time
	LastSeen    time.Time

	Count          int
	QPS            float64
	Rank           int
	Ratio          float64
	QueryTime      Statistics
	ResponseLength Statistics
	Returned       Statistics
	Scanned        Statistics
}

type Statistics

type Statistics struct {
	Pct    float64
	Total  float64
	Min    float64
	Max    float64
	Avg    float64
	Pct95  float64
	Pct99  float64
	StdDev float64
	Median float64
}

type Stats

type Stats struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Stats is a collection of MongoDB statistics

func New

func New(fingerprinter Fingerprinter) *Stats

New creates new instance of stats with given Fingerprinter

func (*Stats) Add

func (s *Stats) Add(doc proto.SystemProfile) error

Add adds proto.SystemProfile to the collection of statistics

func (*Stats) Queries

func (s *Stats) Queries() Queries

Queries returns all collected statistics

func (*Stats) Reset

func (s *Stats) Reset()

Reset clears the collection of statistics

type StatsError

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

func (*StatsError) Error

func (e *StatsError) Error() string

func (*StatsError) Parent

func (e *StatsError) Parent() error

type StatsFingerprintError

type StatsFingerprintError StatsError

type Times

type Times []time.Time

times is an array of time.Time that implements the Sorter interface

func (Times) Len

func (a Times) Len() int

func (Times) Less

func (a Times) Less(i, j int) bool

func (Times) Swap

func (a Times) Swap(i, j int)

Jump to

Keyboard shortcuts

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