Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColumnMapping ¶
type ColumnMapping struct {
// contains filtered or unexported fields
}
ColumnMapping is the user-friendly representation of a prometheus descriptor map
func (*ColumnMapping) UnmarshalYAML ¶
func (cm *ColumnMapping) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements yaml.Unmarshaller
type ColumnUsage ¶
type ColumnUsage int
ColumnUsage should be one of several enum values which describe how a queried row is to be converted to a Prometheus metric.
const ( // DISCARD ignores a column DISCARD ColumnUsage = iota // LABEL identifies a column as a label LABEL ColumnUsage = iota // COUNTER identifies a column as a counter COUNTER ColumnUsage = iota // GAUGE identifies a column as a gauge GAUGE ColumnUsage = iota // MAPPEDMETRIC identifies a column as a mapping of text values MAPPEDMETRIC ColumnUsage = iota // DURATION identifies a column as a text duration (and converted to milliseconds) DURATION ColumnUsage = iota // HISTOGRAM identifies a column as a histogram HISTOGRAM ColumnUsage = iota )
func (*ColumnUsage) UnmarshalYAML ¶
func (cu *ColumnUsage) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaller interface.
type Config ¶
type Config struct { BaseDir string `toml:"-"` Username string `toml:"username"` Password string `toml:"password"` Options map[string]string `toml:"options"` DisableDefaultMetrics bool `toml:"disable_default_metrics"` DisableSettingsMetrics bool `toml:"disable_settings_metrics"` EnabledCollectors []string `toml:"enabled_collectors"` }
type ErrorConnectToServer ¶
type ErrorConnectToServer struct {
Msg string
}
ErrorConnectToServer is a connection to PgSQL server error
func (*ErrorConnectToServer) Error ¶
func (e *ErrorConnectToServer) Error() string
Error returns error
type Exporter ¶
type Exporter struct {
// contains filtered or unexported fields
}
Exporter collects Postgres metrics. It implements prometheus.Collector.
func NewExporter ¶
func NewExporter(dsn []string, opts ...ExporterOpt) *Exporter
NewExporter returns a new PostgreSQL exporter for the provided DSN.
func (*Exporter) Collect ¶
func (e *Exporter) Collect(ch chan<- prometheus.Metric)
Collect implements prometheus.Collector.
func (*Exporter) Describe ¶
func (e *Exporter) Describe(ch chan<- *prometheus.Desc)
Describe implements prometheus.Collector.
type ExporterOpt ¶
type ExporterOpt func(*Exporter)
ExporterOpt configures Exporter.
func DisableDefaultMetrics ¶
func DisableDefaultMetrics(b bool) ExporterOpt
DisableDefaultMetrics configures default metrics export.
func DisableSettingsMetrics ¶
func DisableSettingsMetrics(b bool) ExporterOpt
DisableSettingsMetrics configures pg_settings export.
func WithNamespace ¶
func WithNamespace(namespace string) ExporterOpt
type MappingOptions ¶
type MappingOptions struct { Usage string `yaml:"usage"` Description string `yaml:"description"` Mapping map[string]float64 `yaml:"metric_mapping"` // Optional column mapping for MAPPEDMETRIC SupportedVersions semver.Range `yaml:"pg_version"` // Semantic version ranges which are supported. Unsupported columns are not queried (internally converted to DISCARD). }
MappingOptions is a copy of ColumnMapping used only for parsing
type MetricMap ¶
type MetricMap struct {
// contains filtered or unexported fields
}
MetricMap stores the prometheus metric description which a given column will be mapped to by the collector
type MetricMapNamespace ¶
type MetricMapNamespace struct {
// contains filtered or unexported fields
}
MetricMapNamespace groups metric maps under a shared set of labels.
type OverrideQuery ¶
type OverrideQuery struct {
// contains filtered or unexported fields
}
OverrideQuery 's are run in-place of simple namespace look ups, and provide advanced functionality. But they have a tendency to postgres version specific. There aren't too many versions, so we simply store customized versions using the semver matching we do for columns.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server describes a connection to Postgres. Also it contains metrics map and query overrides.
func (*Server) Ping ¶
Ping checks connection availability and possibly invalidates the connection if it fails.
type ServerOpt ¶
type ServerOpt func(*Server)
ServerOpt configures a server.
func ServerWithLabels ¶
func ServerWithLabels(labels prometheus.Labels) ServerOpt
ServerWithLabels configures a set of labels.
type Servers ¶
type Servers struct {
// contains filtered or unexported fields
}
Servers contains a collection of servers to Postgres.
func NewServers ¶
NewServers creates a collection of servers to Postgres.
type UserQueries ¶
UserQueries represents a set of UserQuery objects
type UserQuery ¶
type UserQuery struct { Query string `yaml:"query"` Metrics []Mapping `yaml:"metrics"` Master bool `yaml:"master"` // Querying only for master database CacheSeconds uint64 `yaml:"cache_seconds"` // Number of seconds to cache the namespace result metrics for. RunOnServer string `yaml:"runonserver"` // Querying to run on which server version }
UserQuery represents a user defined query