Documentation ¶
Overview ¶
Metrics ¶
Code in this folder is responsible for reading and writing metric definitions. At the moment, metric definitions support two storages:
- PostgreSQL database
- YAML file
Content ¶
- `postgres*.go` files cover the functionality for the PostgreSQL database.
- `yaml*.go` files cover the functionality for the YAML file.
- `metrics.yaml` holds all default metrics and presets.
- `default.go` provides access to default metrics.
Index ¶
- Constants
- Variables
- func GetDefaultBuiltInMetrics() []string
- func ParseLogs(ctx context.Context, conn db.PgxIface, mdb *sources.MonitoredDatabase, ...)
- type CmdOpts
- type ExtensionInfo
- type ExtensionOverrides
- type Measurement
- type MeasurementEnvelope
- type Measurements
- type Metric
- type MetricAttrs
- type MetricDefs
- type Metrics
- type Migrator
- type Preset
- type PresetDefs
- type Reader
- type ReaderWriter
- func NewDefaultMetricReader(context.Context) (ReaderWriter, error)
- func NewPostgresMetricReaderWriter(ctx context.Context, connstr string) (ReaderWriter, error)
- func NewPostgresMetricReaderWriterConn(ctx context.Context, conn db.PgxPoolIface) (ReaderWriter, error)
- func NewYAMLMetricReaderWriter(ctx context.Context, path string) (ReaderWriter, error)
- type SQLs
- type Writer
Constants ¶
View Source
const CSVLogDefaultGlobSuffix = "*.csv"
View Source
const CSVLogDefaultRegEx = `` /* 298-byte string literal not displayed */
Variables ¶
View Source
var PgSeverities = [...]string{"DEBUG", "INFO", "NOTICE", "WARNING", "ERROR", "LOG", "FATAL", "PANIC"}
View Source
var PgSeveritiesLocale = map[string]map[string]string{
"C.": {"DEBUG": "DEBUG", "LOG": "LOG", "INFO": "INFO", "NOTICE": "NOTICE", "WARNING": "WARNING", "ERROR": "ERROR", "FATAL": "FATAL", "PANIC": "PANIC"},
"de": {"DEBUG": "DEBUG", "LOG": "LOG", "INFO": "INFO", "HINWEIS": "NOTICE", "WARNUNG": "WARNING", "FEHLER": "ERROR", "FATAL": "FATAL", "PANIK": "PANIC"},
"fr": {"DEBUG": "DEBUG", "LOG": "LOG", "INFO": "INFO", "NOTICE": "NOTICE", "ATTENTION": "WARNING", "ERREUR": "ERROR", "FATAL": "FATAL", "PANIK": "PANIC"},
"it": {"DEBUG": "DEBUG", "LOG": "LOG", "INFO": "INFO", "NOTIFICA": "NOTICE", "ATTENZIONE": "WARNING", "ERRORE": "ERROR", "FATALE": "FATAL", "PANICO": "PANIC"},
"ko": {"디버그": "DEBUG", "로그": "LOG", "정보": "INFO", "알림": "NOTICE", "경고": "WARNING", "오류": "ERROR", "치명적오류": "FATAL", "손상": "PANIC"},
"pl": {"DEBUG": "DEBUG", "DZIENNIK": "LOG", "INFORMACJA": "INFO", "UWAGA": "NOTICE", "OSTRZEŻENIE": "WARNING", "BŁĄD": "ERROR", "KATASTROFALNY": "FATAL", "PANIKA": "PANIC"},
"ru": {"ОТЛАДКА": "DEBUG", "СООБЩЕНИЕ": "LOG", "ИНФОРМАЦИЯ": "INFO", "ЗАМЕЧАНИЕ": "NOTICE", "ПРЕДУПРЕЖДЕНИЕ": "WARNING", "ОШИБКА": "ERROR", "ВАЖНО": "FATAL", "ПАНИКА": "PANIC"},
"sv": {"DEBUG": "DEBUG", "LOGG": "LOG", "INFO": "INFO", "NOTIS": "NOTICE", "VARNING": "WARNING", "FEL": "ERROR", "FATALT": "FATAL", "PANIK": "PANIC"},
"tr": {"DEBUG": "DEBUG", "LOG": "LOG", "BİLGİ": "INFO", "NOT": "NOTICE", "UYARI": "WARNING", "HATA": "ERROR", "ÖLÜMCÜL (FATAL)": "FATAL", "KRİTİK": "PANIC"},
"zh": {"调试": "DEBUG", "日志": "LOG", "信息": "INFO", "注意": "NOTICE", "警告": "WARNING", "错误": "ERROR", "致命错误": "FATAL", "比致命错误还过分的错误": "PANIC"},
}
Functions ¶
func GetDefaultBuiltInMetrics ¶
func GetDefaultBuiltInMetrics() []string
Types ¶
type CmdOpts ¶
type CmdOpts struct { Metrics string `` /* 132-byte string literal not displayed */ CreateHelpers bool `` /* 144-byte string literal not displayed */ DirectOSStats bool `` /* 177-byte string literal not displayed */ InstanceLevelCacheMaxSeconds int64 `` /* 302-byte string literal not displayed */ EmergencyPauseTriggerfile string `` /* 237-byte string literal not displayed */ }
CmdOpts specifies metric command-line options
type ExtensionInfo ¶
type ExtensionOverrides ¶
type ExtensionOverrides struct { TargetMetric string `yaml:"target_metric"` ExpectedExtensionVersions []ExtensionInfo `yaml:"expected_extension_versions"` }
type Measurement ¶
type MeasurementEnvelope ¶
type Measurements ¶
type Metric ¶
type Metric struct { SQLs SQLs InitSQL string `yaml:"init_sql,omitempty"` NodeStatus string `yaml:"node_status,omitempty"` Gauges []string `yaml:",omitempty"` IsInstanceLevel bool `yaml:"is_instance_level,omitempty"` StorageName string `yaml:"storage_name,omitempty"` Description string `yaml:"description,omitempty"` }
func (Metric) PrimaryOnly ¶
func (Metric) StandbyOnly ¶
type MetricAttrs ¶
type MetricAttrs struct { ExtensionVersionOverrides []ExtensionOverrides `yaml:"extension_version_based_overrides,omitempty"` IsPrivate bool `yaml:"is_private,omitempty"` // used only for extension overrides currently and ignored otherwise DisabledDays string `yaml:"disabled_days,omitempty"` // Cron style, 0 = Sunday. Ranges allowed: 0,2-4 DisableTimes []string `yaml:"disabled_times,omitempty"` // "11:00-13:00" StatementTimeoutSeconds int64 `yaml:"statement_timeout_seconds,omitempty"` // overrides per monitored DB settings }
type MetricDefs ¶
type Metrics ¶
type Metrics struct { MetricDefs MetricDefs `yaml:"metrics"` PresetDefs PresetDefs `yaml:"presets"` }
func GetDefaultMetrics ¶
func GetDefaultMetrics() (metrics *Metrics)
type PresetDefs ¶
type ReaderWriter ¶
func NewDefaultMetricReader ¶
func NewDefaultMetricReader(context.Context) (ReaderWriter, error)
NewDefaultMetricReader creates a new default metric reader with an empty path.
func NewPostgresMetricReaderWriter ¶
func NewPostgresMetricReaderWriter(ctx context.Context, connstr string) (ReaderWriter, error)
func NewPostgresMetricReaderWriterConn ¶
func NewPostgresMetricReaderWriterConn(ctx context.Context, conn db.PgxPoolIface) (ReaderWriter, error)
func NewYAMLMetricReaderWriter ¶
func NewYAMLMetricReaderWriter(ctx context.Context, path string) (ReaderWriter, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.