prometheus

package
v1.9.20 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultSlowTime = int32(5)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BloomFilter

type BloomFilter interface {
	Add(value string)
	Contains(value string) bool
}

func NewBloomFilter

func NewBloomFilter() BloomFilter

type FuncCollect

type FuncCollect func(m Metrics, c *gin.Context, start time.Time)

type MetricType

type MetricType int
const (
	None MetricType = iota
	Counter
	Gauge
	Histogram
	Summary
)

func (MetricType) Register

func (m MetricType) Register(metric *metrics) error

type Metrics

type Metrics interface {
	SetGaugeValue(labelValues []string, value float64) error
	Inc(labelValues []string) error
	Add(labelValues []string, value float64) error
	Observe(labelValues []string, value float64) error

	Collect(c *gin.Context, start time.Time)

	GetName() string
	GetType() MetricType
	SetDesc(desc string)

	AddLabel(label ...string)
	AddBuckets(bucket ...float64)
	AddObjective(key, value float64)
	SetCollect(fct FuncCollect)
}

func NewMetrics

func NewMetrics(name string, metricType MetricType) Metrics

type Prometheus

type Prometheus interface {
	Expose(c *gin.Context)
	MiddleWare(c *gin.Context)
	CollectMetrics(c *gin.Context, start time.Time)

	ExcludePath(startWith ...string)

	GetMetric(name string) *metrics
	SetMetric(metric Metrics) error
	AddMetric(metric Metrics) error
	ListMetric() []string

	SetSlowTime(slowTime int32)
	GetSlowTime() int32

	SetDuration(duration []float64)
	GetDuration() []float64
}

func New

func New() Prometheus

New will return a new object that implement interface GinPrometheus.

Jump to

Keyboard shortcuts

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