Documentation ¶
Index ¶
- Constants
- func NewCounter() gometrics.Counter
- func NewGauge() gometrics.Gauge
- func NewHistogram(reservoirSize int) gometrics.Histogram
- func NewMeter() gometrics.Meter
- func NewUniformSample(reservoirSize int) gometrics.Sample
- func Register(name string, metric interface{}) error
- type DrcMetric
- type FalconPublisher
- type FalconPublisherConfig
- type FilePublisher
- type FilePublisherConfig
- type Publisher
- type Reporter
- type ReporterConfig
- type UniformSample
- func (s *UniformSample) Clear()
- func (s *UniformSample) Count() int64
- func (s *UniformSample) Max() int64
- func (s *UniformSample) Mean() float64
- func (s *UniformSample) Min() int64
- func (s *UniformSample) Percentile(p float64) float64
- func (s *UniformSample) Percentiles(ps []float64) []float64
- func (s *UniformSample) Size() int
- func (s *UniformSample) Snapshot() gometrics.Sample
- func (s *UniformSample) StdDev() float64
- func (s *UniformSample) Sum() int64
- func (s *UniformSample) Update(v int64)
- func (s *UniformSample) Values() []int64
- func (s *UniformSample) Variance() float64
Constants ¶
const ( PublishType_File = "file" PublishType_Falcon = "falcon" )
Variables ¶
This section is empty.
Functions ¶
func NewCounter ¶
func NewHistogram ¶
func NewUniformSample ¶
NewUniformSample constructs a new uniform sample with the given reservoir size.
Types ¶
type DrcMetric ¶
type DrcMetric struct { Owner string `json:"owner"` HostName string `json:"hostname"` Metric string `json:"metric"` Endpoint string `json:"endpoint"` Timestamp int64 `json:"timestamp"` Value int64 `json:"value"` // 上报间隔 Interval int `json:"interval"` }
Metric的数据格式
type FalconPublisher ¶
type FalconPublisher struct {
// contains filtered or unexported fields
}
FalconPublisher用于将metric写入到falcon
func NewFalconPublisher ¶
func NewFalconPublisher(cfg FalconPublisherConfig) (*FalconPublisher, error)
func (*FalconPublisher) Close ¶
func (o *FalconPublisher) Close() error
func (*FalconPublisher) Publish ¶
func (o *FalconPublisher) Publish(drcMetrics []*DrcMetric) error
type FalconPublisherConfig ¶
type FilePublisher ¶
type FilePublisher struct {
// contains filtered or unexported fields
}
FilePublisher用于将metric写入本地文件
func NewFilePublisher ¶
func NewFilePublisher(cfg FilePublisherConfig) (*FilePublisher, error)
func (*FilePublisher) Close ¶
func (o *FilePublisher) Close() error
func (*FilePublisher) Publish ¶
func (o *FilePublisher) Publish(drcMetrics []*DrcMetric) error
type FilePublisherConfig ¶
type Reporter ¶
type Reporter struct {
// contains filtered or unexported fields
}
func NewReporter ¶
func NewReporter(config *ReporterConfig) *Reporter
func (*Reporter) NewDrcMetric ¶
func (*Reporter) QuitNotify ¶
func (o *Reporter) QuitNotify() <-chan struct{}
type ReporterConfig ¶
type UniformSample ¶
type UniformSample struct {
// contains filtered or unexported fields
}
func (*UniformSample) Count ¶
func (s *UniformSample) Count() int64
Count returns the number of samples recorded, which may exceed the reservoir size.
func (*UniformSample) Max ¶
func (s *UniformSample) Max() int64
Max returns the maximum value in the sample, which may not be the maximum value ever to be part of the sample.
func (*UniformSample) Mean ¶
func (s *UniformSample) Mean() float64
Mean returns the mean of the values in the sample.
func (*UniformSample) Min ¶
func (s *UniformSample) Min() int64
Min returns the minimum value in the sample, which may not be the minimum value ever to be part of the sample.
func (*UniformSample) Percentile ¶
func (s *UniformSample) Percentile(p float64) float64
Percentile returns an arbitrary percentile of values in the sample.
func (*UniformSample) Percentiles ¶
func (s *UniformSample) Percentiles(ps []float64) []float64
Percentiles returns a slice of arbitrary percentiles of values in the sample.
func (*UniformSample) Size ¶
func (s *UniformSample) Size() int
Size returns the size of the sample, which is at most the reservoir size.
func (*UniformSample) Snapshot ¶
func (s *UniformSample) Snapshot() gometrics.Sample
Snapshot returns a read-only copy of the sample.
func (*UniformSample) StdDev ¶
func (s *UniformSample) StdDev() float64
StdDev returns the standard deviation of the values in the sample.
func (*UniformSample) Sum ¶
func (s *UniformSample) Sum() int64
Sum returns the sum of the values in the sample.
func (*UniformSample) Values ¶
func (s *UniformSample) Values() []int64
Values returns a copy of the values in the sample.
func (*UniformSample) Variance ¶
func (s *UniformSample) Variance() float64
Variance returns the variance of the values in the sample.