kis-flow/common/const.go

102 lines
3.3 KiB
Go
Raw Permalink Normal View History

2023-12-30 17:38:08 +08:00
package common
2024-01-26 17:27:29 +08:00
import "time"
2024-04-15 17:50:02 +08:00
// Prefix string for generating KisId by users
2023-12-31 18:04:28 +08:00
const (
2024-04-15 17:50:02 +08:00
KisIDTypeFlow = "flow" // KisId type for Flow
KisIDTypeConnector = "conn" // KisId type for Connector
KisIDTypeFunction = "func" // KisId type for Function
KisIDTypeGlobal = "global" // KisId type for Global
KisIDJoinChar = "-" // Joining character for KisId
2023-12-31 18:04:28 +08:00
)
const (
2024-04-15 17:50:02 +08:00
// FunctionIDFirstVirtual is the virtual Function ID for the first node Function
FunctionIDFirstVirtual = "FunctionIDFirstVirtual"
// FunctionIDLastVirtual is the virtual Function ID for the last node Function
FunctionIDLastVirtual = "FunctionIDLastVirtual"
2023-12-31 18:04:28 +08:00
)
2024-04-15 17:50:02 +08:00
// KisMode represents the mode of KisFunction
2023-12-30 17:38:08 +08:00
type KisMode string
const (
2024-04-15 17:50:02 +08:00
// V is for Verify, which mainly performs data filtering, validation, field sorting, idempotence, etc.
2023-12-30 17:38:08 +08:00
V KisMode = "Verify"
2024-04-15 17:50:02 +08:00
// S is for Save, S Function will store data through KisConnector. Functions with the same Connector can logically merge.
2023-12-30 17:38:08 +08:00
S KisMode = "Save"
2024-04-15 17:50:02 +08:00
// L is for Load, L Function will load data through KisConnector. Functions with the same Connector can logically merge with corresponding S Function.
2023-12-30 17:38:08 +08:00
L KisMode = "Load"
2024-04-15 17:50:02 +08:00
// C is for Calculate, which can generate new fields, calculate new values, and perform data aggregation, analysis, etc.
2023-12-30 17:38:08 +08:00
C KisMode = "Calculate"
2024-04-15 17:50:02 +08:00
// E is for Expand, which serves as a custom feature Function for stream computing and is also the last Function in the current KisFlow, similar to Sink.
2023-12-30 17:38:08 +08:00
E KisMode = "Expand"
)
2023-12-31 10:50:01 +08:00
2024-04-15 17:50:02 +08:00
// KisOnOff Whether to enable the Flow
2023-12-31 10:50:01 +08:00
type KisOnOff int
const (
2024-04-15 17:50:02 +08:00
// FlowEnable Enabled
FlowEnable KisOnOff = 1
// FlowDisable Disabled
FlowDisable KisOnOff = 0
2023-12-31 10:50:01 +08:00
)
2023-12-31 11:45:47 +08:00
2024-04-15 17:50:02 +08:00
// KisConnType represents the type of KisConnector
2023-12-31 11:45:47 +08:00
type KisConnType string
const (
2024-04-15 17:50:02 +08:00
// REDIS is the type of Redis
2023-12-31 11:45:47 +08:00
REDIS KisConnType = "redis"
2024-04-15 17:50:02 +08:00
// MYSQL is the type of MySQL
2023-12-31 11:45:47 +08:00
MYSQL KisConnType = "mysql"
2024-04-15 17:50:02 +08:00
// KAFKA is the type of Kafka
2023-12-31 11:45:47 +08:00
KAFKA KisConnType = "kafka"
2024-04-15 17:50:02 +08:00
// TIDB is the type of TiDB
TIDB KisConnType = "tidb"
// ES is the type of Elasticsearch
ES KisConnType = "es"
2023-12-31 11:45:47 +08:00
)
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-04-15 17:50:02 +08:00
// DeFaultFlowCacheCleanUp is the default cleanup time for Cache in KisFlow's Flow object Cache
DeFaultFlowCacheCleanUp = 5 // unit: min
// DefaultExpiration is the default time for GoCahce, permanent storage
2024-01-26 17:27:29 +08:00
DefaultExpiration time.Duration = 0
2024-01-23 16:21:02 +08:00
)
2024-03-04 14:53:29 +08:00
// metrics
const (
2024-04-15 17:50:02 +08:00
MetricsRoute string = "/metrics"
2024-03-04 14:53:29 +08:00
2024-04-15 17:50:02 +08:00
LabelFlowName string = "flow_name"
LabelFlowID string = "flow_id"
LabelFunctionName string = "func_name"
LabelFunctionMode string = "func_mode"
2024-03-18 09:29:05 +08:00
2024-04-15 17:50:02 +08:00
CounterKisflowDataTotalName string = "kisflow_data_total"
CounterKisflowDataTotalHelp string = "Total data volume of all KisFlow Flows"
2024-03-18 09:29:05 +08:00
2024-04-15 17:50:02 +08:00
GamgeFlowDataTotalName string = "flow_data_total"
GamgeFlowDataTotalHelp string = "Total data volume of each KisFlow FlowID data stream"
2024-03-18 09:29:05 +08:00
2024-04-15 17:50:02 +08:00
GangeFlowScheCntsName string = "flow_schedule_cnts"
GangeFlowScheCntsHelp string = "Number of times each KisFlow FlowID is scheduled"
2024-03-18 09:29:05 +08:00
2024-04-15 17:50:02 +08:00
GangeFuncScheCntsName string = "func_schedule_cnts"
GangeFuncScheCntsHelp string = "Number of times each KisFlow Function is scheduled"
2024-03-18 09:29:05 +08:00
2024-04-15 17:50:02 +08:00
HistogramFunctionDurationName string = "func_run_duration"
HistogramFunctionDurationHelp string = "Function execution time"
2024-03-18 09:29:05 +08:00
2024-04-15 17:50:02 +08:00
HistogramFlowDurationName string = "flow_run_duration"
HistogramFlowDurationHelp string = "Flow execution time"
2024-03-04 14:53:29 +08:00
)