datasource

package
v0.0.0-...-b8a1a0e Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DATASOURCE_PORT      = 20106
	MAX_DATASOURCE_COUNT = 64
)
View Source
const (
	ORIGIN_TABLE_1M = "1m"
	ORIGIN_TABLE_1S = "1s"
	FLOW_METRICS    = "vtap_flow"
	APP_METRICS     = "vtap_app"

	ERR_IS_MODIFYING = "Modifying the retention time (%s), please try again later"
)
View Source
const (
	OBSERVATRACE_SYSTEM DatasourceModifiedOnly = "observatrace_system"
	L4_FLOW_LOG                                = "flow_log.l4_flow_log"
	L7_FLOW_LOG                                = "flow_log.l7_flow_log"
	L4_PACKET                                  = "flow_log.l4_packet"
	L7_PACKET                                  = "flow_log.l7_packet"
	EXT_METRICS                                = "ext_metrics"
	PROMETHEUS                                 = "prometheus"
	EVENT_EVENT                                = "event.event"
	EVENT_PERF_EVENT                           = "event.perf_event"
	EVENT_ALARM_EVENT                          = "event.alarm_event"
	PROFILE                                    = "profile.in_process"
)

Variables

View Source
var DatasourceModifiedOnlyIDMap = map[DatasourceModifiedOnly]DatasourceInfo{
	OBSERVATRACE_SYSTEM: {int(zerodoc.VTAP_TABLE_ID_MAX) + 1, "observatrace_system", []string{}},
	L4_FLOW_LOG:         {int(zerodoc.VTAP_TABLE_ID_MAX) + 2, "flow_log", []string{"l4_flow_log"}},
	L7_FLOW_LOG:         {int(zerodoc.VTAP_TABLE_ID_MAX) + 3, "flow_log", []string{"l7_flow_log"}},
	L4_PACKET:           {int(zerodoc.VTAP_TABLE_ID_MAX) + 4, "flow_log", []string{"l4_packet"}},
	L7_PACKET:           {int(zerodoc.VTAP_TABLE_ID_MAX) + 5, "flow_log", []string{"l7_packet"}},
	EXT_METRICS:         {int(zerodoc.VTAP_TABLE_ID_MAX) + 6, "ext_metrics", []string{"metrics"}},
	PROMETHEUS:          {int(zerodoc.VTAP_TABLE_ID_MAX) + 7, "prometheus", []string{"samples"}},
	EVENT_EVENT:         {int(zerodoc.VTAP_TABLE_ID_MAX) + 8, "event", []string{"event"}},
	EVENT_PERF_EVENT:    {int(zerodoc.VTAP_TABLE_ID_MAX) + 9, "event", []string{"perf_event"}},
	EVENT_ALARM_EVENT:   {int(zerodoc.VTAP_TABLE_ID_MAX) + 10, "event", []string{"alarm_event"}},
	PROFILE:             {int(zerodoc.VTAP_TABLE_ID_MAX) + 11, "profile", []string{"in_process"}},
}

Functions

func IsModifiedOnlyDatasource

func IsModifiedOnlyDatasource(datasource string) bool

func MakeCreateTableLocal

func MakeCreateTableLocal(t *ckdb.Table, dstTable, aggrSummable, aggrUnsummable string) string

func MakeGlobalTableCreateSQL

func MakeGlobalTableCreateSQL(t *ckdb.Table, dstTable string) string

func MakeMVTableCreateSQL

func MakeMVTableCreateSQL(t *ckdb.Table, dstTable, aggrSummable, aggrUnsummable string, aggrTimeFunc ckdb.TimeFuncType) string

Types

type ActionEnum

type ActionEnum uint8
const (
	ADD ActionEnum = iota
	DEL
	MOD
)

func ActionToEnum

func ActionToEnum(action string) (ActionEnum, error)

type AddBody

type AddBody struct {
	BaseRP       string `json:"base-rp"`
	DB           string `json:"db"`
	Interval     int    `json:"interval"`
	Name         string `json:"name"`
	Duration     int    `json:"retention-time"`
	SummableOP   string `json:"summable-metrics-op"`
	UnsummableOP string `json:"unsummable-metrics-op"`
}

type AggrEnum

type AggrEnum uint8
const (
	SUM AggrEnum = iota
	MAX
	MIN
	AVG
)

func AggrToEnum

func AggrToEnum(aggr string) (AggrEnum, error)

type DatasourceInfo

type DatasourceInfo struct {
	ID     int
	DB     string
	Tables []string
}

type DatasourceManager

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

func NewDatasourceManager

func NewDatasourceManager(cfg *config.Config, readTimeout int) *DatasourceManager

func (*DatasourceManager) Close

func (m *DatasourceManager) Close() error

func (*DatasourceManager) Handle

func (m *DatasourceManager) Handle(dbGroup, action, baseTable, dstTable, aggrSummable, aggrUnsummable string, interval, duration int) error

func (*DatasourceManager) RegisterHandlers

func (m *DatasourceManager) RegisterHandlers()

func (*DatasourceManager) Start

func (m *DatasourceManager) Start()

type DatasourceModifiedOnly

type DatasourceModifiedOnly string

func (DatasourceModifiedOnly) DatasourceInfo

func (ds DatasourceModifiedOnly) DatasourceInfo() DatasourceInfo

type DelBody

type DelBody struct {
	DB   string `json:"db"`
	Name string `json:"name"`
}

type IntervalEnum

type IntervalEnum uint8
const (
	IntervalHour IntervalEnum = iota
	IntervalDay
)

type JsonResp

type JsonResp struct {
	OptStatus   string `json:"OPT_STATUS"`
	Description string `json:"DESCRIPTION,omitempty"`
}

type ModBody

type ModBody struct {
	DB       string `json:"db"`
	Name     string `json:"name"`
	Duration int    `json:"retention-time"`
}

type TableType

type TableType uint8
const (
	AGG    TableType = iota // 聚合后的原始表, 存储数据
	MV                      // view 无实际数据, 用来从local或agg表,读取数据写入到agg表
	LOCAL                   // view 无实际数据, 用来简化读取agg表的数据
	GLOBAL                  // 以local表为基础,建立全局表
)

func (TableType) String

func (v TableType) String() string

Jump to

Keyboard shortcuts

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