2023-12-30 17:38:08 +08:00
|
|
|
|
package common
|
|
|
|
|
|
2024-01-26 17:27:29 +08:00
|
|
|
|
import "time"
|
|
|
|
|
|
2024-01-03 17:22:35 +08:00
|
|
|
|
// 用户生成KisId的字符串前缀
|
2023-12-31 18:04:28 +08:00
|
|
|
|
const (
|
2024-03-01 16:29:07 +08:00
|
|
|
|
KisIdTypeFlow = "flow"
|
|
|
|
|
KisIdTypeConnector = "conn"
|
|
|
|
|
KisIdTypeFunction = "func"
|
|
|
|
|
KisIdTypeGlobal = "global"
|
|
|
|
|
KisIdJoinChar = "-"
|
2023-12-31 18:04:28 +08:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
// FunctionIdFirstVirtual 为首结点Function上一层虚拟的Function ID
|
|
|
|
|
FunctionIdFirstVirtual = "FunctionIdFirstVirtual"
|
|
|
|
|
// FunctionIdLastVirtual 为尾结点Function下一层虚拟的Function ID
|
|
|
|
|
FunctionIdLastVirtual = "FunctionIdLastVirtual"
|
|
|
|
|
)
|
|
|
|
|
|
2023-12-30 17:38:08 +08:00
|
|
|
|
type KisMode string
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
// V 为校验特征的KisFunction, 主要进行数据的过滤,验证,字段梳理,幂等等前置数据处理
|
|
|
|
|
V KisMode = "Verify"
|
|
|
|
|
|
2024-03-28 14:57:35 +08:00
|
|
|
|
// S 为存储特征的KisFunction, S会通过KisConnector进行将数据进行存储. S Function 会通过KisConnector进行数据存储,具备相同Connector的Function在逻辑上可以进行并流
|
2023-12-30 17:38:08 +08:00
|
|
|
|
S KisMode = "Save"
|
|
|
|
|
|
2024-03-28 14:57:35 +08:00
|
|
|
|
// L 为加载特征的KisFunction,L会通过KisConnector进行数据加载,L Function 会通过KisConnector进行数据读取,具备相同Connector的Function可以从逻辑上与对应的S Function进行并流
|
2023-12-30 17:38:08 +08:00
|
|
|
|
L KisMode = "Load"
|
|
|
|
|
|
2024-03-28 14:57:35 +08:00
|
|
|
|
// C 为计算特征的KisFunction, 可以生成新的字段,计算新的值,进行数据的聚合,分析等
|
2023-12-30 17:38:08 +08:00
|
|
|
|
C KisMode = "Calculate"
|
|
|
|
|
|
2024-03-28 14:57:35 +08:00
|
|
|
|
// E 为扩展特征的KisFunction,作为流式计算的自定义特征Function,也同时是KisFlow当前流中的最后一个Function,概念类似Sink。
|
2023-12-30 17:38:08 +08:00
|
|
|
|
E KisMode = "Expand"
|
|
|
|
|
)
|
2023-12-31 10:50:01 +08:00
|
|
|
|
|
|
|
|
|
/*
|
2024-03-01 16:29:07 +08:00
|
|
|
|
是否启动Flow
|
2023-12-31 10:50:01 +08:00
|
|
|
|
*/
|
|
|
|
|
type KisOnOff int
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
FlowEnable KisOnOff = 1 // 启动
|
|
|
|
|
FlowDisable KisOnOff = 0 // 不启动
|
|
|
|
|
)
|
2023-12-31 11:45:47 +08:00
|
|
|
|
|
|
|
|
|
type KisConnType string
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
REDIS KisConnType = "redis"
|
|
|
|
|
MYSQL KisConnType = "mysql"
|
|
|
|
|
KAFKA KisConnType = "kafka"
|
|
|
|
|
TIDB KisConnType = "tidb"
|
|
|
|
|
ES KisConnType = "es"
|
|
|
|
|
)
|
2024-01-23 16:21:02 +08:00
|
|
|
|
|
2024-01-26 17:27:29 +08:00
|
|
|
|
// cache
|
2024-01-23 16:21:02 +08:00
|
|
|
|
const (
|
2024-01-26 17:27:29 +08:00
|
|
|
|
// DeFaultFlowCacheCleanUp KisFlow中Flow对象Cache缓存默认的清理内存时间
|
2024-03-01 16:29:07 +08:00
|
|
|
|
DeFaultFlowCacheCleanUp = 5 // 单位 min
|
2024-01-26 17:27:29 +08:00
|
|
|
|
// DefaultExpiration 默认GoCahce时间 ,永久保存
|
|
|
|
|
DefaultExpiration time.Duration = 0
|
2024-01-23 16:21:02 +08:00
|
|
|
|
)
|
2024-03-04 14:53:29 +08:00
|
|
|
|
|
|
|
|
|
// metrics
|
|
|
|
|
const (
|
|
|
|
|
METRICS_ROUTE string = "/metrics"
|
|
|
|
|
|
2024-03-18 09:29:05 +08:00
|
|
|
|
LABEL_FLOW_NAME string = "flow_name"
|
|
|
|
|
LABEL_FLOW_ID string = "flow_id"
|
|
|
|
|
LABEL_FUNCTION_NAME string = "func_name"
|
|
|
|
|
LABEL_FUNCTION_MODE string = "func_mode"
|
|
|
|
|
|
2024-03-04 14:53:29 +08:00
|
|
|
|
COUNTER_KISFLOW_DATA_TOTAL_NAME string = "kisflow_data_total"
|
|
|
|
|
COUNTER_KISFLOW_DATA_TOTAL_HELP string = "KisFlow全部Flow的数据总量"
|
2024-03-18 09:29:05 +08:00
|
|
|
|
|
|
|
|
|
GANGE_FLOW_DATA_TOTAL_NAME string = "flow_data_total"
|
|
|
|
|
GANGE_FLOW_DATA_TOTAL_HELP string = "KisFlow各个FlowID数据流的数据数量总量"
|
|
|
|
|
|
|
|
|
|
GANGE_FLOW_SCHE_CNTS_NAME string = "flow_schedule_cnts"
|
|
|
|
|
GANGE_FLOW_SCHE_CNTS_HELP string = "KisFlow各个FlowID被调度的次数"
|
|
|
|
|
|
|
|
|
|
GANGE_FUNC_SCHE_CNTS_NAME string = "func_schedule_cnts"
|
|
|
|
|
GANGE_FUNC_SCHE_CNTS_HELP string = "KisFlow各个Function被调度的次数"
|
|
|
|
|
|
|
|
|
|
HISTOGRAM_FUNCTION_DURATION_NAME string = "func_run_duration"
|
|
|
|
|
HISTOGRAM_FUNCTION_DURATION_HELP string = "Function执行耗时"
|
|
|
|
|
|
|
|
|
|
HISTOGRAM_FLOW_DURATION_NAME string = "flow_run_duration"
|
|
|
|
|
HISTOGRAM_FLOW_DURATION_HELP string = "Flow执行耗时"
|
2024-03-04 14:53:29 +08:00
|
|
|
|
)
|