Documentation ¶
Index ¶
- Constants
- Variables
- func GetAllServerURIs(shards []Shard, connString connstring.ConnString) ([]string, error)
- func GetAllShardURIs(shards []Shard, connString connstring.ConnString) ([]string, error)
- func GetClusterType(serverStatus ServerStatus) string
- func GetDatabaseNames(client *mongo.Client) ([]string, error)
- func GetErrorCode(err error) int
- func GetIndexSuggestion(explain ExplainCommand, cardList []CardinalityCount) gox.OrderedMap
- func GetKeys(document bson.D, _range ...bool) []string
- func IsDuplicateKeyError(err error) bool
- func IsUnauthorizedError(err error) bool
- func MongoPipeline(str string) mongo.Pipeline
- func NewMongoClient(uri string, files ...string) (*mongo.Client, error)
- func ParseURI(uri string) (connstring.ConnString, error)
- func RunAdminCommand(client *mongo.Client, command string) (bson.M, error)
- func RunCommandOnDB(client *mongo.Client, command string, db string) (bson.M, error)
- func SkipNamespace(namespace string, namespaceMap map[string]bool) bool
- func SplitNamespace(namespace string) (string, string)
- func ToFloat64(num interface{}) float64
- func ToInt(num interface{}) int
- func ToInt32(num interface{}) int32
- func ToInt64(num interface{}) int64
- type Accesses
- type BSONPrinter
- type BuildInfo
- type Cardinality
- type CardinalityCount
- type CardinalitySummary
- type ChangeStream
- type ChartDataPoint
- type Chunk
- type ClusterStats
- func (p *ClusterStats) GetClusterShortSummary(client *mongo.Client) string
- func (p *ClusterStats) GetClusterStats(client *mongo.Client, connString connstring.ConnString) error
- func (p *ClusterStats) GetClusterStatsSummary(client *mongo.Client) error
- func (p *ClusterStats) GetServersStatsSummary(shards []Shard, connString connstring.ConnString) ([]Shard, error)
- func (p *ClusterStats) GetShortSummary() string
- func (p *ClusterStats) OutputBSON() error
- func (p *ClusterStats) Print()
- func (p *ClusterStats) SetRedaction(redact bool)
- func (p *ClusterStats) SetVerbose(verbose bool)
- type CmdLineOpts
- type Collection
- type DBStats
- type Database
- type DatabaseStats
- type Explain
- type ExplainCommand
- type ExplainSummary
- type Histogram
- type HostInfo
- type Index
- type IndexScore
- type IndexStats
- func (ix *IndexStats) CreateIndexes(client *mongo.Client, namespaces ...[]string) error
- func (ix *IndexStats) GetIndexes(client *mongo.Client) ([]Database, error)
- func (ix *IndexStats) GetIndexesFromCollection(client *mongo.Client, collection *mongo.Collection) ([]Index, error)
- func (ix *IndexStats) GetIndexesFromDB(client *mongo.Client, db string) ([]Collection, error)
- func (ix *IndexStats) OutputBSON() error
- func (ix *IndexStats) OutputJSON() error
- func (ix *IndexStats) Print()
- func (ix *IndexStats) PrintIndexesOf(databases []Database)
- func (ix *IndexStats) SetClusterDetailsFromFile(filename string) error
- func (ix *IndexStats) SetFilename(filename string)
- func (ix *IndexStats) SetLogger(logger *Logger)
- func (ix *IndexStats) SetNoColor(nocolor bool)
- func (ix *IndexStats) SetVerbose(verbose bool)
- type IndexUsage
- type ListDatabases
- type LogInfo
- func (li *LogInfo) AnalyzeFile(filename string) error
- func (li *LogInfo) OutputBSON() error
- func (li *LogInfo) OutputJSON() error
- func (li *LogInfo) Parse(reader *bufio.Reader, counts ...int) error
- func (li *LogInfo) ParseLog(str string) (LogStats, error)
- func (li *LogInfo) ParseLogv2(str string) (LogStats, error)
- func (li *LogInfo) Print()
- func (li *LogInfo) SetCollscan(collscan bool)
- func (li *LogInfo) SetRedaction(redaction bool)
- func (li *LogInfo) SetRegexPattern(regex string)
- func (li *LogInfo) SetSilent(silent bool)
- func (li *LogInfo) SetVerbose(verbose bool)
- type LogStats
- type Logger
- type Logv2
- type OpPattern
- type OplogStats
- type QueryExplainer
- func (qe *QueryExplainer) Explain() (ExplainSummary, error)
- func (qe *QueryExplainer) GetExplainDetails(doc bson.M) ExplainSummary
- func (qe *QueryExplainer) GetFilter() bson.D
- func (qe *QueryExplainer) GetIndexesScores(keys []string) []IndexScore
- func (qe *QueryExplainer) GetSummary(summary ExplainSummary) string
- func (qe *QueryExplainer) ReadQueryShape(buffer []byte) error
- func (qe *QueryExplainer) SetVerbose(verbose bool)
- type Redactor
- type ReplSetGetStatus
- type ServerStatus
- type Shard
- type SlowOps
- type StageStats
- type WiredTigerCache
Constants ¶
const COLLSCAN = "COLLSCAN"
COLLSCAN constance
const Replica = "replica"
Replica set
const Sharded = "sharded"
Sharded cluster
const Standalone = "standalone"
Standalone server
Variables ¶
var CodeBlue = "\x1b[34;1m"
CodeBlue shows blue color
var CodeDefault = "\x1b[0m"
CodeDefault shows default color
var CodeGreen = "\x1b[32;1m"
CodeGreen shows green color
var CodeRed = "\x1b[31;1m"
CodeRed shows red color
var CodeYellow = "\x1b[33;1m"
CodeYellow shows yellow color
var ExamplesCollection = "__examples"
ExamplesCollection default test colection
var KeyholeDB = "_KEYHOLE_88800"
KeyholeDB default database
Functions ¶
func GetAllServerURIs ¶ added in v1.0.1
func GetAllServerURIs(shards []Shard, connString connstring.ConnString) ([]string, error)
GetAllServerURIs returns URIs of all mongo servers
func GetAllShardURIs ¶ added in v1.0.1
func GetAllShardURIs(shards []Shard, connString connstring.ConnString) ([]string, error)
GetAllShardURIs returns URIs of all replicas
func GetClusterType ¶ added in v1.0.1
func GetClusterType(serverStatus ServerStatus) string
GetClusterType returns cluster type
func GetDatabaseNames ¶ added in v1.0.3
GetDatabaseNames gets all database names
func GetErrorCode ¶ added in v1.0.3
GetErrorCode gets error code for debug purpose
func GetIndexSuggestion ¶ added in v1.0.1
func GetIndexSuggestion(explain ExplainCommand, cardList []CardinalityCount) gox.OrderedMap
GetIndexSuggestion returns a recommended index by cardinalities index follows a principle of equality, sort, rnage
func IsDuplicateKeyError ¶ added in v1.0.3
IsDuplicateKeyError check if error is from duplicate key
func IsUnauthorizedError ¶ added in v1.0.3
IsUnauthorizedError check Unauthorized error
func MongoPipeline ¶
MongoPipeline gets aggregation pipeline from a string
func NewMongoClient ¶
NewMongoClient new mongo client
func ParseURI ¶ added in v1.0.1
func ParseURI(uri string) (connstring.ConnString, error)
ParseURI checks if password is included
func RunAdminCommand ¶
RunAdminCommand executes admin Command
func RunCommandOnDB ¶
RunCommandOnDB execute admin Command at given database
func SkipNamespace ¶ added in v1.0.4
SkipNamespace skips namespace
func SplitNamespace ¶ added in v1.0.4
SplitNamespace returns db, collection
Types ¶
type Accesses ¶ added in v1.0.1
type Accesses struct { Ops int `json:"ops" bson:"ops"` Since time.Time `json:"since" bson:"since"` }
Accesses stores index accesses
type BSONPrinter ¶ added in v1.0.1
type BSONPrinter struct {
// contains filtered or unexported fields
}
BSONPrinter stores bson printer info
func NewBSONPrinter ¶ added in v1.0.1
func NewBSONPrinter(version string) *BSONPrinter
NewBSONPrinter returns BSONPrinter
func (*BSONPrinter) Print ¶ added in v1.0.1
func (p *BSONPrinter) Print(filename string) error
Print print summary or output json from bson
func (*BSONPrinter) SetNoColor ¶ added in v1.0.1
func (p *BSONPrinter) SetNoColor(nocolor bool)
SetNoColor set nocolor flag
type BuildInfo ¶ added in v1.0.1
type BuildInfo struct { GitVersion string `bson:"gitVersion"` Modules []string `bson:"modules"` Version string `bson:"version"` }
BuildInfo stores build information
type Cardinality ¶
type Cardinality struct {
// contains filtered or unexported fields
}
Cardinality -
func NewCardinality ¶
func NewCardinality(client *mongo.Client) *Cardinality
NewCardinality returns cardinality constructor
func (*Cardinality) GetCardinalityArray ¶ added in v1.0.1
func (card *Cardinality) GetCardinalityArray(database string, collection string, keys ...[]string) (CardinalitySummary, error)
GetCardinalityArray returns cardinality list
func (*Cardinality) GetSummary ¶ added in v1.0.1
func (card *Cardinality) GetSummary(summary CardinalitySummary) string
GetSummary get summary of cardinality
type CardinalityCount ¶ added in v1.0.1
CardinalityCount stores cardinality counts
type CardinalitySummary ¶ added in v1.0.1
type CardinalitySummary struct { SampledCount int64 List []CardinalityCount }
CardinalitySummary stores Cardinality summary
type ChangeStream ¶ added in v1.0.1
type ChangeStream struct {
// contains filtered or unexported fields
}
ChangeStream defines what to watch? client, database or collection
func NewChangeStream ¶ added in v1.0.1
func NewChangeStream() *ChangeStream
NewChangeStream gets a new ChangeStream
func (*ChangeStream) SetCollection ¶ added in v1.0.1
func (cs *ChangeStream) SetCollection(collection string)
SetCollection sets collection
func (*ChangeStream) SetDatabase ¶ added in v1.0.1
func (cs *ChangeStream) SetDatabase(database string)
SetDatabase sets database
func (*ChangeStream) SetPipeline ¶ added in v1.0.1
func (cs *ChangeStream) SetPipeline(pipeline []bson.D)
SetPipeline sets pipeline
func (*ChangeStream) SetPipelineString ¶ added in v1.0.1
func (cs *ChangeStream) SetPipelineString(pipe string)
SetPipelineString sets pipeline string
func (*ChangeStream) Watch ¶ added in v1.0.1
func (cs *ChangeStream) Watch(client *mongo.Client, cb callback)
Watch prints oplogs in JSON format
type ChartDataPoint ¶ added in v1.0.1
type ChartDataPoint struct {
// contains filtered or unexported fields
}
ChartDataPoint has chart data points key/value
type Chunk ¶ added in v1.0.1
type Chunk struct { Empty int64 `bson:"empty"` Jumbo int64 `bson:"jumbo"` Objects int64 `bson:"objects"` Shard string `bson:"shard"` Size int64 `bson:"size"` Total int64 `bson:"total"` }
Chunk stores chunk stats
type ClusterStats ¶ added in v1.0.1
type ClusterStats struct { BuildInfo BuildInfo `bson:"buildInfo"` CmdLineOpts CmdLineOpts `bson:"getCmdLineOpts"` Cluster string `bson:"cluster"` Databases []Database `bson:"databases"` Host string `bson:"host"` HostInfo HostInfo `bson:"hostInfo"` Logger *Logger `bson:"keyhole"` OplogStats OplogStats `bson:"oplog"` Process string `bson:"process"` ReplSetGetStatus ReplSetGetStatus `bson:"replSetGetStatus"` ServerStatus ServerStatus `bson:"serverStatus"` Shards []Shard `bson:"shards"` Version string `bson:"version"` // contains filtered or unexported fields }
ClusterStats keeps slow ops struct
func NewClusterStats ¶ added in v1.0.4
func NewClusterStats(version string) *ClusterStats
NewClusterStats returns *ClusterStats
func (*ClusterStats) GetClusterShortSummary ¶ added in v1.0.1
func (p *ClusterStats) GetClusterShortSummary(client *mongo.Client) string
GetClusterShortSummary returns one line summary
func (*ClusterStats) GetClusterStats ¶ added in v1.0.1
func (p *ClusterStats) GetClusterStats(client *mongo.Client, connString connstring.ConnString) error
GetClusterStats collects cluster stats
func (*ClusterStats) GetClusterStatsSummary ¶ added in v1.0.1
func (p *ClusterStats) GetClusterStatsSummary(client *mongo.Client) error
GetClusterStatsSummary collects cluster stats
func (*ClusterStats) GetServersStatsSummary ¶ added in v1.0.1
func (p *ClusterStats) GetServersStatsSummary(shards []Shard, connString connstring.ConnString) ([]Shard, error)
GetServersStatsSummary returns cluster stats from all shards
func (*ClusterStats) GetShortSummary ¶ added in v1.0.1
func (p *ClusterStats) GetShortSummary() string
GetShortSummary returns a short summary
func (*ClusterStats) OutputBSON ¶ added in v1.0.1
func (p *ClusterStats) OutputBSON() error
OutputBSON writes bson data to a file
func (*ClusterStats) Print ¶ added in v1.0.1
func (p *ClusterStats) Print()
Print prints a cluster short summary
func (*ClusterStats) SetRedaction ¶ added in v1.0.1
func (p *ClusterStats) SetRedaction(redact bool)
SetRedaction sets redact
func (*ClusterStats) SetVerbose ¶ added in v1.0.1
func (p *ClusterStats) SetVerbose(verbose bool)
SetVerbose sets verbose mode
type CmdLineOpts ¶ added in v1.0.1
CmdLineOpts stores build information
func GetCmdLineOpts ¶ added in v1.0.1
func GetCmdLineOpts(client *mongo.Client) (CmdLineOpts, error)
GetCmdLineOpts returns MongoDB build information
type Collection ¶ added in v1.0.1
type Collection struct { Chunks []Chunk `bson:"chunks,truncate"` Document bson.M `bson:"document,truncate"` Indexes []Index `bson:"indexes,truncate"` Name string `bson:"name,truncate"` NS string `bson:"namespace,truncate"` Stats struct { Count int64 `bson:"count,truncate"` IndexDetails bson.M `bson:"indexDetails,truncate"` AvgObjSize float64 `bson:"avgObjSize,truncate"` WiredTiger bson.M `bson:"wiredTiger,truncate"` IndexSizes bson.M `bson:"indexSizes,truncate"` Capped bool `bson:"capped,truncate"` TotalIndexSize int64 `bson:"totalIndexSize,truncate"` MaxSize int64 `bson:"maxSize,truncate"` Nindexes int64 `bson:"nindexes,truncate"` Shards bson.M `bson:"shards,truncate"` NS string `bson:"namespace,truncate"` Nchunks int64 `bson:"nchunks,truncate"` Sharded bool `bson:"sharded,truncate"` Size int64 `bson:"size,truncate"` StorageSize int64 `bson:"storageSize,truncate"` } `bson:"stats"` }
Collection stores struct
type DBStats ¶
type DBStats struct { DB string `json:"db" bson:"db"` DataSize int `json:"dataSize" bson:"dataSize"` IndexSize int `json:"indexSize" bson:"indexSize"` Objects int `json:"objects" bson:"objects"` }
DBStats contains info from db.stats()
type Database ¶ added in v1.0.1
type Database struct { Name string `bson:"name"` Collections []Collection `bson:"collections,truncate"` SizeOnDisk int64 `bson:"sizeOnDisk,truncate"` Empty bool `bson:"empty,truncate"` Shards bson.M `bson:"shards,truncate"` Stats struct { Raw bson.M `bson:"raw,truncate"` Objects int64 `bson:"objects,truncate"` IndexSize int64 `bson:"indexSize,truncate"` FileSize int64 `bson:"fileSize,truncate"` Indexes int64 `bson:"indexes,truncate"` ScaleFactor int64 `bson:"scaleFactor,truncate"` AvgObjSize int64 `bson:"avgObjSize,truncate"` DataSize int64 `bson:"dataSize,truncate"` StorageSize int64 `bson:"storageSize,truncate"` NumExtents int64 `bson:"numExtents,truncate"` } }
Database stores database stats
type DatabaseStats ¶ added in v1.0.1
type DatabaseStats struct { Logger *Logger // contains filtered or unexported fields }
DatabaseStats stores struct
func NewDatabaseStats ¶ added in v1.0.1
func NewDatabaseStats(version string) *DatabaseStats
NewDatabaseStats returns DatabaseStats
func (*DatabaseStats) GetAllDatabasesStats ¶ added in v1.0.1
func (p *DatabaseStats) GetAllDatabasesStats(client *mongo.Client) ([]Database, error)
GetAllDatabasesStats gets all db info
func (*DatabaseStats) SetLogger ¶ added in v1.0.1
func (p *DatabaseStats) SetLogger(Logger *Logger)
SetLogger sets Logger
func (*DatabaseStats) SetNumberThreads ¶ added in v1.0.1
func (p *DatabaseStats) SetNumberThreads(threads int)
SetNumberThreads set # of threads
func (*DatabaseStats) SetRedaction ¶ added in v1.0.1
func (p *DatabaseStats) SetRedaction(redaction bool)
SetRedaction sets redaction
func (*DatabaseStats) SetVerbose ¶ added in v1.0.1
func (p *DatabaseStats) SetVerbose(verbose bool)
SetVerbose sets verbosity
type Explain ¶ added in v1.0.1
type Explain struct {
// contains filtered or unexported fields
}
Explain stores explain object info
func (*Explain) ExecuteAllPlans ¶ added in v1.0.1
ExecuteAllPlans calls queryPlanner and cardinality
func (*Explain) PrintExplainResults ¶ added in v1.0.1
PrintExplainResults prints explain results
func (*Explain) SetVerbose ¶ added in v1.0.1
SetVerbose sets verbosity
type ExplainCommand ¶ added in v1.0.1
type ExplainCommand struct { Collection string `bson:"find"` Filter bson.D `bson:"filter"` Sort bson.D `bson:"sort,omitempty"` Hint bson.D `bson:"hint,omitempty"` Group string `bson:"group,omitempty"` }
ExplainCommand stores explain document
type ExplainSummary ¶ added in v1.0.1
type ExplainSummary struct { ShardName string `json:"shardName"` ExecutionStats StageStats `json:"executionStats"` AllPlansExecutionStats []StageStats `json:"allPlansExecution"` }
ExplainSummary stores explain summary
type HostInfo ¶ added in v1.0.1
type HostInfo struct { Extra struct { KernelVersion string } OS struct { Name string Type string Version string } System struct { CPUAddrSize int `bson:"cpuAddrSize,truncate"` CPUArch string `bson:"cpuArch"` Hostname string `bson:"hostname"` MemLimitMB int `bson:"memLimitMB,truncate"` MemSizeMB int `bson:"memSizeMB,truncate"` NumaEnabled bool `bson:"numaEnabled"` NumCores int `bson:"numCores,truncate"` } }
HostInfo stores build information
type Index ¶ added in v1.0.1
type Index struct { Background bool `json:"background" bson:"background"` Collation bson.D `json:"collation" bson:"collation"` ExpireAfterSeconds int32 `json:"expireAfterSeconds" bson:"expireAfterSeconds,truncate,omitempty"` Key bson.D `json:"key" bson:"key"` Name string `json:"name" bson:"name,truncate"` PartialFilterExpression bson.D `json:"partialFilterExpression" bson:"partialFilterExpression"` Sparse bool `json:"sparse" bson:"sparse"` Unique bool `json:"unique" bson:"unique"` Version int32 `json:"v" bson:"v,truncate"` EffectiveKey string `json:"effectiveKey" bson:"effectiveKey"` Fields []string `json:"fields" bson:"fields"` IsDupped bool `json:"isDupped" bson:"isDupped"` IsShardKey bool `json:"isShardkey" bson:"isShardkey"` KeyString string `json:"keyString" bson:"keyString"` TotalOps int `json:"totalOps" bson:"totalOps"` Usage []IndexUsage `json:"usage" bson:"usage"` }
Index stores indexes stats
type IndexScore ¶ added in v1.0.1
type IndexScore struct { Index gox.OrderedMap `json:"index"` Score float64 `json:"score"` }
IndexScore keeps index score
type IndexStats ¶ added in v1.0.1
type IndexStats struct { Databases []Database `bson:"databases"` Logger *Logger `bson:"keyhole"` // contains filtered or unexported fields }
IndexStats holder indexes reader struct
func NewIndexStats ¶ added in v1.0.1
func NewIndexStats(version string) *IndexStats
NewIndexStats establish seeding parameters
func (*IndexStats) CreateIndexes ¶ added in v1.0.1
func (ix *IndexStats) CreateIndexes(client *mongo.Client, namespaces ...[]string) error
CreateIndexes creates indexes
func (*IndexStats) GetIndexes ¶ added in v1.0.1
func (ix *IndexStats) GetIndexes(client *mongo.Client) ([]Database, error)
GetIndexes list all indexes of collections of databases
func (*IndexStats) GetIndexesFromCollection ¶ added in v1.0.1
func (ix *IndexStats) GetIndexesFromCollection(client *mongo.Client, collection *mongo.Collection) ([]Index, error)
GetIndexesFromCollection gets indexes from a collection
func (*IndexStats) GetIndexesFromDB ¶ added in v1.0.1
func (ix *IndexStats) GetIndexesFromDB(client *mongo.Client, db string) ([]Collection, error)
GetIndexesFromDB list all indexes of collections of a database
func (*IndexStats) OutputBSON ¶ added in v1.0.1
func (ix *IndexStats) OutputBSON() error
OutputBSON writes index stats bson to a file
func (*IndexStats) OutputJSON ¶ added in v1.0.1
func (ix *IndexStats) OutputJSON() error
OutputJSON writes json data to a file
func (*IndexStats) PrintIndexesOf ¶ added in v1.0.1
func (ix *IndexStats) PrintIndexesOf(databases []Database)
PrintIndexesOf prints indexes
func (*IndexStats) SetClusterDetailsFromFile ¶ added in v1.0.1
func (ix *IndexStats) SetClusterDetailsFromFile(filename string) error
SetClusterDetailsFromFile File sets cluster details from a file
func (*IndexStats) SetFilename ¶ added in v1.0.1
func (ix *IndexStats) SetFilename(filename string)
SetFilename sets output file name
func (*IndexStats) SetLogger ¶ added in v1.0.1
func (ix *IndexStats) SetLogger(logger *Logger)
SetLogger sets logger
func (*IndexStats) SetNoColor ¶ added in v1.0.1
func (ix *IndexStats) SetNoColor(nocolor bool)
SetNoColor set nocolor flag
func (*IndexStats) SetVerbose ¶ added in v1.0.1
func (ix *IndexStats) SetVerbose(verbose bool)
SetVerbose sets verbose level
type IndexUsage ¶ added in v1.0.1
type IndexUsage struct { Accesses Accesses `json:"accesses" bson:"accesses"` Host string `json:"host" bson:"host"` Name string `json:"name" bson:"name"` Shard string `json:"shard" bson:"shard"` }
IndexUsage stores index accesses
type ListDatabases ¶ added in v1.0.1
type ListDatabases struct { Databases []Database `bson:"databases"` TotalSize int64 `bson:"totalSize"` TotalSizeMB int64 `bson:"totalSizeMb"` }
ListDatabases stores listDatabases
type LogInfo ¶ added in v1.0.1
type LogInfo struct { Collscan bool `bson:"collscan"` Histogram []Histogram `bson:"histogram"` Logger *Logger `bson:"keyhole"` LogType string `bson:"type"` Regex string `bson:"regex"` OpPatterns []OpPattern `bson:"opPatterns"` Redaction bool `bson:"redact"` SlowOps []SlowOps `bson:"slowOps"` // contains filtered or unexported fields }
LogInfo keeps loginfo struct
func (*LogInfo) AnalyzeFile ¶ added in v1.0.1
AnalyzeFile analyze logs from a file
func (*LogInfo) OutputBSON ¶ added in v1.0.1
OutputBSON writes loginfo bson data
func (*LogInfo) OutputJSON ¶ added in v1.0.1
OutputJSON writes json data to a file
func (*LogInfo) ParseLogv2 ¶ added in v1.0.1
ParseLogv2 - parses text message before v4.4
func (*LogInfo) SetCollscan ¶ added in v1.0.1
SetCollscan -
func (*LogInfo) SetRedaction ¶ added in v1.0.1
SetRedaction sets redaction
func (*LogInfo) SetRegexPattern ¶ added in v1.0.1
SetRegexPattern sets Regex patthen
func (*LogInfo) SetVerbose ¶ added in v1.0.1
SetVerbose -
type LogStats ¶ added in v1.0.1
type LogStats struct {
// contains filtered or unexported fields
}
LogStats log stats structure
type Logger ¶ added in v1.0.1
type Logger struct { Collected time.Time `json:"collected" bson:"collected"` Warnings []string `json:"warnings" bson:"warnings"` Logs []string `json:"logs" bson:"logs"` Params string `json:"params" bson:"params"` Version string `json:"version" bson:"version"` // contains filtered or unexported fields }
Logger stores logger info
func (*Logger) Error ¶ added in v1.0.3
func (p *Logger) Error(v ...interface{})
Error adds and prints an error message
func (*Logger) Info ¶ added in v1.0.3
func (p *Logger) Info(v ...interface{})
Info adds and prints a message
func (*Logger) SetNoColor ¶ added in v1.0.1
SetNoColor set nocolor flag
type Logv2 ¶ added in v1.0.1
type Logv2 struct { Attributes struct { Command map[string]interface{} `json:"command" bson:"command"` Milli int `json:"durationMillis" bson:"durationMillis"` NS string `json:"ns" bson:"ns"` OriginatingCommand map[string]interface{} `json:"originatingCommand" bson:"originatingCommand"` PlanSummary string `json:"planSummary" bson:"planSummary"` Type string `json:"type" bson:"type"` } `json:"attr" bson:"attr"` Component string `json:"c" bson:"c"` ID int `json:"id" bson:"id"` Message string `json:"msg" bson:"msg"` Severity string `json:"s" bson:"s"` Timestamp map[string]string `json:"t" bson:"t"` }
Logv2 stores logv2 info
type OpPattern ¶ added in v1.0.1
type OpPattern struct { Command string `bson:"command"` // count, delete, find, remove, and update Count int `bson:"count"` // number of ops Filter string `bson:"filter"` // query pattern MaxMilli int `bson:"maxmilli"` // max millisecond Namespace string `bson:"ns"` // database.collectin Scan string `bson:"scan"` // COLLSCAN TotalMilli int `bson:"totalmilli"` // total milliseconds Index string `bson:"index"` // index used }
OpPattern stores performance data
type OplogStats ¶ added in v1.0.1
type OplogStats struct { Count int `bson:"count"` DurationInSeconds int64 `bson:"durationInSeconds"` MaxSize int64 `bson:"maxSize"` Size int64 `bson:"size"` }
OplogStats stores oplog stats
func GetOplogStats ¶ added in v1.0.1
func GetOplogStats(client *mongo.Client) (OplogStats, error)
GetOplogStats returns oplog stats
type QueryExplainer ¶ added in v1.0.1
type QueryExplainer struct { ExplainCmd ExplainCommand `bson:"explain"` NameSpace string // contains filtered or unexported fields }
QueryExplainer stores query analyzer info
func NewQueryExplainer ¶ added in v1.0.1
func NewQueryExplainer(client *mongo.Client) *QueryExplainer
NewQueryExplainer returns QueryExplainer
func (*QueryExplainer) Explain ¶ added in v1.0.1
func (qe *QueryExplainer) Explain() (ExplainSummary, error)
Explain explains query plans
func (*QueryExplainer) GetExplainDetails ¶ added in v1.0.1
func (qe *QueryExplainer) GetExplainDetails(doc bson.M) ExplainSummary
GetExplainDetails returns summary from a doc
func (*QueryExplainer) GetFilter ¶ added in v1.0.1
func (qe *QueryExplainer) GetFilter() bson.D
GetFilter sets verbosity
func (*QueryExplainer) GetIndexesScores ¶ added in v1.0.1
func (qe *QueryExplainer) GetIndexesScores(keys []string) []IndexScore
GetIndexesScores returns a list of indexes scores
func (*QueryExplainer) GetSummary ¶ added in v1.0.1
func (qe *QueryExplainer) GetSummary(summary ExplainSummary) string
GetSummary get summary of explain executionStats
func (*QueryExplainer) ReadQueryShape ¶ added in v1.0.1
func (qe *QueryExplainer) ReadQueryShape(buffer []byte) error
ReadQueryShape parses filter map
func (*QueryExplainer) SetVerbose ¶ added in v1.0.1
func (qe *QueryExplainer) SetVerbose(verbose bool)
SetVerbose sets verbosity
type Redactor ¶ added in v1.0.1
type Redactor struct {
// contains filtered or unexported fields
}
Redactor stores Redact struct
func (*Redactor) SetVerbose ¶ added in v1.0.1
SetVerbose sets verbosity
type ReplSetGetStatus ¶ added in v1.0.1
type ReplSetGetStatus struct { Members []struct { ID int `bson:"_id"` Health int `bson:"health"` Name string `bson:"name"` // Optime primitive.Timestamp `bson:"optime"` State int `bson:"state"` StateStr string `bson:"stateStr"` SyncingTo string `bson:"syncingTo"` SyncSourceHost string `bson:"syncSourceHost"` Uptime int64 `bson:"uptime"` } `bson:"members"` Set string `bson:"set"` SyncingTo string `bson:"syncingTo"` SyncSourceHost string `bson:"syncSourceHost"` }
ReplSetGetStatus stores replset info
func GetReplSetGetStatus ¶ added in v1.0.1
func GetReplSetGetStatus(client *mongo.Client) (ReplSetGetStatus, error)
GetReplSetGetStatus returns MongoDB build information
type ServerStatus ¶ added in v1.0.1
type ServerStatus struct { Connections struct { Active int `bson:"active"` Current int `bson:"current"` Available int `bson:"available"` TotalCreated int `bson:"totalCreated"` } `bson:"connections"` Host string `bson:"host"` LocalTime time.Time `bson:"localTime"` Mem struct { Virtual int `bson:"virtual"` Supported bool `bson:"supported"` Bits int `bson:"bits"` Resident int `bson:"resident"` } `bson:"mem"` Metrics struct { Cursor struct { Open struct { Pinned int `bson:"pinned"` Total int `bson:"total"` } `bson:"open"` } `bson:"cursor"` } `bson:"metrics"` OpCounters struct { Command int `bson:"command"` Insert int `bson:"insert"` Query int `bson:"query"` Update int `bson:"update"` Delete int `bson:"delete"` GetMore int `bson:"getmore"` } `bson:"opcounters"` Process string `bson:"process"` Repl struct { Hosts []string `bson:"hosts"` IsMaster bool `bson:"isMaster"` Me string `bson:"me"` Primary string `bson:"primary"` SetName string `bson:"setName"` Secondary bool `bson:"secondary"` } `bson:"repl"` Sharding struct { ConfigsvrConnectionString string `bson:"configsvrConnectionString"` MaxChunkSizeInBytes int `bson:"maxChunkSizeInBytes"` } `bson:"sharding"` StorageEngine struct { Name string `bson:"name"` } `bson:"storageEngine"` Version string `bson:"version"` WiredTiger struct { Cache bson.M `bson:"cache"` } `bson:"wiredTiger"` }
ServerStatus stores build information
func GetServerStatus ¶ added in v1.0.1
func GetServerStatus(client *mongo.Client) (ServerStatus, error)
GetServerStatus returns MongoDB build information
type Shard ¶ added in v1.0.1
type Shard struct { ID string `bson:"_id"` Host string `bson:"host"` State int `bson:"state"` Servers []ClusterStats `bson:"servers"` }
Shard store shard information
type StageStats ¶ added in v1.0.1
type StageStats struct { Level int Score float64 `json:"Score"` Stage string `json:"stage"` Filter *gox.OrderedMap `json:"filter"` KeyPattern *gox.OrderedMap `json:"keyPattern"` Advanced int32 `json:"advanced"` Works int32 `json:"works"` ExecTimeMillisEst int32 `json:"executionTimeMillisEstimate"` TotalKeysExamined int32 `json:"totalKeysExamined"` TotalDocsExamined int32 `json:"totalDocsExamined"` InputStages []StageStats `json:"inputStages"` }
StageStats stores stats for each stage
type WiredTigerCache ¶ added in v1.0.1
type WiredTigerCache struct {
// contains filtered or unexported fields
}
WiredTigerCache stores wiredTiger cache structure
func NewWiredTigerCache ¶ added in v1.0.1
func NewWiredTigerCache(version string) *WiredTigerCache
NewWiredTigerCache returns *WiredTigerCache
func (*WiredTigerCache) GetAllDatabasesStats ¶ added in v1.0.1
func (wtc *WiredTigerCache) GetAllDatabasesStats(client *mongo.Client) error
GetAllDatabasesStats returns db info
func (*WiredTigerCache) GetWiredTigerCacheData ¶ added in v1.0.1
func (wtc *WiredTigerCache) GetWiredTigerCacheData(w http.ResponseWriter, r *http.Request)
GetWiredTigerCacheData gets WT cache data
func (*WiredTigerCache) Handler ¶ added in v1.0.1
func (wtc *WiredTigerCache) Handler(w http.ResponseWriter, r *http.Request)
Handler supports resetful calls
func (*WiredTigerCache) Start ¶ added in v1.0.1
func (wtc *WiredTigerCache) Start(client *mongo.Client)
Start starts a web server and a thread to collect caches
Source Files ¶
- bson_printer.go
- build_info.go
- cardinality.go
- change_streams.go
- cluster_stats.go
- cmd_line_opts.go
- command.go
- databases_stats.go
- db_stats.go
- explain.go
- host_info.go
- index_stats.go
- index_suggestion.go
- log_parser.go
- logger.go
- loginfo.go
- logv2_parser.go
- mongo_client.go
- mongo_errors.go
- pipeline.go
- query_explainer.go
- redactor.go
- replica_status.go
- server_status.go
- shards.go
- utils.go
- wt_cache.go
- wt_html.go