Versions in this module Expand all Collapse all v0 v0.6.1 Jan 26, 2024 v0.6.0 Oct 18, 2023 Changes in this version + var Logger log.Logger v0.5.0 May 13, 2022 v0.4.1 Mar 8, 2022 Changes in this version + const COUNTER + const DISCARD + const GAUGE + const HISTOGRAM + const LABEL + var ColumnUsage = map[string]bool + var Version = "0.4.1" + func DryRun() + func DummyServer() (s *http.Server, exit <-chan bool) + func GetConfig() (res string) + func GetPGURL() string + func LoadConfig(configPath string) (queries map[string]*Query, err error) + func ParseArgs() + func ParseConfig(content []byte) (queries map[string]*Query, err error) + func ParseDatname(pgurl string) string + func ParseSemver(semverStr string) int + func PgbouncerPrecheck(s *Server) (err error) + func PostgresPrecheck(s *Server) (err error) + func ProcessPGURL(pgurl string) string + func Reload() error + func ReloadFunc(w http.ResponseWriter, r *http.Request) + func ReplaceDatname(pgurl, datname string) string + func RetrievePGURL() (res string) + func Run() + func ShadowPGURL(pgurl string) string + func TitleFunc(w http.ResponseWriter, r *http.Request) + func VersionFunc(w http.ResponseWriter, r *http.Request) + type Collector struct + Server *Server + func NewCollector(q *Query, s *Server) *Collector + func (q *Collector) CacheHit() bool + func (q *Collector) Collect(ch chan<- prometheus.Metric) + func (q *Collector) Describe(ch chan<- *prometheus.Desc) + func (q *Collector) Duration() float64 + func (q *Collector) Error() error + func (q *Collector) ResultSize() int + type Column struct + Bucket []float64 + Default string + Desc string + Name string + Rename string + Scale float64 + Usage string + func (c *Column) MetricDesc(prefix string, labels []string) *MetricDesc + func (c *Column) PrometheusValueType() prometheus.ValueType + func (c *Column) String() string + type Exporter struct + var PgExporter *Exporter + var ReloadLock sync.Mutex + func NewExporter(dsn string, opts ...ExporterOpt) (e *Exporter, err error) + func (e *Exporter) Check() + func (e *Exporter) Close() + func (e *Exporter) Collect(ch chan<- prometheus.Metric) + func (e *Exporter) CreateServer(dbname string) + func (e *Exporter) Describe(ch chan<- *prometheus.Desc) + func (e *Exporter) Explain() string + func (e *Exporter) ExplainFunc(w http.ResponseWriter, r *http.Request) + func (e *Exporter) IterateServer() (res []*Server) + func (e *Exporter) OnDatabaseChange(change map[string]bool) + func (e *Exporter) PrimaryCheckFunc(w http.ResponseWriter, r *http.Request) + func (e *Exporter) Recovery() bool + func (e *Exporter) RemoveServer(dbname string) + func (e *Exporter) ReplicaCheckFunc(w http.ResponseWriter, r *http.Request) + func (e *Exporter) Stat() string + func (e *Exporter) StatFunc(w http.ResponseWriter, r *http.Request) + func (e *Exporter) Status() string + func (e *Exporter) Up() bool + func (e *Exporter) UpCheckFunc(w http.ResponseWriter, r *http.Request) + type ExporterOpt func(*Exporter) + func WithAutoDiscovery(flag bool) ExporterOpt + func WithCacheDisabled(disableCache bool) ExporterOpt + func WithConfig(configPath string) ExporterOpt + func WithConnectTimeout(timeout int) ExporterOpt + func WithConstLabels(s string) ExporterOpt + func WithExcludeDatabase(excludeStr string) ExporterOpt + func WithFailFast(failFast bool) ExporterOpt + func WithIncludeDatabase(includeStr string) ExporterOpt + func WithIntroDisabled(disableIntro bool) ExporterOpt + func WithNamespace(namespace string) ExporterOpt + func WithTags(tags string) ExporterOpt + type MetricDesc struct + Column *Column + Labels []string + Name string + func (m *MetricDesc) String() string + type Query struct + Branch string + ColumnNames []string + Columns map[string]*Column + Desc string + Fatal bool + LabelNames []string + MaxVersion int + MetricNames []string + Metrics []map[string]*Column + MinVersion int + Name string + Path string + Priority int + SQL string + Skip bool + TTL float64 + Tags []string + Timeout float64 + func ParseQuery(config string) (*Query, error) + func (q *Query) ColumnList() (res []*Column) + func (q *Query) Explain() string + func (q *Query) HTML() string + func (q *Query) HasTag(tag string) bool + func (q *Query) LabelList() []string + func (q *Query) MarshalYAML() string + func (q *Query) MetricList() (res []*MetricDesc) + func (q *Query) TemplateSQL() string + func (q *Query) TimeoutDuration() time.Duration + type Server struct + Collectors []*Collector + ConnMaxLifetime int + ConnectTimeout int + Database string + Databases map[string]bool + DisableCache bool + ExcludeDbnames []string + Extensions map[string]bool + Forked bool + Namespaces map[string]bool + PgbouncerMode bool + Planned bool + Recovery bool + Tags []string + UP bool + Username string + Version int + func NewServer(dsn string, opts ...ServerOpt) *Server + func (s *Server) Check() error + func (s *Server) Collect(ch chan<- prometheus.Metric) + func (s *Server) Compatible(query *Query) (res bool, reason string) + func (s *Server) Describe(ch chan<- *prometheus.Desc) + func (s *Server) Duration() float64 + func (s *Server) Error() error + func (s *Server) Explain() string + func (s *Server) ExplainHTML() string + func (s *Server) GetConnectTimeout() time.Duration + func (s *Server) HasTag(tag string) bool + func (s *Server) Name() string + func (s *Server) Plan(queries ...*Query) + func (s *Server) ResetStats() + func (s *Server) Stat() string + func (s *Server) Uptime() float64 + type ServerOpt func(*Server) + func WithCachePolicy(disableCache bool) ServerOpt + func WithConstLabel(labels prometheus.Labels) ServerOpt + func WithQueries(queries map[string]*Query) ServerOpt + func WithServerConnectTimeout(timeout int) ServerOpt + func WithServerTags(tags []string) ServerOpt