Documentation
¶
Index ¶
- Constants
- Variables
- func ExponentialBuckets(start, factor float64, count int) []float64
- func GetMetricViewWithLabels(tbl string, lbls []string) *export.View
- func GetSchemaForAccount(account string) []string
- func InitMetric(ctx context.Context, ieFactory func() ie.InternalExecutor, ...)
- func InitSchema(ctx context.Context, ieFactory func() ie.InternalExecutor) error
- func NewCounter(opts prom.CounterOpts) *ratecounter
- func NewCounterVec(opts CounterOpts, lvs []string, doAvg bool) *rateCounterVec
- func NewGauge(opts prom.GaugeOpts) *gauge
- func NewGaugeVec(opts prom.GaugeOpts, lvs []string) *gaugeVec
- func NewMetricView(tbl string, opts ...export.ViewOption) *export.View
- func NewMetricViewWithLabels(tbl string, lbls []string) *export.View
- func NewRawHist(opts prom.HistogramOpts) *rawHist
- func StopMetricSync()
- type Collector
- type Counter
- type CounterOpts
- type ExportMultiTable
- type Gauge
- type GaugeOpts
- type HistogramOpts
- type InitOption
- type InitOptions
- type MetricCollector
- type MetricExporter
- type Observer
- type RawHistVec
- func (v *RawHistVec) CancelToProm()
- func (v *RawHistVec) Collect(ch chan<- prom.Metric)
- func (v *RawHistVec) CollectorToProm() prom.Collector
- func (v *RawHistVec) Describe(ch chan<- *prom.Desc)
- func (v *RawHistVec) GetMetricWithLabelValues(lvs ...string) (Observer, error)
- func (v *RawHistVec) WithLabelValues(lvs ...string) prom.Observer
- type SQLType
- type SubSystem
- type WithFlushInterval
- type WithMetricThreshold
- type WithSampleThreshold
- type WithSqlWorkerNum
Constants ¶
View Source
const ( MetricDBConst = "system_metrics" ALL_IN_ONE_MODE = "monolithic" )
View Source
const CHAN_CAPACITY = 10000
Variables ¶
View Source
var ( StatementCounterFactory = NewCounterVec( CounterOpts{ Subsystem: "sql", Name: "statement_total", Help: "Counter of executed sql statement", }, []string{constTenantKey, "type"}, false, ) TransactionCounterFactory = NewCounterVec( CounterOpts{ Subsystem: "sql", Name: "transaction_total", Help: "Counter of transaction", }, []string{constTenantKey}, false, ) TransactionErrorsFactory = NewCounterVec( CounterOpts{ Subsystem: "sql", Name: "transaction_errors", Help: "Counter of errors on execute commit/rollback statement", }, []string{constTenantKey, "type"}, false, ) StatementErrorsFactory = NewCounterVec( CounterOpts{ Subsystem: "sql", Name: "statement_errors", Help: "Counter of executed sql statement failed.", }, []string{constTenantKey, "type"}, false, ) )
View Source
var ( ConnFactory = NewGaugeVec( GaugeOpts{ Subsystem: "server", Name: "connections", Help: "Number of process connections", }, []string{constTenantKey}, ) )
View Source
var SingleMetricTable = &export.Table{ Account: export.AccountAll, Database: MetricDBConst, Table: `metric`, Columns: []export.Column{metricNameColumn, metricCollectTimeColumn, metricValueColumn, metricNodeColumn, metricRoleColumn, metricAccountColumn, metricTypeColumn}, PrimaryKeyColumn: []export.Column{}, Engine: export.ExternalTableEngine, Comment: `metric data`, PathBuilder: export.NewAccountDatePathBuilder(), AccountColumn: &metricAccountColumn, SupportUserAccess: true, }
View Source
var SubSystemProcess = &SubSystem{"process", "MO process status", false}
View Source
var SubSystemServer = &SubSystem{"server", "MO Server status, observe from inside", true}
View Source
var SubSystemSql = &SubSystem{"sql", "base on query action", true}
View Source
var SubSystemSys = &SubSystem{"sys", "OS status", false}
Functions ¶
func ExponentialBuckets ¶
ExponentialBuckets produces list like `[start, start * factor, start * factor^2, ..., start * factor^(count-1)]`
func GetMetricViewWithLabels ¶ added in v0.6.0
func GetSchemaForAccount ¶ added in v0.6.0
GetSchemaForAccount return account's table, and view's schema
func InitMetric ¶
func InitMetric(ctx context.Context, ieFactory func() ie.InternalExecutor, SV *config.ObservabilityParameters, nodeUUID, role string, opts ...InitOption)
func InitSchema ¶ added in v0.6.0
func InitSchema(ctx context.Context, ieFactory func() ie.InternalExecutor) error
func NewCounter ¶
func NewCounter(opts prom.CounterOpts) *ratecounter
func NewCounterVec ¶
func NewCounterVec(opts CounterOpts, lvs []string, doAvg bool) *rateCounterVec
func NewGaugeVec ¶
func NewMetricView ¶ added in v0.6.0
func NewMetricView(tbl string, opts ...export.ViewOption) *export.View
func NewMetricViewWithLabels ¶ added in v0.6.0
func NewRawHist ¶
func NewRawHist(opts prom.HistogramOpts) *rawHist
func StopMetricSync ¶
func StopMetricSync()
Types ¶
type Counter ¶
func StatementCounter ¶
func StatementErrorsCounter ¶ added in v0.6.0
func TransactionCounter ¶ added in v0.6.0
func TransactionErrorsCounter ¶ added in v0.6.0
type CounterOpts ¶
type CounterOpts = prom.CounterOpts
type ExportMultiTable ¶ added in v0.6.0
type ExportMultiTable bool
func (ExportMultiTable) ApplyTo ¶ added in v0.6.0
func (x ExportMultiTable) ApplyTo(o *collectorOpts)
type Gauge ¶
func ConnectionCounter ¶ added in v0.6.0
type HistogramOpts ¶
type HistogramOpts = prom.HistogramOpts
type InitOption ¶ added in v0.6.0
type InitOption func(*InitOptions)
func WithExportInterval ¶ added in v0.6.0
func WithExportInterval(sec int) InitOption
func WithInitAction ¶ added in v0.6.0
func WithInitAction(init bool) InitOption
func WithMultiTable ¶ added in v0.6.0
func WithMultiTable(multi bool) InitOption
func WithWriterFactory ¶ added in v0.6.0
func WithWriterFactory(factory export.FSWriterFactory) InitOption
func (InitOption) ApplyTo ¶ added in v0.6.0
func (f InitOption) ApplyTo(opts *InitOptions)
type InitOptions ¶ added in v0.6.0
type InitOptions struct {
// contains filtered or unexported fields
}
type MetricCollector ¶
type MetricExporter ¶
type RawHistVec ¶
type RawHistVec struct {
// contains filtered or unexported fields
}
RawHistVec is a Collector that bundles a set of RawHist that all share the same Desc, but have different values for their variable labels. It can be used as a factory for a series of Observers
func NewRawHistVec ¶
func NewRawHistVec(opts prom.HistogramOpts, labelNames []string) *RawHistVec
NewRawHistVec creates a new NewRawHistVec based on the provided HistogramOpts and partitioned by the given label names.
func (*RawHistVec) CancelToProm ¶
func (v *RawHistVec) CancelToProm()
func (*RawHistVec) Collect ¶
func (v *RawHistVec) Collect(ch chan<- prom.Metric)
func (*RawHistVec) CollectorToProm ¶
func (v *RawHistVec) CollectorToProm() prom.Collector
func (*RawHistVec) Describe ¶
func (v *RawHistVec) Describe(ch chan<- *prom.Desc)
func (*RawHistVec) GetMetricWithLabelValues ¶
func (v *RawHistVec) GetMetricWithLabelValues(lvs ...string) (Observer, error)
func (*RawHistVec) WithLabelValues ¶
func (v *RawHistVec) WithLabelValues(lvs ...string) prom.Observer
type SQLType ¶
type SQLType string
var ( SQLTypeSelect SQLType = "select" SQLTypeInsert SQLType = "insert" SQLTypeUpdate SQLType = "update" SQLTypeDelete SQLType = "delete" SQLTypeOther SQLType = "other" SQLTypeBegin SQLType = "begin" SQLTypeCommit SQLType = "commit" SQLTypeRollback SQLType = "rollback" SQLTypeAutoCommit SQLType = "auto_commit" SQLTypeAutoRollback SQLType = "auto_rollback" )
type WithFlushInterval ¶
func (WithFlushInterval) ApplyTo ¶
func (x WithFlushInterval) ApplyTo(o *collectorOpts)
type WithMetricThreshold ¶
type WithMetricThreshold int
func (WithMetricThreshold) ApplyTo ¶
func (x WithMetricThreshold) ApplyTo(o *collectorOpts)
type WithSampleThreshold ¶
type WithSampleThreshold int
func (WithSampleThreshold) ApplyTo ¶
func (x WithSampleThreshold) ApplyTo(o *collectorOpts)
type WithSqlWorkerNum ¶
type WithSqlWorkerNum int
func (WithSqlWorkerNum) ApplyTo ¶
func (x WithSqlWorkerNum) ApplyTo(o *collectorOpts)
Click to show internal directories.
Click to hide internal directories.