sqlmetrics

package
v2.18.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2021 License: AGPL-3.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sqlmetrics provides Prometheus metrics for database/sql.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector struct {
	// contains filtered or unexported fields
}

Collector is a prometheus.Collector that exposes *sql.DB metrics.

func NewCollector

func NewCollector(driver, dbName string, db *sql.DB) *Collector

NewCollector creates a new collector.

func (*Collector) Collect

func (c *Collector) Collect(ch chan<- prom.Metric)

func (*Collector) Describe

func (c *Collector) Describe(ch chan<- *prom.Desc)

type Reform

type Reform struct {
	// contains filtered or unexported fields
}

Reform is a SQL logger with metrics.

func NewReform

func NewReform(driver, dbName string, printf reform.Printf) *Reform

NewReform creates a new logger with given parameters.

func (*Reform) After

func (r *Reform) After(query string, args []interface{}, d time.Duration, err error)

After implements reform.Logger.

func (*Reform) Before

func (r *Reform) Before(query string, args []interface{})

Before implements reform.Logger.

func (*Reform) Collect

func (r *Reform) Collect(ch chan<- prom.Metric)

Collect implements prom.Collector.

func (*Reform) Describe

func (r *Reform) Describe(ch chan<- *prom.Desc)

Describe implements prom.Collector.

func (*Reform) Requests

func (r *Reform) Requests() int

Requests returns a total number of queries started.

func (*Reform) Reset

func (r *Reform) Reset()

Reset sets all metrics to 0.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL