Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

prometheus

v0.1.8
resenje.org/logging/prometheus

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

11 matches

Top ↑

Types

Counter

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

Counter holds Prometheus counters.

NewCounter

func NewCounter(options *CounterOptions) (c *Counter)

NewCounter creates new Counter instance. Options value can be nil.

Counter.Metrics

func (c *Counter) Metrics() (cs []prometheus.Collector)

Metrics retuns all Prometheus metrics that should be registered.

CounterOptions

type CounterOptions struct {
	Namespace string
	Subsystem string
	Name      string
	Help      string
}

CounterOptions holds options for NewCounter constructor.

Handler

type Handler struct {
	Counter *Counter
	Level   logging.Level
}

Handler increments Prometheus counter metrics partitioned by log level.

NewHandler

func NewHandler(counter *Counter, level logging.Level) (h *Handler)

NewHandler returns new Handler instance.

Handler.Close

func (h *Handler) Close() error

Close does nothing for this handler.

Handler.GetLevel

func (h *Handler) GetLevel() logging.Level

GetLevel returns current level for this handler.

Handler.Handle

func (h *Handler) Handle(record *logging.Record) error

Handle increments Prometheus counter metrics based on record log level.

Handler.HandleError

func (h *Handler) HandleError(err error) error

HandleError does nothing for this handler.

Dependency graph