metrics

package
v0.13.4 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Graphite *graphite.Graphite

Functions

func DisableMetrics

func DisableMetrics()

func InitMetrics

func InitMetrics(c *Config)

func SendFindMetrics

func SendFindMetrics(r *FindMetrics, statusCode int, durationMs, untilFromS int64, extended bool, metricsCount int64)

func SendQueryRead

func SendQueryRead(r *QueryMetrics, from, until, durationMs, read_rows, read_bytes, ch_read_rows, ch_read_bytes int64, err bool)

func SendQueryReadByTable

func SendQueryReadByTable(table string, from, until, durationMs, read_rows, read_bytes, ch_read_rows, ch_read_bytes int64, err bool)

func SendQueryReadChecked

func SendQueryReadChecked(r *QueryMetrics, from, until, durationMs, read_rows, read_bytes, ch_read_rows, ch_read_bytes int64, err bool)

func SendRenderMetrics

func SendRenderMetrics(r *RenderMetrics, statusCode int, start, fetch, end time.Time, untilFromS int64, extended bool, metricsCount, points int64)

func UnregisterAll

func UnregisterAll()

Types

type CacheMetric

type CacheMetric struct {
	CacheHits   metrics.Counter
	CacheMisses metrics.Counter
}
var DefaultCacheMetrics *CacheMetric
var FinderCacheMetrics *CacheMetric
var ShortCacheMetrics *CacheMetric

type Config

type Config struct {
	MetricEndpoint string                   `toml:"metric-endpoint" json:"metric-endpoint" comment:"graphite relay address"`
	Statsd         string                   `toml:"statsd-endpoint" json:"statsd-endpoint" comment:"statsd server address"`
	MetricInterval time.Duration            `toml:"metric-interval" json:"metric-interval" comment:"graphite metrics send interval"`
	MetricTimeout  time.Duration            `toml:"metric-timeout" json:"metric-timeout" comment:"graphite metrics send timeout"`
	MetricPrefix   string                   `toml:"metric-prefix" json:"metric-prefix" comment:"graphite metrics prefix"`
	BucketsWidth   []int64                  `toml:"request-buckets" json:"request-buckets" comment:"Request historgram buckets widths"`
	BucketsLabels  []string                 `toml:"request-labels" json:"request-labels" comment:"Request historgram buckets labels"`
	Ranges         map[string]time.Duration `toml:"ranges" json:"ranges" comment:"Additional separate stats for until-from ranges"`
	FindRanges     map[string]time.Duration `toml:"find-ranges" json:"find-ranges" comment:"Additional separate stats for until-from find ranges"` // for future use, not needed at now
	ExtendedStat   bool                     `toml:"extended-stat" json:"extended-stat" comment:"Extended metrics"`

	RangeNames     []string `toml:"-" json:"-"`
	RangeS         []int64  `toml:"-" json:"-"`
	FindRangeNames []string `toml:"-" json:"-"`
	FindRangeS     []int64  `toml:"-" json:"-"`
}

type FindMetrics

type FindMetrics struct {
	ReqMetric
	RangeNames   []string
	RangeS       []int64
	RangeMetrics []ReqMetric
}
var FindRequestMetric *FindMetrics
var TagsRequestMetric *FindMetrics

type NullSender

type NullSender struct{}

NullSender is disabled sender (if stat need to be disabled)

func (NullSender) Close

func (NullSender) Close() error

func (NullSender) Dec

func (NullSender) Gauge

func (NullSender) Gauge(string, int64, float32, ...statsd.Tag) error

func (NullSender) GaugeDelta

func (NullSender) GaugeDelta(string, int64, float32, ...statsd.Tag) error

func (NullSender) Inc

func (NullSender) NewSubStatter

func (NullSender) NewSubStatter(string) statsd.SubStatter

func (NullSender) Raw

func (NullSender) Set

func (NullSender) SetInt

func (NullSender) SetInt(string, int64, float32, ...statsd.Tag) error

func (NullSender) SetPrefix

func (NullSender) SetPrefix(string)

func (NullSender) SetSamplerFunc

func (NullSender) SetSamplerFunc(statsd.SamplerFunc)

func (NullSender) Timing

func (NullSender) Timing(string, int64, float32, ...statsd.Tag) error

func (NullSender) TimingDuration

func (NullSender) TimingDuration(string, time.Duration, float32, ...statsd.Tag) error

type QueryMetric

type QueryMetric struct {
	RequestsH       metrics.Histogram
	Errors          metrics.Counter
	ReadRowsName    string
	ReadBytesName   string
	ChReadRowsName  string
	ChReadBytesName string
}

type QueryMetrics

type QueryMetrics struct {
	QueryMetric
	RangeNames   []string
	RangeS       []int64
	RangeMetrics []QueryMetric
}
var (
	QMetrics            map[string]*QueryMetrics = make(map[string]*QueryMetrics)
	AutocompleteQMetric *QueryMetrics
	FindQMetric         *QueryMetrics
)

func InitQueryMetrics

func InitQueryMetrics(table string, c *Config) *QueryMetrics

type RenderMetric

type RenderMetric struct {
	ReqMetric
	FinderH metrics.Histogram
}

type RenderMetrics

type RenderMetrics struct {
	RenderMetric
	RangeNames   []string
	RangeS       []int64
	RangeMetrics []RenderMetric
}
var RenderRequestMetric *RenderMetrics

type ReqMetric

type ReqMetric struct {
	RequestsH        metrics.Histogram
	Errors           metrics.Counter
	Requests200      metrics.Counter
	Requests400      metrics.Counter
	Requests403      metrics.Counter
	Requests404      metrics.Counter
	Requests500      metrics.Counter
	Requests503      metrics.Counter
	Requests504      metrics.Counter
	Requests5xx      metrics.Counter // failback other 5xx statuses
	Requests4xx      metrics.Counter // failback other statuses
	MetricsCountName string
	PointsCountName  string
}

Jump to

Keyboard shortcuts

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