prome

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: AGPL-3.0 Imports: 13 Imported by: 4

Documentation

Index

Constants

View Source
const (
	StatusUnset int8 = iota
	StatusOK
	StatusERR
	StatusMISS
	StatusMax
)
View Source
const (
	MetricsChannelBuff        = 30000
	MetricsCollectInterval    = 30
	MetricsGatherDBBuffSize   = 300
	MetricsCostBucketSize     = 100
	MetricsCostBucketMaxValue = 200
)

Variables

View Source
var GlobalmetricsIns = &MetricsInstance{
	make(map[string][StatusMax]*MetricsGather),
	make(chan *MetricsItem, MetricsChannelBuff),
	time.Now().UnixNano(),
	time.Now().UnixNano(),
	make([]MetricsInfo, 0, 0),
}

Functions

This section is empty.

Types

type Exporter

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

func NewExporter

func NewExporter(namespace string) *Exporter

func (*Exporter) Close

func (exporter *Exporter) Close()

func (*Exporter) Collect

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

Implements prometheus.Collector.

func (*Exporter) Describe

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

Implements prometheus.Collector.

func (*Exporter) Start

func (exporter *Exporter) Start(port int) error

type MapFI added in v0.0.18

type MapFI map[float64]uint64

func (MapFI) MarshalJSON added in v0.0.18

func (mi MapFI) MarshalJSON() ([]byte, error)

type MetricsGather

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

type MetricsInfo

type MetricsInfo struct {
	Name       string  `json:"name"`
	Status     string  `json:"status"`
	QPS        float32 `json:"qps"`
	Total      int     `json:"total"`
	AvgCost    float64 `json:"avg_cost"`
	P90Cost    float64 `json:"p90_cost"`
	P95Cost    float64 `json:"p95_cost"`
	P99Cost    float64 `json:"p99_cost"`
	MaxCost    float64 `json:"max_cost"`
	AvgCounter float32 `json:"avg_counter"`
	Counter    float32 `json:"counter"`
	CostBucket MapFI   `json:"cost_bucket"`
}

func (*MetricsInfo) String

func (info *MetricsInfo) String() string

type MetricsInstance

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

func (*MetricsInstance) AddItem

func (mInstance *MetricsInstance) AddItem(mi *MetricsItem)

func (*MetricsInstance) GetMetricsInfo

func (mInstance *MetricsInstance) GetMetricsInfo() []MetricsInfo

func (*MetricsInstance) Push added in v0.0.19

func (mInstance *MetricsInstance) Push(mi *MetricsItem)

type MetricsItem

type MetricsItem struct {
	Name     string
	Counter  int
	CostTime int64
	Status   int8
	// contains filtered or unexported fields
}

func NewCounterStat

func NewCounterStat(name string, counter int) *MetricsItem

func NewStat

func NewStat(name string) *MetricsItem

func (*MetricsItem) End

func (mi *MetricsItem) End()

func (*MetricsItem) MarkErr

func (mi *MetricsItem) MarkErr() *MetricsItem

func (*MetricsItem) MarkMiss added in v0.0.18

func (mi *MetricsItem) MarkMiss() *MetricsItem

func (*MetricsItem) MarkOk

func (mi *MetricsItem) MarkOk() *MetricsItem

func (*MetricsItem) SampleRate

func (mi *MetricsItem) SampleRate(rate float32) *MetricsItem

func (*MetricsItem) SetCounter

func (mi *MetricsItem) SetCounter(counter int) *MetricsItem

type ServerExporter

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

func NewServerExporter

func NewServerExporter(namespace string) *ServerExporter

func (*ServerExporter) Describe

func (serverE *ServerExporter) Describe(ch chan<- *prometheus.Desc)

Jump to

Keyboard shortcuts

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