Versions in this module Expand all Collapse all v1 v1.0.1 Jul 10, 2020 v1.0.0 Jul 10, 2020 Changes in this version + const ConnectionsInUse + const DatabaseConnectionWaitDuration + const DatabaseOperationLatency + const IdleConnections + const NumberOfGoRoutines + const OpenConnections + const RequestInfo + const SUBSYSTEM + var Enum = &CounterType + var REQUEST_SUBSYSTEM = "Request" + var RUNTIME_SUBSYSTEM = "Runtime" + func EnableRunTimeMetrics() + func GenerateRandomString(n int) string + func GetSystemPrometheusRegistry() *prometheus.Registry + func Initialize(connSettings string) *gorm.DB + func RegisterCommonDatabaseCounters(serviceName string, db *gorm.DB, metricsExporter *MetricsExporter) + func RegisterCommonRequestCounters(serviceName string, metricsExporter *MetricsExporter) + func RegisterCommonRuntimeCounters(serviceName string, metricsExporter *MetricsExporter) + func RegisterInfraMetrics(options Options, metricsExporter *MetricsExporter) + func Setup() *gorm.DB + func SetupTests() *gorm.DB + type CounterAlias string + type CounterMetadata struct + CounterBuckets []float64 + CounterFunction func(db *gorm.DB) func() float64 + CounterHelpString string + CounterLabels []string + CounterName string + CounterNameSpace func(string) string + CounterSubSystem string + CounterType CounterAlias + type CounterOpts struct + Help string + Labels []string + Name string + Namespace string + Subsystem string + type CounterType struct + CounterVec CounterAlias + GaugeFunc CounterAlias + GaugeVec CounterAlias + HistogramVec CounterAlias + SummaryVec CounterAlias + type GaugeOpts struct + Help string + Labels []string + Name string + Namespace string + Subsystem string + type HistogramOpts struct + Buckets []float64 + Help string + Labels []string + Name string + Namespace string + Subsystem string + type MetricsExporter struct + FlushInterval time.Duration + ServiceName string + func (c *MetricsExporter) CounterAdd(name string, val float64, labels map[string]string) error + func (c *MetricsExporter) CreateCounter(opts CounterOpts) error + func (c *MetricsExporter) CreateGauge(opts GaugeOpts) error + func (c *MetricsExporter) CreateGaugeFunc(opts GaugeOpts, f func() float64) error + func (c *MetricsExporter) CreateHistogram(opts HistogramOpts) error + func (c *MetricsExporter) CreateSummary(opts SummaryOpts) error + func (c *MetricsExporter) GaugeSet(name string, val float64, labels map[string]string) error + func (c *MetricsExporter) HistogramObserve(name string, val float64, labels map[string]string) error + func (c *MetricsExporter) Monitor(next http.Handler) http.Handler + func (c *MetricsExporter) ObtainGaugeFunc(name string) (*prometheus.GaugeFunc, error) + func (c *MetricsExporter) SummaryObserve(name string, val float64, labels map[string]string) error + type NewRegistry func(opts Options) Registry + type Options struct + DbConn *gorm.DB + EnableGoRuntimeMetrics bool + FlushInterval time.Duration + ServiceName string + type Registry interface + CounterAdd func(name string, val float64, labels map[string]string) error + CreateCounter func(opts CounterOpts) error + CreateGauge func(opts GaugeOpts) error + CreateGaugeFunc func(opts GaugeOpts, f func() float64) error + CreateHistogram func(opts HistogramOpts) error + CreateSummary func(opts SummaryOpts) error + GaugeSet func(name string, val float64, labels map[string]string) error + HistogramObserve func(name string, val float64, labels map[string]string) error + Monitor func(next http.Handler) http.Handler + ObtainGaugeFunc func(name string) (*prometheus.GaugeFunc, error) + SummaryObserve func(name string, val float64, Labels map[string]string) error + func NewMetricsExporter(options Options) Registry + type SummaryOpts struct + Help string + Labels []string + Name string + Namespace string + Objectives map[float64]float64 + Subsystem string