Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLogHook ¶
func NewLogHook(cfg *Config) *logHook
func NewMetricHook ¶
Types ¶
type CompositeHook ¶
type Config ¶
type Config struct {
Host string `validate:"required" default:"localhost"`
Port string `validate:"required" default:"5432"`
User string `validate:"required" default:"postgres"`
Password string `validate:"required" default:"password"`
DBName string `validate:"required"`
SSLMode string `validate:"required" default:"disable"`
Settings Settings
Extra Extra
// for backward compatibility. Use Extra instead of these three fields.
LogQuery bool
AppName string
HookFunc func(query string, took int64, appName string)
}
type Extra ¶
type Extra struct {
LogQuery bool
HookFunc func(query string, took int64, appName string)
EnableMetrics bool `default:"true"`
Registry prometheus.Registerer
}
type PgSqlxStatsCollector ¶
type PgSqlxStatsCollector struct {
// contains filtered or unexported fields
}
PgSqlxStatsCollector is a Prometheus collector for sqlx metrics. It implements the prometheus.Collector interface.
func NewPgSqlxStatsCollector ¶
func NewPgSqlxStatsCollector(db *sqlx.DB, dbName string) *PgSqlxStatsCollector
NewPgSqlxStatsCollector returns a new sqlxCollector. The dbName parameter is used to set the "db" label on the metrics. The db parameter is the sqlx.DB to collect metrics from. The db parameter must not be nil. The dbName parameter must not be empty.
func (PgSqlxStatsCollector) Collect ¶
func (p PgSqlxStatsCollector) Collect(metrics chan<- prometheus.Metric)
Collect implements the prometheus.Collector interface.
func (PgSqlxStatsCollector) Describe ¶
func (p PgSqlxStatsCollector) Describe(descs chan<- *prometheus.Desc)
Describe implements the prometheus.Collector interface.
Click to show internal directories.
Click to hide internal directories.