datasource

package
v1.6.65 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 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"
	NETWORK         = "network"
	APPLICATION     = "application"
	TRAFFIC_POLICY  = "traffic_policy"
	FLOW_TAG_DB     = "flow_tag"

	ERR_IS_MODIFYING = "Modifying the retention time (%s), please try again later"
)
View Source
const (
	DEEPFLOW_SYSTEM   DatasourceModifiedOnly = "deepflow_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_ALERT_EVENT                        = "event.alert_event"
	PROFILE                                  = "profile.in_process"
	APPLOG                                   = "application_log.log"
	DEEPFLOW_TENANT                          = "deepflow_tenant"
	DEEPFLOW_ADMIN                           = "deepflow_admin"
)

Variables

View Source
var DatasourceModifiedOnlyIDMap = map[DatasourceModifiedOnly]DatasourceInfo{
	DEEPFLOW_SYSTEM:   {int(flow_metrics.METRICS_TABLE_ID_MAX) + 1, "deepflow_system", []string{"deepflow_system"}, []string{}},
	L4_FLOW_LOG:       {int(flow_metrics.METRICS_TABLE_ID_MAX) + 2, "flow_log", []string{"l4_flow_log"}, []string{}},
	L7_FLOW_LOG:       {int(flow_metrics.METRICS_TABLE_ID_MAX) + 3, "flow_log", []string{"l7_flow_log"}, []string{}},
	L4_PACKET:         {int(flow_metrics.METRICS_TABLE_ID_MAX) + 4, "flow_log", []string{"l4_packet"}, []string{}},
	L7_PACKET:         {int(flow_metrics.METRICS_TABLE_ID_MAX) + 5, "flow_log", []string{"l7_packet"}, []string{}},
	EXT_METRICS:       {int(flow_metrics.METRICS_TABLE_ID_MAX) + 6, "ext_metrics", []string{"metrics"}, []string{}},
	PROMETHEUS:        {int(flow_metrics.METRICS_TABLE_ID_MAX) + 7, "prometheus", []string{"samples"}, []string{"prometheus_custom_field", "prometheus_custom_field_value"}},
	EVENT_EVENT:       {int(flow_metrics.METRICS_TABLE_ID_MAX) + 8, "event", []string{"event"}, []string{}},
	EVENT_PERF_EVENT:  {int(flow_metrics.METRICS_TABLE_ID_MAX) + 9, "event", []string{"perf_event"}, []string{}},
	EVENT_ALERT_EVENT: {int(flow_metrics.METRICS_TABLE_ID_MAX) + 10, "event", []string{"alert_event"}, []string{}},
	PROFILE:           {int(flow_metrics.METRICS_TABLE_ID_MAX) + 11, "profile", []string{"in_process"}, []string{}},
	APPLOG:            {int(flow_metrics.METRICS_TABLE_ID_MAX) + 12, "application_log", []string{"log"}, []string{}},
	DEEPFLOW_TENANT:   {int(flow_metrics.METRICS_TABLE_ID_MAX) + 13, "deepflow_tenant", []string{"deepflow_collector"}, []string{}},
	DEEPFLOW_ADMIN:    {int(flow_metrics.METRICS_TABLE_ID_MAX) + 14, "deepflow_admin", []string{"deepflow_server"}, []string{}},
}

to modify the datasource TTL, you need to also modify the 'flow_tag' database tables. FIXME: only the 'prometheus' database is supported now, and the remaining databases will be completed in the future.

Functions

func IsModifiedOnlyDatasource

func IsModifiedOnlyDatasource(datasource string) bool

func MakeCreateTableLocal

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

func MakeGlobalTableCreateSQL

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

func MakeMVTableCreateSQL

func MakeMVTableCreateSQL(t *ckdb.Table, db, 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 {
	OrgID        int    `json:"org-id"`
	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
	FlowTagTables []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(orgID int, action ActionEnum, dbGroup, 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 {
	OrgID int    `json:"org-id"`
	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 {
	OrgID    int    `json:"org-id"`
	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