Documentation ¶
Overview ¶
Package gormetrics provides an easy-to-use plugin for GORM which collects metrics about queries (namely status).
Index ¶
Constants ¶
const ErrDbIsNil gormetricsErr = "db is nil"
ErrDbIsNil is the error generated by gormetrics if an error occurs when creating a gormetrics plugin instance with a nil plugin.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
func Register(db *gorm.DB, dbName string, opts ...RegisterOpt) error
Register gormetrics. Options (opts) can be used to configure the Prometheus namespace and GORM plugin scope.
func RegisterInterface ¶
func RegisterInterface(db gormi.DB, dbName string, opts ...RegisterOpt) error
RegisterInterface registers gormetrics with a gormi.DB interface, which can be created using one of the adapters in gormi/adapter. This can be useful if you use a forked version of GORM. Options (opts) can be used to configure the Prometheus namespace and GORM plugin scope.
Types ¶
type RegisterOpt ¶
type RegisterOpt func(o *pluginOpts)
RegisterOpt if a function that operates on pluginOpts, configuring one or more parameters of the plugin options.
func WithGORMPluginScope ¶
func WithGORMPluginScope(s string) RegisterOpt
WithGORMPluginScope sets a different plugin scope for the configured callbacks. The default plugin scope is "gormetrics".
func WithPrometheusNamespace ¶
func WithPrometheusNamespace(ns string) RegisterOpt
WithPrometheusNamespace sets a different namespace for the exported metrics. The default namespace is "gormetrics".
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package gormi provides interface so forks of gorm can be used to work with gormetrics.
|
Package gormi provides interface so forks of gorm can be used to work with gormetrics. |