gotoprom: github.com/cabify/gotoprom Index | Files | Directories

package gotoprom

import "github.com/cabify/gotoprom"

Package gotoprom provides a wrapper to register and use prometheus metrics.

Index

Package Files

default.go doc.go init.go

Variables

var DefaultInitializer = NewInitializer(prometheus.DefaultRegisterer)

DefaultInitializer is the instance instance of the Initializer used by default

func AddBuilder Uses

func AddBuilder(typ reflect.Type, registerer Builder) error

AddBuilder adds a new registerer for type typ.

func Init Uses

func Init(metrics interface{}, namespace string) error

Init initializes the metrics in the given namespace.

func MustAddBuilder Uses

func MustAddBuilder(typ reflect.Type, registerer Builder)

MustAddBuilder will AddBuilder and panic if an error occurs

func MustInit Uses

func MustInit(metrics interface{}, namespace string)

MustInit initializes the metrics or panics.

type Builder Uses

type Builder func(
    name, help, namespace string,
    labelNames []string,
    tag reflect.StructTag,
) (func(prometheus.Labels) interface{}, prometheus.Collector, error)

Builder is a function that registers a metric and provides a function that creates the metric reporter for given values Note that the type of the first return value of a Builder should be (in Java words): func() interface{} implements <typ>

type Initializer Uses

type Initializer interface {
    // MustAddBuilder will AddBuilder and panic if an error occurs
    MustAddBuilder(typ reflect.Type, registerer Builder)
    // AddBuilder adds a new registerer for type typ.
    // Note that the type of the first return value of Builder should be (in Java words):
    // func() interface{} implements <typ>
    AddBuilder(typ reflect.Type, registerer Builder) error

    // MustInit initializes the metrics or panics.
    MustInit(metrics interface{}, namespace string)

    // Init initializes the metrics in the given namespace.
    Init(metrics interface{}, namespace string) error
}

Initializer represents an instance of the initializing functionality

func NewInitializer Uses

func NewInitializer(registerer prometheus.Registerer) Initializer

NewInitializer creates a new Initializer for the prometheus.Registerer provided

Directories

PathSynopsis
prometheusvanilla

Package gotoprom imports 6 packages (graph). Updated 2020-01-29. Refresh now. Tools for package owners.