Documentation
¶
Index ¶
- Constants
- Variables
- func InstanceName() string
- func RegisterCalculator(c Calculator)
- func RegisterReporter(name string, r Reporter)
- func Report()
- func ToLabelNames(structure interface{}) []string
- func ToRawData(result interface{}, labels []*dto.LabelPair)
- type Calculator
- type CommonCalculator
- type Details
- type Metrics
- type MetricsGatherer
- type Reporter
Constants ¶
View Source
const (
FamilyName = "service_center"
)
Variables ¶
View Source
var ( // Period is metrics collect period Period = 30 * time.Second // SysMetrics map SysMetrics util.ConcurrentMap )
View Source
var Pxx = map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}
Pxx represents p99 p90 p50
Functions ¶
func InstanceName ¶
func InstanceName() string
func RegisterCalculator ¶
func RegisterCalculator(c Calculator)
func RegisterReporter ¶
func ToLabelNames ¶
func ToLabelNames(structure interface{}) []string
ToLabelNames returns label names, count is special label of v of func ForEach
Types ¶
type Calculator ¶
type Calculator interface {
Calc(mf *dto.MetricFamily) *Details
}
Calculator is the interface to implement customize algorithm of MetricFamily
var (
DefaultCalculator Calculator = &CommonCalculator{}
)
type CommonCalculator ¶
type CommonCalculator struct { }
func (*CommonCalculator) Calc ¶
func (c *CommonCalculator) Calc(mf *dto.MetricFamily) *Details
Get value of metricFamily
type Details ¶
type Details struct { // Summary is the calculation results of the details Summary float64 // contains filtered or unexported fields }
Details is the struct to hold the calculated result and index by metric label
func Calculate ¶
func Calculate(mf *dto.MetricFamily) *Details
func NewDetails ¶
func NewDetails() *Details
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics is the struct to hold the Details objects store and index by metric name
func NewMetrics ¶
func NewMetrics() *Metrics
type MetricsGatherer ¶
type MetricsGatherer struct { Records *Metrics // contains filtered or unexported fields }
var Gatherer *MetricsGatherer
Gatherer is the reader of sc metrics
func NewGatherer ¶
func NewGatherer() *MetricsGatherer
func (*MetricsGatherer) Collect ¶
func (mm *MetricsGatherer) Collect() error
func (*MetricsGatherer) Start ¶
func (mm *MetricsGatherer) Start()
Click to show internal directories.
Click to hide internal directories.