stats

package
v0.4.4-0...-3150d41 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package stats implements a Prometheus Collector for LMDBs

Package stats implements a Prometheus Collector for LMDBs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Log

func Log(env *lmdb.Env, dbnames []string, withSmaps bool, log logrus.FieldLogger)

Log logs all LMDB statistics once using logrus If dbnames is nil, all databases are logged.

func PageUsageBytes

func PageUsageBytes(s *lmdb.Stat) uint64

PageUsageBytes estimates bytes of map size used based on used pages

Types

type Collector

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

Collector implements an LMDB stats collector for Prometheus. It must be registered with Prometheus before it actually works. It can only be registered once!

func NewCollector

func NewCollector(withSmaps bool) *Collector

NewCollector creates a new Collector. 'withSmaps' indicates if we need to collect /proc/self/smaps if available (Linux). Note that smaps collection could potentially be expensive.

func (*Collector) AddTarget

func (c *Collector) AddTarget(name string, dbnames []string, env *lmdb.Env)

func (*Collector) Collect

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

Collect is part of the prometheus.Collect interface. It fetches statistics from LMDB.

func (*Collector) Describe

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

Describe is part of the prometheus.Collect interface

func (*Collector) EnableSmaps

func (c *Collector) EnableSmaps(enabled bool)

type Target

type Target struct {
	Name    string
	DBNames []string
	Env     *lmdb.Env
}

Jump to

Keyboard shortcuts

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