funcs

package
v3.2.6+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultLocalTimeZone string
)
View Source
var MonitorObjList []*MonitorArchiveObj

Functions

func ArchiveFromMysql

func ArchiveFromMysql(tableUnixTime int64)

func ChangeDatabase

func ChangeDatabase(year string) error

func CreateJob

func CreateJob(dateString string)

func InitConfig

func InitConfig(cfg string) error

func InitDbEngine

func InitDbEngine(databaseName string) (err error)

func InitHttpHandles

func InitHttpHandles()

func InitHttpTransport

func InitHttpTransport() error

func InitMonitorDbEngine

func InitMonitorDbEngine() (err error)

func InitMonitorMetricMap

func InitMonitorMetricMap() error

func ResetDbEngine added in v1.12.3

func ResetDbEngine()

func StartCronJob

func StartCronJob()

Types

type ArchiveActionList

type ArchiveActionList []*ArchiveActionParamObj

type ArchiveActionParamObj

type ArchiveActionParamObj struct {
	Endpoint  string `json:"endpoint"`
	Metric    string `json:"metric"`
	PromQl    string `json:"prom_ql"`
	TableName string `json:"table_name"`
	Start     int64  `json:"start"`
	End       int64  `json:"end"`
}

type ArchiveCountQueryObj

type ArchiveCountQueryObj struct {
	Endpoint string `json:"endpoint"`
	Metric   string `json:"metric"`
}

type ArchiveFiveRowObj

type ArchiveFiveRowObj struct {
	Endpoint string    `json:"endpoint"`
	Metric   string    `json:"metric"`
	Tags     string    `json:"tags"`
	UnixTime int64     `json:"unix_time"`
	Avg      []float64 `json:"avg"`
	Min      []float64 `json:"min"`
	Max      []float64 `json:"max"`
	P95      []float64 `json:"p_95"`
	Sum      []float64 `json:"sum"`
}

func (ArchiveFiveRowObj) CalcArchiveTable

func (a ArchiveFiveRowObj) CalcArchiveTable() ArchiveTable

type ArchiveTable

type ArchiveTable struct {
	Endpoint   string  `json:"endpoint"`
	Metric     string  `json:"metric"`
	Tags       string  `json:"tags"`
	UnixTime   int64   `json:"unix_time"`
	Avg        float64 `json:"avg"`
	Min        float64 `json:"min"`
	Max        float64 `json:"max"`
	P95        float64 `json:"p_95"`
	Sum        float64 `json:"sum"`
	CreateTime string  `json:"create_time"`
}

type DefaultSortList

type DefaultSortList []*DefaultSortObj

func (DefaultSortList) Len

func (s DefaultSortList) Len() int

func (DefaultSortList) Less

func (s DefaultSortList) Less(i, j int) bool

func (DefaultSortList) Swap

func (s DefaultSortList) Swap(i, j int)

func (DefaultSortList) ToTagString

func (s DefaultSortList) ToTagString() string

type DefaultSortObj

type DefaultSortObj struct {
	Key   string
	Value string
}

type GlobalConfig

type GlobalConfig struct {
	Enable     string           `json:"enable"`
	Mysql      MysqlConfig      `json:"mysql"`
	Prometheus PrometheusConfig `json:"prometheus"`
	Monitor    MonitorConfig    `json:"monitor"`
	Trans      TransConfig      `json:"trans"`
	Http       HttpConfig       `json:"http"`
}

func Config

func Config() *GlobalConfig

type HttpConfig

type HttpConfig struct {
	Enable bool `json:"enable"`
	Port   int  `json:"port"`
}

type HttpRespJson

type HttpRespJson struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

type JobRecordTable

type JobRecordTable struct {
	Id     int    `json:"id"`
	HostIp string `json:"host_ip"`
}

type MonitorArchiveObj

type MonitorArchiveObj struct {
	Endpoint string                    `json:"endpoint"`
	Metrics  []*MonitorPromMetricTable `json:"metrics"`
}

type MonitorConfig

type MonitorConfig struct {
	Mysql MysqlConfig `json:"mysql"`
}

type MonitorEndpointTable

type MonitorEndpointTable struct {
	Guid       string `json:"guid"`
	ExportType string `json:"export_type"`
	Step       int    `json:"step"`
	Address    string `json:"address"`
}

type MonitorMetricTable

type MonitorMetricTable struct {
	Guid         string `json:"guid" xorm:"guid"`
	Metric       string `json:"metric" xorm:"metric"`
	MonitorType  string `json:"monitor_type" xorm:"monitor_type"`
	PromExpr     string `json:"prom_expr" xorm:"prom_expr"`
	TagOwner     string `json:"tag_owner" xorm:"tag_owner"`
	ServiceGroup string `json:"service_group" xorm:"service_group"`
	Workspace    string `json:"workspace" xorm:"workspace"`
	UpdateTime   string `json:"update_time" xorm:"update_time"`
}

type MonitorPromMetricTable

type MonitorPromMetricTable struct {
	Metric     string `json:"metric"`
	MetricType string `json:"metric_type"`
	PromQl     string `json:"prom_ql"`
}

type MysqlConfig

type MysqlConfig struct {
	Type           string `json:"type"`
	Server         string `json:"server"`
	Port           string `json:"port"`
	User           string `json:"user"`
	Password       string `json:"password"`
	DataBase       string `json:"database"`
	DatabasePrefix string `json:"database_prefix"`
	MaxOpen        int    `json:"maxOpen"`
	MaxIdle        int    `json:"maxIdle"`
	Timeout        int    `json:"timeout"`
}

type PrometheusArchiveTables

type PrometheusArchiveTables struct {
	TableName string `xorm:"TABLE_NAME"`
}

type PrometheusConfig

type PrometheusConfig struct {
	Server          string   `json:"server"`
	Port            int      `json:"port"`
	MaxHttpOpen     int      `json:"max_http_open"`
	MaxHttpIdle     int      `json:"max_http_idle"`
	HttpIdleTimeout int      `json:"http_idle_timeout"`
	QueryStep       int      `json:"query_step"`
	IgnoreTags      []string `json:"ignore_tags"`
}

type PrometheusData

type PrometheusData struct {
	Result     []PrometheusResult `json:"result"`
	ResultType string             `json:"resultType"`
}

type PrometheusQueryObj

type PrometheusQueryObj struct {
	Start  int64           `json:"start"`
	End    int64           `json:"end"`
	Metric DefaultSortList `json:"metric"`
	Values [][]float64     `json:"values"`
}

type PrometheusQueryParam

type PrometheusQueryParam struct {
	Start  int64                 `json:"start"`
	End    int64                 `json:"end"`
	PromQl string                `json:"prom_ql"`
	Data   []*PrometheusQueryObj `json:"data"`
}

type PrometheusResponse

type PrometheusResponse struct {
	Status string         `json:"status"`
	Data   PrometheusData `json:"data"`
}

type PrometheusResult

type PrometheusResult struct {
	Metric map[string]string `json:"metric"`
	Values [][]interface{}   `json:"values"`
}

type TransConfig

type TransConfig struct {
	MaxUnitSpeed        int   `json:"max_unit_speed"`
	FiveMinStartDay     int64 `json:"five_min_start_day"`
	ConcurrentInsertNum int   `json:"concurrent_insert_num"`
	RetryWaitSecond     int   `json:"retry_wait_second"`
	JobTimeout          int   `json:"job_timeout"`
}

Jump to

Keyboard shortcuts

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