Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateQueryRuntime ¶
func CalculateQueryRuntime(prev, curr map[string]CachedPGStatStatement) float64
CalculateQueryRuntime calculates the runtime of a query based on two consecutive snapshots of the pg_stat_statements table and returns the runtime in milliseconds.
func ValidateStruct ¶
func ValidateStruct(s interface{}) error
ValidateStruct validates a struct using the validator package It returns a single error with all validation errors combined Used to validate configs when we start the agent
Types ¶
type CachedPGStatStatement ¶
type CachedPGStatStatement struct {
QueryID string `json:"query_id"`
Query string `json:"query,omitempty"`
Calls int `json:"calls"`
TotalExecTime float64 `json:"total_exec_time"`
Rows int64 `json:"rows"`
}
func CalculateQueryRuntimeDelta ¶ added in v0.2.0
func CalculateQueryRuntimeDelta(prev, curr map[string]CachedPGStatStatement) ([]CachedPGStatStatement, int)
CalculateQueryRuntimeDelta calculates the delta between two consecutive snapshots of the pg_stat_statements and returns: [{ query_id: "query_id", calls: 10, total_exec_time: 1000 }, ...] The diff will be limited to only 100 different queries changed by default. Also, it will return the total number of diffs found to give us an idea if a lot of information is not captured The cap will be based upon their average execution time (descending)
type LeveledLogrus ¶
LeveledLogrus is a wrapper around logrus that provides leveled logging This is needed to be compatible with retryablehttp: https://github.com/hashicorp/go-retryablehttp/pull/101#issuecomment-735206810
func (*LeveledLogrus) Debug ¶
func (l *LeveledLogrus) Debug(msg string, keysAndValues ...interface{})
func (*LeveledLogrus) Error ¶
func (l *LeveledLogrus) Error(msg string, keysAndValues ...interface{})
func (*LeveledLogrus) Info ¶
func (l *LeveledLogrus) Info(msg string, keysAndValues ...interface{})
func (*LeveledLogrus) Warn ¶
func (l *LeveledLogrus) Warn(msg string, keysAndValues ...interface{})
type PGUserTables ¶ added in v0.4.0
type PGUserTables struct {
Name string `json:"name"`
Oid string `json:"oid"`
LastAutoVacuum time.Time `json:"last_autovacuum"`
LastAutoAnalyze time.Time `json:"last_autoanalyze"`
AutoVacuumCount int64 `json:"autovacuum_count"`
AutoAnalyzeCount int64 `json:"autoanalyze_count"`
NLiveTup int64 `json:"n_live_tup"`
NDeadTup int64 `json:"n_dead_tup"`
NModSinceAnalyze int64 `json:"n_mod_since_analyze"`
NInsSinceVacuum int64 `json:"n_ins_since_vacuum"`
SeqScan int64 `json:"seq_scan"`
SeqTupRead int64 `json:"seq_tup_read"`
IdxScan int64 `json:"idx_scan"`
IdxTupFetch int64 `json:"idx_tup_fetch"`
}