prom

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: MIT Imports: 7 Imported by: 0

README

prom

prometheus client tools

Documentation

Index

Constants

View Source
const (
	GaugeType        = "gauge"
	GaugeVecType     = "gauge_vector"
	CounterType      = "counter"
	CounterVecType   = "counter_vector"
	HistogramType    = "histogram"
	HistogramVecType = "histogram_vector"
	SummaryType      = "summary"
	SummaryVecType   = "summary_vector"
)

Variables

View Source
var (
	RemindOpts = Opts{
		Namespace: "remind",
	}
	ErrorNotInit        = errors.New("please init prometheus registry first")
	ErrorParseConfig    = errors.New("prometheus parse config error ")
	ErrorInvalidConfig  = errors.New("incorrect prometheus config for key ")
	ErrorMetricNotFound = errors.New("prometheus metric not found for key ")
)

Functions

func InitRegistry

func InitRegistry(conf *PrometheusConfig)

Types

type ConfigDecoder

type ConfigDecoder interface {
	Decode(v interface{}) (err error)
}

type Counter

type Counter = prometheus.Counter

type CounterConfig

type CounterConfig struct {
	Opts OptsConfig `yaml:"opts"`
}

func (*CounterConfig) GetOpts

func (c *CounterConfig) GetOpts() *OptsConfig

type CounterOpts

type CounterOpts = prometheus.CounterOpts

type CounterVec

type CounterVec = prometheus.CounterVec

type CounterVecConfig

type CounterVecConfig struct {
	CounterConfig `yaml:",inline"`
	Labels        []string `yaml:"labels"`
}

func (*CounterVecConfig) GetLabels

func (c *CounterVecConfig) GetLabels() []string

type Gauge

type Gauge = prometheus.Gauge

type GaugeConfig

type GaugeConfig struct {
	Opts OptsConfig `yaml:"opts"`
}

func (*GaugeConfig) GetOpts

func (c *GaugeConfig) GetOpts() *OptsConfig

type GaugeOpts

type GaugeOpts = prometheus.GaugeOpts

type GaugeVec

type GaugeVec = prometheus.GaugeVec

type GaugeVecConfig

type GaugeVecConfig struct {
	GaugeConfig `yaml:",inline"`
	Labels      []string `yaml:"labels"`
}

func (*GaugeVecConfig) GetLabels

func (c *GaugeVecConfig) GetLabels() []string

type Histogram

type Histogram = prometheus.Histogram

type HistogramConfig

type HistogramConfig struct {
	Opts HistogramOptsConfig `yaml:"opts"`
}

func (*HistogramConfig) GetOpts

func (c *HistogramConfig) GetOpts() *HistogramOptsConfig

type HistogramOpts

type HistogramOpts = prometheus.HistogramOpts

type HistogramOptsConfig

type HistogramOptsConfig struct {
	OptsConfig `yaml:",inline"`
	Buckets    string `yaml:"buckets"`
}

func (*HistogramOptsConfig) GetBuckets

func (o *HistogramOptsConfig) GetBuckets() []float64

type HistogramVec

type HistogramVec = prometheus.HistogramVec

type HistogramVecConfig

type HistogramVecConfig struct {
	HistogramConfig `yaml:",inline"`
	Labels          []string `yaml:"labels"`
}

func (*HistogramVecConfig) GetLabels

func (c *HistogramVecConfig) GetLabels() []string

type Labels

type Labels = prometheus.Labels

type LazyCounter

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

func NewLazyCounter

func NewLazyCounter(name string) *LazyCounter

func (*LazyCounter) Get

func (c *LazyCounter) Get() (Counter, error)

type LazyCounterVec

type LazyCounterVec struct {
	Value *CounterVec
	// contains filtered or unexported fields
}

func NewLazyCounterVec

func NewLazyCounterVec(name string) *LazyCounterVec

func (*LazyCounterVec) Get

func (c *LazyCounterVec) Get() (*CounterVec, error)

type LazyGauge

type LazyGauge struct {
	Value Gauge
	// contains filtered or unexported fields
}

func NewLazyGauge

func NewLazyGauge(name string) *LazyGauge

func (*LazyGauge) Get

func (c *LazyGauge) Get() (Gauge, error)

type LazyGaugeVec

type LazyGaugeVec struct {
	Value *GaugeVec
	// contains filtered or unexported fields
}

func NewLazyGaugeVec

func NewLazyGaugeVec(name string) *LazyGaugeVec

func (*LazyGaugeVec) Get

func (c *LazyGaugeVec) Get() (*GaugeVec, error)

type LazyHistogram

type LazyHistogram struct {
	Value Histogram
	// contains filtered or unexported fields
}

func NewLazyHistogram

func NewLazyHistogram(name string) *LazyHistogram

func (*LazyHistogram) Get

func (c *LazyHistogram) Get() (Histogram, error)

type LazyHistogramVec

type LazyHistogramVec struct {
	Value *HistogramVec
	// contains filtered or unexported fields
}

func NewLazyHistogramVec

func NewLazyHistogramVec(name string) *LazyHistogramVec

func (*LazyHistogramVec) Get

func (c *LazyHistogramVec) Get() (*HistogramVec, error)

type LazySummary

type LazySummary struct {
	Value Histogram
	// contains filtered or unexported fields
}

func NewLazySummary

func NewLazySummary(name string) *LazySummary

func (*LazySummary) Get

func (c *LazySummary) Get() (Summary, error)

type LazySummaryVec

type LazySummaryVec struct {
	Value *SummaryVec
	// contains filtered or unexported fields
}

func NewLazySummaryVec

func NewLazySummaryVec(name string) *LazySummaryVec

func (*LazySummaryVec) Get

func (c *LazySummaryVec) Get() (*SummaryVec, error)

type Metric

type Metric struct {
	Type string   `yaml:"type"`
	Key  string   `yaml:"key"`
	Spec YamlNode `yaml:"spec"`
}

func (*Metric) GetKey

func (m *Metric) GetKey() string

func (*Metric) GetSpec

func (m *Metric) GetSpec() *YamlNode

func (*Metric) GetType

func (m *Metric) GetType() string

type Opts

type Opts = prometheus.Opts

type OptsConfig

type OptsConfig struct {
	Namespace string `yaml:"namespace"`
	Subsystem string `yaml:"subsystem"`
	Name      string `yaml:"name"`

	Help string `yaml:"help"`
}

func (*OptsConfig) GetHelp

func (o *OptsConfig) GetHelp() string

func (*OptsConfig) GetName

func (o *OptsConfig) GetName() string

func (*OptsConfig) GetNamespace

func (o *OptsConfig) GetNamespace() string

func (*OptsConfig) GetSubsystem

func (o *OptsConfig) GetSubsystem() string

type PrometheusConfig

type PrometheusConfig struct {
	Path    string   `yaml:"path"`
	Listen  string   `yaml:"listen"`
	Metrics []Metric `yaml:"metrics"`
}

func (*PrometheusConfig) GetListen

func (c *PrometheusConfig) GetListen() string

func (*PrometheusConfig) GetPath

func (c *PrometheusConfig) GetPath() string

type Registry

type Registry struct {
	ConfigMap map[string]Metric
	// contains filtered or unexported fields
}

func GetRegistry

func GetRegistry() *Registry

func NewRegistry

func NewRegistry(conf *PrometheusConfig) *Registry

func (*Registry) GetCounter

func (r *Registry) GetCounter(name string) Counter

func (*Registry) GetCounterVec

func (r *Registry) GetCounterVec(name string) *CounterVec

func (*Registry) GetGauge

func (r *Registry) GetGauge(name string) Gauge

func (*Registry) GetGaugeVec

func (r *Registry) GetGaugeVec(name string) *GaugeVec

func (*Registry) GetHistogram

func (r *Registry) GetHistogram(name string) Histogram

func (*Registry) GetHistogramVec

func (r *Registry) GetHistogramVec(name string) *HistogramVec

func (*Registry) GetSummary

func (r *Registry) GetSummary(name string) Summary

func (*Registry) GetSummaryVec

func (r *Registry) GetSummaryVec(name string) *SummaryVec

type Summary

type Summary = prometheus.Summary

type SummaryConfig

type SummaryConfig struct {
	Opts SummaryOptsConfig `yaml:"opts"`
}

func (*SummaryConfig) GetOpts

func (c *SummaryConfig) GetOpts() *SummaryOptsConfig

type SummaryOpts

type SummaryOpts = prometheus.SummaryOpts

type SummaryOptsConfig

type SummaryOptsConfig struct {
	OptsConfig `yaml:",inline"`
	Objectives string `yaml:"objectives"`
	MaxAge     int    `yaml:"max_age"`
	AgeBuckets uint32 `yaml:"age_buckets"`
	BufCap     uint32 `yaml:"buf_cap"`
}

func (*SummaryOptsConfig) GetAgeBuckets

func (o *SummaryOptsConfig) GetAgeBuckets() uint32

func (*SummaryOptsConfig) GetBufCap

func (o *SummaryOptsConfig) GetBufCap() uint32

func (*SummaryOptsConfig) GetMaxAge

func (o *SummaryOptsConfig) GetMaxAge() time.Duration

func (*SummaryOptsConfig) GetObjectives

func (o *SummaryOptsConfig) GetObjectives() map[float64]float64

type SummaryVec

type SummaryVec = prometheus.SummaryVec

type SummaryVecConfig

type SummaryVecConfig struct {
	SummaryConfig `yaml:",inline"`
	Labels        []string `yaml:"labels"`
}

func (*SummaryVecConfig) GetLabels

func (c *SummaryVecConfig) GetLabels() []string

type Timer

type Timer = prometheus.Timer

type YamlNode

type YamlNode = yaml.Node

Jump to

Keyboard shortcuts

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