Documentation ¶
Index ¶
- Constants
- Variables
- func CalculateStorageUsage(ctx context.Context, sqlExecutor func() ie.InternalExecutor) (err error)
- func CreateCronTask(ctx context.Context, executorID task.TaskCode, ...) error
- func GetAllTables() []*table.Tabledeprecated
- func GetMetricStorageUsageExecutor(sqlExecutor func() ie.InternalExecutor) func(ctx context.Context, task task.Task) error
- func GetMetricViewWithLabels(ctx context.Context, tbl string, lbls []string) *table.View
- func GetSchemaForAccount(ctx context.Context, account string) []string
- func GetStorageUsageCheckNewInterval() time.Duration
- func GetUpdateStorageUsageInterval() time.Duration
- func InitMetric(ctx context.Context, ieFactory func() ie.InternalExecutor, ...) (act bool)
- func InitSchema(ctx context.Context, txn executor.TxnExecutor) error
- func IsEnable() bool
- func NewMetricView(tbl string, opts ...table.ViewOption) *table.View
- func NewMetricViewWithLabels(ctx context.Context, tbl string, lbls []string) *table.View
- func SetStorageUsageCheckNewInterval(interval time.Duration)
- func SetUpdateStorageUsageInterval(interval time.Duration)
- func StopMetricSync()
- func TaskMetadata(jobName string, id task.TaskCode, args ...string) task.TaskMetadata
- type CtxServiceType
- type ExporterOption
- type InitOption
- type InitOptions
- type MetricCollector
- type StatsLogWriter
- type WithFlushInterval
- type WithMetricThreshold
- type WithSampleThreshold
- type WithSqlWorkerNum
Constants ¶
View Source
const ( LoggerName = "MetricTask" LoggerNameMetricStorage = "MetricStorageUsage" StorageUsageCronTask = "StorageUsage" StorageUsageTaskCronExpr = ExprEvery05Min ExprEvery05Min = "0 */1 * * * *" ParamSeparator = " " )
View Source
const ( ShowAllAccountSQL = "SHOW ACCOUNTS;" ShowAccountSQL = "SHOW ACCOUNTS like %q;" ColumnAccountName = "account_name" // result column in `show accounts`, or column in table mo_catalog.mo_account ColumnSize = "size" // result column in `show accounts`, or column in table mo_catalog.mo_account ColumnCreatedTime = "created_time" // column in table mo_catalog.mo_account ColumnStatus = "status" // column in table mo_catalog.mo_account )
View Source
const ( MetricDBConst = metric.MetricDBConst SqlCreateDBConst = "create database if not exists " + MetricDBConst SqlDropDBConst = "drop database if exists " + MetricDBConst ALL_IN_ONE_MODE = "monolithic" )
View Source
const CHAN_CAPACITY = 10000
View Source
const LaunchMode = "ALL"
Variables ¶
View Source
var SingleMetricTable = &table.Table{ Account: table.AccountSys, Database: MetricDBConst, Table: `metric`, Columns: []table.Column{metricNameColumn, metricCollectTimeColumn, metricValueColumn, metricNodeColumn, metricRoleColumn, metricAccountColumn, metricTypeColumn}, PrimaryKeyColumn: []table.Column{}, ClusterBy: []table.Column{metricCollectTimeColumn, metricNameColumn, metricAccountColumn}, Engine: table.NormalTableEngine, Comment: `metric data` + catalog.MO_COMMENT_NO_DEL_HINT, PathBuilder: table.NewAccountDatePathBuilder(), AccountColumn: &metricAccountColumn, TimestampColumn: &metricCollectTimeColumn, SupportUserAccess: true, SupportConstAccess: true, }
View Source
var SqlStatementCUTable = &table.Table{ Account: table.AccountSys, Database: MetricDBConst, Table: catalog.MO_SQL_STMT_CU, Columns: []table.Column{metricAccountColumn, metricCollectTimeColumn, metricValueColumn, metricNodeColumn, metricRoleColumn, sqlSourceTypeColumn}, PrimaryKeyColumn: []table.Column{}, ClusterBy: []table.Column{metricAccountColumn, metricCollectTimeColumn}, Engine: table.NormalTableEngine, Comment: `sql_statement_cu metric data`, PathBuilder: table.NewAccountDatePathBuilder(), AccountColumn: &metricAccountColumn, TimestampColumn: &metricCollectTimeColumn, SupportUserAccess: true, SupportConstAccess: true, }
Functions ¶
func CalculateStorageUsage ¶ added in v1.0.0
func CalculateStorageUsage(ctx context.Context, sqlExecutor func() ie.InternalExecutor) (err error)
func CreateCronTask ¶ added in v1.0.0
func CreateCronTask(ctx context.Context, executorID task.TaskCode, taskService taskservice.TaskService) error
CreateCronTask should init once in/with schema-init.
func GetAllTables
deprecated
added in
v1.0.0
func GetMetricStorageUsageExecutor ¶ added in v1.0.0
func GetMetricStorageUsageExecutor(sqlExecutor func() ie.InternalExecutor) func(ctx context.Context, task task.Task) error
GetMetricStorageUsageExecutor collect metric server_storage_usage
func GetMetricViewWithLabels ¶
func GetSchemaForAccount ¶
GetSchemaForAccount return account's table, and view's schema
func GetStorageUsageCheckNewInterval ¶ added in v1.0.0
func GetUpdateStorageUsageInterval ¶ added in v1.0.0
func InitMetric ¶
func InitMetric(ctx context.Context, ieFactory func() ie.InternalExecutor, SV *config.ObservabilityParameters, nodeUUID, role string, opts ...InitOption) (act bool)
func InitSchema ¶
func InitSchema(ctx context.Context, txn executor.TxnExecutor) error
func NewMetricView ¶
func NewMetricView(tbl string, opts ...table.ViewOption) *table.View
func NewMetricViewWithLabels ¶
func SetStorageUsageCheckNewInterval ¶ added in v1.0.0
func SetUpdateStorageUsageInterval ¶ added in v1.0.0
func StopMetricSync ¶
func StopMetricSync()
func TaskMetadata ¶ added in v1.0.0
TaskMetadata handle args like: "{db_tbl_name} [date, default: today]"
Types ¶
type CtxServiceType ¶ added in v1.0.0
type CtxServiceType string
const ServiceTypeKey CtxServiceType = "ServiceTypeKey"
type ExporterOption ¶ added in v1.0.0
type ExporterOption func(*metricExporter)
func WithGatherInterval ¶ added in v1.0.0
func WithGatherInterval(interval time.Duration) ExporterOption
type InitOption ¶
type InitOption func(*InitOptions)
func WithFrontendServerStarted ¶ added in v1.2.1
func WithFrontendServerStarted(f func() bool) InitOption
func WithInitAction
deprecated
func WithInitAction(init bool) InitOption
Deprecated: Use InitSchema instead.
func WithInternalGatherInterval ¶ added in v1.0.0
func WithInternalGatherInterval(interval time.Duration) InitOption
func WithWriterFactory ¶
func WithWriterFactory(factory table.WriterFactory) InitOption
func (InitOption) ApplyTo ¶
func (f InitOption) ApplyTo(opts *InitOptions)
type InitOptions ¶
type InitOptions struct {
// contains filtered or unexported fields
}
type MetricCollector ¶
type StatsLogWriter ¶
type StatsLogWriter struct {
// contains filtered or unexported fields
}
func (*StatsLogWriter) Stop ¶
func (e *StatsLogWriter) Stop(_ bool) (<-chan struct{}, bool)
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.