Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Metrics ¶
type Metrics struct { //上报的属性名/prometheus类型 RECEIVE_REQUEST_RATE m.Gauge //目前只支持Counter ,Gauge功能还未实现 RECEIVE_REQUEST_TOTAL m.Counter `pml:"label1,label2;"` //有两个标签,label1,label2 DEAL_REQUEST_SUCC_TOTAL m.Counter DEAL_REQUEST_FAIL_TOTAL m.Counter }
var M Metrics
type PromMetrics ¶
type PromMetrics struct { //上报的属性名/prometheus类型/反射 EXAMPLE_TOTAL prometheus.CounterVec `pml:";label1,label2;namespace;subsystem;example(help msg)"` //name is example_total ExampleTotal prometheus.CounterVec `pml:"example_test_total;label1,label2;namespace;subsystem;example(help msg)"` //name is example_test_total RECEIVE_REQUEST_RATE prometheus.GaugeVec //目前只支持Counter ,Gauge功能还未实现 RECEIVE_REQUEST_TOTAL prometheus.CounterVec `pml:";label1,label2;namespace"` //有两个标签,label1,label2 DEAL_REQUEST_SUCC_TOTAL prometheus.CounterVec `pml:";;;subsystem"` DEAL_REQUEST_FAIL_TOTAL prometheus.CounterVec HISTOGRAM_TEST prometheus.Histogram `pml:";;;;1.1,2,3,4;help"` //buckets []float64{1.1,2,3,4} HISTOGRAM_VEC_TEST prometheus.HistogramVec `pml:";label;;;1.1,2,3,4;help"` //label, buckets []float64{1.1,2,3,4} SUMMARY_TEST prometheus.Summary `pml:";;;;0.5:0.05,0.9:0.01,0.99:0.001;"` // SUMMARY_VEC_TEST prometheus.SummaryVec `pml:";label;;;0.5:0.05,0.9:0.01,0.99:0.001;5;4;400;help msg"` //label //TODO: add your metrics RECV_TEST_TOTAL prometheus.Counter `pml:";;;;just for test"` }
另一种实现方式,不过不能进行功能扩展,例如公共的labels需要额外处理 不过可以直接用prometheus的metric类型带来的全部能力
var PM PromMetrics
Click to show internal directories.
Click to hide internal directories.