logic

package
v0.0.0-...-2af1199 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Namespace    = "push"
	InstanceName = "instance"
	JobName      = "job"

	TypeGauge   = "G"
	TypeCounter = "C"
)

Variables

This section is empty.

Functions

func NewExporterHandler

func NewExporterHandler(mgr *MetricMgr) http.HandlerFunc

///////////////////////////////////////////////////////////

func NewPushHandler

func NewPushHandler(mgr *MetricMgr) http.HandlerFunc

Types

type BuiltinMetrics

type BuiltinMetrics struct {
	Up prometheus.Gauge
}

func NewBuiltinMetrics

func NewBuiltinMetrics(hostName string) *BuiltinMetrics

type Counter

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

func (Counter) Desc

func (this Counter) Desc() *prometheus.Desc

func (*Counter) Set

func (this *Counter) Set(val float64)

func (Counter) Write

func (this Counter) Write(out *dto.Metric) error

type CounterVec

type CounterVec struct {
	*prometheus.MetricVec
}

func NewCounterVec

func NewCounterVec(name, help string, labelNames []string) *CounterVec

func (*CounterVec) GetMetricWithLabelValues

func (v *CounterVec) GetMetricWithLabelValues(lvs ...string) (Counter, error)

type Exporter

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

func NewExporter

func NewExporter(ctx context.Context, mgr *MetricMgr) *Exporter

func (*Exporter) Collect

func (this *Exporter) Collect(ch chan<- prometheus.Metric)

func (*Exporter) Describe

func (this *Exporter) Describe(ch chan<- *prometheus.Desc)

type MetricMgr

type MetricMgr struct {
	Builtin *BuiltinMetrics
	// contains filtered or unexported fields
}

func NewMetricMgr

func NewMetricMgr() *MetricMgr

func (*MetricMgr) AddMetric

func (this *MetricMgr) AddMetric(m *MetricValue, now int64)

func (*MetricMgr) CreateCounter

func (this *MetricMgr) CreateCounter(m *MetricValue) (Counter, error)

func (*MetricMgr) CreateGauge

func (this *MetricMgr) CreateGauge(m *MetricValue) (prometheus.Gauge, error)

func (*MetricMgr) GetMetrics

func (this *MetricMgr) GetMetrics() map[string]*MetricValue

type MetricValue

type MetricValue struct {
	Metric     string  `json:"metric"`
	Instance   string  `json:"endpoint"`
	Job        string  `json:"job"`
	Tags       string  `json:"tags"`
	Value      float64 `json:"value"`
	Type       string  `json:"type"`
	Step       int64   `json:"step"`
	ExpireTime int64   `json:"-"`
}

func (*MetricValue) GetLabels

func (this *MetricValue) GetLabels() ([]string, []string)

func (*MetricValue) IsCounter

func (this *MetricValue) IsCounter() bool

func (*MetricValue) IsValid

func (this *MetricValue) IsValid(now int64) bool

func (*MetricValue) Key

func (this *MetricValue) Key() string

func (*MetricValue) MetricKey

func (this *MetricValue) MetricKey(labelNames []string) string

func (*MetricValue) String

func (this *MetricValue) String() string

Jump to

Keyboard shortcuts

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