api

package
v1.1.16 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CreateClusterInfoSql = "create table if not exists cluster_info (" +
	"ts timestamp, " +
	"first_ep binary(134), " +
	"first_ep_dnode_id int, " +
	"version binary(12), " +
	"master_uptime float, " +
	"monitor_interval int, " +
	"dbs_total int, " +
	"tbs_total bigint, " +
	"stbs_total int, " +
	"dnodes_total int, " +
	"dnodes_alive int, " +
	"mnodes_total int, " +
	"mnodes_alive int, " +
	"vgroups_total int, " +
	"vgroups_alive int, " +
	"vnodes_total int, " +
	"vnodes_alive int, " +
	"connections_total int, " +
	"topics_total int, " +
	"streams_total int, " +
	"protocol int " +
	") tags (cluster_id nchar(32))"
View Source
var CreateDataDirSql = "create table if not exists data_dir (" +
	"ts timestamp, " +
	"name nchar(200), " +
	"`level` int, " +
	"avail bigint, " +
	"used bigint, " +
	"total bigint" +
	") tags (dnode_id int, dnode_ep nchar(" + dnodeEpLen + "), cluster_id nchar(32))"
View Source
var CreateDnodeInfoSql = "create table if not exists dnodes_info (" +
	"ts timestamp, " +
	"uptime float, " +
	"cpu_engine float, " +
	"cpu_system float, " +
	"cpu_cores float, " +
	"mem_engine int, " +
	"mem_system int, " +
	"mem_total int, " +
	"disk_engine bigint, " +
	"disk_used bigint, " +
	"disk_total bigint, " +
	"net_in float, " +
	"net_out float, " +
	"io_read float, " +
	"io_write float, " +
	"io_read_disk float, " +
	"io_write_disk float, " +
	"req_select int, " +
	"req_select_rate float, " +
	"req_insert int, " +
	"req_insert_success int, " +
	"req_insert_rate float, " +
	"req_insert_batch int, " +
	"req_insert_batch_success int, " +
	"req_insert_batch_rate float, " +
	"errors int, " +
	"vnodes_num int, " +
	"masters int, " +
	"has_mnode int, " +
	"has_qnode int, " +
	"has_snode int, " +
	"has_bnode int " +
	") tags (dnode_id int, dnode_ep nchar(" + dnodeEpLen + "), cluster_id nchar(32))"
View Source
var CreateDnodeSql = "create table if not exists d_info (" +
	"ts timestamp, " +
	"status binary(10)" +
	") tags (dnode_id int, dnode_ep nchar(" + dnodeEpLen + "), cluster_id nchar(32))"
View Source
var CreateGrantInfoSql = "create table if not exists grants_info(" +
	"ts timestamp, " +
	"expire_time bigint, " +
	"timeseries_used bigint, " +
	"timeseries_total bigint " +
	") tags (cluster_id nchar(32))"
View Source
var CreateKeeperSql = "create table if not exists keeper_monitor (" +
	"ts timestamp, " +
	"cpu float, " +
	"mem float, " +
	"total_reports int " +
	") tags (identify nchar(50))"
View Source
var CreateLogDirSql = "create table if not exists log_dir (" +
	"ts timestamp, " +
	"name nchar(200), " +
	"avail bigint, " +
	"used bigint, " +
	"total bigint" +
	") tags (dnode_id int, dnode_ep nchar(" + dnodeEpLen + "), cluster_id nchar(32))"
View Source
var CreateMnodeSql = "create table if not exists m_info (" +
	"ts timestamp, " +
	"role binary(10)" +
	") tags (mnode_id int, mnode_ep nchar(" + dnodeEpLen + "), cluster_id nchar(32))"
View Source
var CreateSummarySql = "create table if not exists log_summary(" +
	"ts timestamp, " +
	"error int, " +
	"info int, " +
	"debug int, " +
	"trace int " +
	") tags (dnode_id int, dnode_ep nchar(" + dnodeEpLen + "), cluster_id nchar(32))"
View Source
var CreateTempDirSql = "create table if not exists temp_dir(" +
	"ts timestamp, " +
	"name nchar(200), " +
	"avail bigint, " +
	"used bigint, " +
	"total bigint " +
	") tags (dnode_id int, dnode_ep nchar(" + dnodeEpLen + "), cluster_id nchar(32))"
View Source
var CreateVgroupsInfoSql = "create table if not exists vgroups_info (" +
	"ts timestamp, " +
	"vgroup_id int, " +
	"database_name binary(33), " +
	"tables_num bigint, " +
	"status binary(512) " +
	") tags (dnode_id int, dnode_ep nchar(" + dnodeEpLen + "), cluster_id nchar(32))"
View Source
var CreateVnodeRoleSql = "create table if not exists vnodes_role (" +
	"ts timestamp, " +
	"vnode_role binary(10) " +
	") tags (dnode_id int, dnode_ep nchar(" + dnodeEpLen + "), cluster_id nchar(32))"
View Source
var MAX_SQL_LEN = 1000000
View Source
var STABLE_NAME_KEY = "priv_stn"

Functions

func CreatTables added in v1.0.28

func CreatTables(username string, password string, host string, port int, usessl bool, dbname string, createList []string)

func CreateDatabase added in v1.0.28

func CreateDatabase(username string, password string, host string, port int, usessl bool, dbname string, databaseOptions map[string]interface{})

func Init added in v1.0.23

func Init(key string)

初始化单表的列序列

func Store added in v1.0.23

func Store(key string, value ColumnSeq)

存储数据

Types

type Adapter added in v1.0.16

type Adapter struct {
	// contains filtered or unexported fields
}

func NewAdapter added in v1.0.16

func NewAdapter(c *config.Config) *Adapter

func (*Adapter) Init added in v1.0.16

func (a *Adapter) Init(c gin.IRouter) error

type AdapterMetrics added in v1.0.16

type AdapterMetrics struct {
	RestTotal          int `json:"rest_total"`
	RestQuery          int `json:"rest_query"`
	RestWrite          int `json:"rest_write"`
	RestOther          int `json:"rest_other"`
	RestInProcess      int `json:"rest_in_process"`
	RestSuccess        int `json:"rest_success"`
	RestFail           int `json:"rest_fail"`
	RestQuerySuccess   int `json:"rest_query_success"`
	RestQueryFail      int `json:"rest_query_fail"`
	RestWriteSuccess   int `json:"rest_write_success"`
	RestWriteFail      int `json:"rest_write_fail"`
	RestOtherSuccess   int `json:"rest_other_success"`
	RestOtherFail      int `json:"rest_other_fail"`
	RestQueryInProcess int `json:"rest_query_in_process"`
	RestWriteInProcess int `json:"rest_write_in_process"`
	WSTotal            int `json:"ws_total"`
	WSQuery            int `json:"ws_query"`
	WSWrite            int `json:"ws_write"`
	WSOther            int `json:"ws_other"`
	WSInProcess        int `json:"ws_in_process"`
	WSSuccess          int `json:"ws_success"`
	WSFail             int `json:"ws_fail"`
	WSQuerySuccess     int `json:"ws_query_success"`
	WSQueryFail        int `json:"ws_query_fail"`
	WSWriteSuccess     int `json:"ws_write_success"`
	WSWriteFail        int `json:"ws_write_fail"`
	WSOtherSuccess     int `json:"ws_other_success"`
	WSOtherFail        int `json:"ws_other_fail"`
	WSQueryInProcess   int `json:"ws_query_in_process"`
	WSWriteInProcess   int `json:"ws_write_in_process"`
}

type AdapterReport added in v1.0.16

type AdapterReport struct {
	Timestamp int64          `json:"ts"`
	Metric    AdapterMetrics `json:"metrics"`
	Endpoint  string         `json:"endpoint"`
}

type CheckHealth added in v1.0.5

type CheckHealth struct {
	// contains filtered or unexported fields
}

func NewCheckHealth added in v1.0.5

func NewCheckHealth(version string) *CheckHealth

func (*CheckHealth) Init added in v1.0.5

func (h *CheckHealth) Init(c gin.IRouter)

type ClusterBasic added in v1.0.23

type ClusterBasic struct {
	ClusterId      string `json:"cluster_id"`
	Ts             string `json:"ts"`
	FirstEp        string `json:"first_ep"`
	FirstEpDnodeId int32  `json:"first_ep_dnode_id"`
	ClusterVersion string `json:"cluster_version"`
}

type ClusterInfo

type ClusterInfo struct {
	FirstEp          string  `json:"first_ep"`
	FirstEpDnodeID   int     `json:"first_ep_dnode_id"`
	Version          string  `json:"version"`
	MasterUptime     float32 `json:"master_uptime"`
	MonitorInterval  int     `json:"monitor_interval"`
	DbsTotal         int     `json:"dbs_total"`
	TbsTotal         int64   `json:"tbs_total"` // change to bigint since TS-3003
	StbsTotal        int     `json:"stbs_total"`
	VgroupsTotal     int     `json:"vgroups_total"`
	VgroupsAlive     int     `json:"vgroups_alive"`
	VnodesTotal      int     `json:"vnodes_total"`
	VnodesAlive      int     `json:"vnodes_alive"`
	ConnectionsTotal int     `json:"connections_total"`
	TopicsTotal      int     `json:"topics_total"`
	StreamsTotal     int     `json:"streams_total"`
	Dnodes           []Dnode `json:"dnodes"`
	Mnodes           []Mnode `json:"mnodes"`
}

type ColumnSeq added in v1.0.23

type ColumnSeq struct {
	// contains filtered or unexported fields
}

func Load added in v1.0.23

func Load(key string) (ColumnSeq, bool)

加载数据

type DataDir

type DataDir struct {
	Name  string          `json:"name"`
	Level int             `json:"level"`
	Avail decimal.Decimal `json:"avail"`
	Used  decimal.Decimal `json:"used"`
	Total decimal.Decimal `json:"total"`
}

type DiskInfo

type DiskInfo struct {
	Datadir []DataDir `json:"datadir"`
	Logdir  LogDir    `json:"logdir"`
	Tempdir TempDir   `json:"tempdir"`
}

type Dnode

type Dnode struct {
	DnodeID int    `json:"dnode_id"`
	DnodeEp string `json:"dnode_ep"`
	Status  string `json:"status"`
}

type DnodeInfo

type DnodeInfo struct {
	Uptime                float32 `json:"uptime"`
	CPUEngine             float32 `json:"cpu_engine"`
	CPUSystem             float32 `json:"cpu_system"`
	CPUCores              float32 `json:"cpu_cores"`
	MemEngine             int     `json:"mem_engine"`
	MemSystem             int     `json:"mem_system"`
	MemTotal              int     `json:"mem_total"`
	DiskEngine            int64   `json:"disk_engine"`
	DiskUsed              int64   `json:"disk_used"`
	DiskTotal             int64   `json:"disk_total"`
	NetIn                 float32 `json:"net_in"`
	NetOut                float32 `json:"net_out"`
	IoRead                float32 `json:"io_read"`
	IoWrite               float32 `json:"io_write"`
	IoReadDisk            float32 `json:"io_read_disk"`
	IoWriteDisk           float32 `json:"io_write_disk"`
	ReqSelect             int     `json:"req_select"`
	ReqSelectRate         float32 `json:"req_select_rate"`
	ReqInsert             int     `json:"req_insert"`
	ReqInsertSuccess      int     `json:"req_insert_success"`
	ReqInsertRate         float32 `json:"req_insert_rate"`
	ReqInsertBatch        int     `json:"req_insert_batch"`
	ReqInsertBatchSuccess int     `json:"req_insert_batch_success"`
	ReqInsertBatchRate    float32 `json:"req_insert_batch_rate"`
	Errors                int     `json:"errors"`
	VnodesNum             int     `json:"vnodes_num"`
	Masters               int     `json:"masters"`
	HasMnode              int8    `json:"has_mnode"`
	HasQnode              int8    `json:"has_qnode"`
	HasSnode              int8    `json:"has_snode"`
	HasBnode              int8    `json:"has_bnode"`
}

type GeneralMetric added in v1.0.23

type GeneralMetric struct {
	// contains filtered or unexported fields
}

func NewGeneralMetric added in v1.0.23

func NewGeneralMetric(conf *config.Config) *GeneralMetric

func (*GeneralMetric) Init added in v1.0.23

func (gm *GeneralMetric) Init(c gin.IRouter) error

type GrantInfo

type GrantInfo struct {
	ExpireTime      int64 `json:"expire_time"`
	TimeseriesUsed  int64 `json:"timeseries_used"`
	TimeseriesTotal int64 `json:"timeseries_total"`
}

type Log

type Log struct {
	Ts      string `json:"ts"`
	Level   string `json:"level"`
	Content string `json:"content"`
}

type LogDir

type LogDir struct {
	Name  string          `json:"name"`
	Avail decimal.Decimal `json:"avail"`
	Used  decimal.Decimal `json:"used"`
	Total decimal.Decimal `json:"total"`
}

type LogInfo

type LogInfo struct {
	Summary []Summary `json:"summary"`
}

type Metric added in v1.0.23

type Metric struct {
	Name  string  `json:"name"`
	Value float64 `json:"value"`
}

type MetricGroup added in v1.0.23

type MetricGroup struct {
	Tags    []Tag    `json:"tags"`
	Metrics []Metric `json:"metrics"`
}

type Mnode

type Mnode struct {
	MnodeID int    `json:"mnode_id"`
	MnodeEp string `json:"mnode_ep"`
	Role    string `json:"role"`
}

type NodeExporter

type NodeExporter struct {
	// contains filtered or unexported fields
}

func NewNodeExporter

func NewNodeExporter(processor *process.Processor) *NodeExporter

func (*NodeExporter) Init

func (z *NodeExporter) Init(c gin.IRouter)

type Report

type Report struct {
	Ts          string       `json:"ts"`
	DnodeID     int          `json:"dnode_id"`
	DnodeEp     string       `json:"dnode_ep"`
	ClusterID   string       `json:"cluster_id"`
	Protocol    int          `json:"protocol"`
	ClusterInfo *ClusterInfo `json:"cluster_info"` // only reported by master
	StbInfos    []StbInfo    `json:"stb_infos"`
	VgroupInfos []VgroupInfo `json:"vgroup_infos"` // only reported by master
	GrantInfo   *GrantInfo   `json:"grant_info"`   // only reported by master
	DnodeInfo   DnodeInfo    `json:"dnode_info"`
	DiskInfos   DiskInfo     `json:"disk_infos"`
	LogInfos    LogInfo      `json:"log_infos"`
}

type Reporter

type Reporter struct {
	// contains filtered or unexported fields
}

func NewReporter

func NewReporter(conf *config.Config) *Reporter

func (*Reporter) GetTotalRep

func (r *Reporter) GetTotalRep() *atomic.Value

func (*Reporter) Init

func (r *Reporter) Init(c gin.IRouter)

type SlowSqlDetailInfo added in v1.1.10

type SlowSqlDetailInfo struct {
	StartTs     string `json:"start_ts"`
	RequestId   string `json:"request_id"`
	QueryTime   int32  `json:"query_time"`
	Code        int32  `json:"code"`
	ErrorInfo   string `json:"error_info"`
	Type        int8   `json:"type"`
	RowsNum     int64  `json:"rows_num"`
	Sql         string `json:"sql"`
	ProcessName string `json:"process_name"`
	ProcessId   string `json:"process_id"`
	Db          string `json:"db"`
	User        string `json:"user"`
	Ip          string `json:"ip"`
	ClusterId   string `json:"cluster_id"`
}

type StableArrayInfo added in v1.0.23

type StableArrayInfo struct {
	Ts       string       `json:"ts"`
	Protocol int          `json:"protocol"`
	Tables   []StableInfo `json:"tables"`
}

type StableInfo added in v1.0.23

type StableInfo struct {
	Name         string        `json:"name"`
	MetricGroups []MetricGroup `json:"metric_groups"`
}

type StbInfo

type StbInfo struct {
	StbName      string `json:"stb_name"`
	DataBaseName string `json:"database_name"`
}

type Summary

type Summary struct {
	Level string `json:"level"`
	Total int    `json:"total"`
}

type Tag added in v1.0.23

type Tag struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type TempDir

type TempDir struct {
	Name  string          `json:"name"`
	Avail decimal.Decimal `json:"avail"`
	Used  decimal.Decimal `json:"used"`
	Total decimal.Decimal `json:"total"`
}

type VgroupInfo

type VgroupInfo struct {
	VgroupID     int     `json:"vgroup_id"`
	DatabaseName string  `json:"database_name"`
	TablesNum    int64   `json:"tables_num"`
	Status       string  `json:"status"`
	Vnodes       []Vnode `json:"vnodes"`
}

type Vnode

type Vnode struct {
	DnodeID   int    `json:"dnode_id"`
	VnodeRole string `json:"vnode_role"`
}

Jump to

Keyboard shortcuts

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