From fcb1c2dcd9d04c97c89223fe1efa0b8ec2186151 Mon Sep 17 00:00:00 2001 From: Jiyong Huang Date: Fri, 20 Sep 2024 14:15:24 +0800 Subject: [PATCH] chore(io): clean up io binder and logs Signed-off-by: Jiyong Huang --- etc/sources/sql.json | 342 ----------------------- etc/sources/sql.yaml | 8 - internal/meta/msgUtil.go | 3 +- internal/meta/sinkMeta.go | 1 - internal/meta/sourceMeta.go | 2 - internal/meta/yamlConfigMeta.go | 5 +- internal/server/prebuild_plugins.go | 4 +- internal/server/prebuild_plugins_full.go | 4 +- internal/server/server.go | 15 + 9 files changed, 21 insertions(+), 363 deletions(-) delete mode 100644 etc/sources/sql.json delete mode 100644 etc/sources/sql.yaml diff --git a/etc/sources/sql.json b/etc/sources/sql.json deleted file mode 100644 index 41df208cba..0000000000 --- a/etc/sources/sql.json +++ /dev/null @@ -1,342 +0,0 @@ -{ - "about": { - "trial": true, - "author": { - "name": "EMQ", - "email": "contact@emqx.io", - "company": "EMQ Technologies Co., Ltd", - "website": "https://www.emqx.io" - }, - "helpUrl": { - "en_US": "https://ekuiper.org/docs/en/latest/guide/sources/plugin/sql.html", - "zh_CN": "https://ekuiper.org/docs/zh/latest/guide/sources/plugin/sql.html" - }, - "description": { - "en_US": "Read message from sql database", - "zh_CN": "从数据库中读取消息" - } - }, - "dataSource": { - "default": "table1", - "hint": { - "en_US": "The SQL database to connect to, e.g. table1", - "zh_CN": "将要连接的关系数据库表,例如 table1" - }, - "label": { - "en_US": "Data Source (Table)", - "zh_CN": "数据源(表名)" - } - }, - "libs": [], - "properties": { - "default": [ - { - "name": "dburl", - "default": "", - "optional": false, - "control": "text", - "type": "string", - "hint": { - "en_US": "The url of the database, it is important to note that the password in the URL is url-encoded characters, and you need to re-enter the password when editing. For example, the database address of mysql is mysql://username:password@127.0.0.1:3306/testdb?parseTime=true, if the original password is 123:#?, the password here should be filled in with 123%3A%23%3F", - "zh_CN": "数据库服务器的 URL,需要特别注意的是 URL 中的密码为 url 编码后的字符,并且编辑时需要重新输入密码。例如,mysql 的数据库地址为 mysql://username:password@127.0.0.1:3306/testdb?parseTime=true,若原始密码为 123:#?,则这里的 password 应填入 123%3A%23%3F" - }, - "label": { - "en_US": "Server address", - "zh_CN": "数据库地址" - } - }, - { - "name": "interval", - "default": 1000, - "optional": true, - "control": "text", - "type": "int", - "hint": { - "en_US": "The interval (ms) to issue a query", - "zh_CN": "发出消息的间隔(毫秒)" - }, - "label": { - "en_US": "Interval", - "zh_CN": "间隔时间" - } - }, - { - "name": "lookup", - "default": { - "cache": { - "name": "cache", - "default": true, - "optional": true, - "control": "radio", - "type": "bool", - "hint": { - "en_US": "Whether to enable cache", - "zh_CN": "是否启用缓存" - }, - "label": { - "en_US": "Enable lookup cache", - "zh_CN": "开启查询缓存" - } - }, - "cacheTtl": { - "name": "cacheTtl", - "default": 600, - "optional": true, - "control": "text", - "type": "int", - "hint": { - "en_US": "The time to live of the cache in seconds", - "zh_CN": "缓存的生存时间(s)" - }, - "label": { - "en_US": "Cache TTL", - "zh_CN": "缓存时间" - } - }, - "cacheMissingKey": { - "name": "cacheMissingKey", - "default": true, - "optional": true, - "control": "radio", - "type": "bool", - "hint": { - "en_US": "Whether to cache nil value for a key", - "zh_CN": "是否对空值进行缓存" - }, - "label": { - "en_US": "Cache missing key", - "zh_CN": "缓存未命中的 Key" - } - } - }, - "optional": true, - "control": "list", - "type": "object", - "hint": { - "en_US": "Lookup table configuration, only effective when using as a lookup table", - "zh_CN": "查询表配置,仅在作为查询表使用时生效" - }, - "label": { - "en_US": "Lookup table configuration", - "zh_CN": "查询表配置" - } - }, - { - "name": "internalSqlQueryCfg", - "default": { - "table":{ - "name": "table", - "default": "", - "optional": true, - "control": "text", - "type": "string", - "hint": { - "en_US": "table name to query", - "zh_CN": "指定查询的数据库表名" - }, - "label": { - "en_US": "Table Name", - "zh_CN": "表名" - } - }, - "indexField": { - "name": "indexField", - "default": "", - "optional": true, - "control": "text", - "type": "string", - "hint": { - "en_US": "index field", - "zh_CN": "索引字段名" - }, - "label": { - "en_US": "Index Field", - "zh_CN": "索引字段名" - } - }, - "indexValue": { - "name": "indexValue", - "default": "", - "optional": true, - "control": "text", - "type": "string", - "hint": { - "en_US": "index init value", - "zh_CN": "索引字段初始值" - }, - "label": { - "en_US": "Index init value", - "zh_CN": "索引字段初始值" - } - }, - "limit": { - "name": "limit", - "default": 10, - "optional": true, - "control": "text", - "type": "int", - "hint": { - "en_US": "query result limit", - "zh_CN": "查询结果条数限制" - }, - "label": { - "en_US": "Limit", - "zh_CN": "查询条数限制" - } - }, - "indexFieldType": { - "name": "indexFieldType", - "default": "", - "optional": true, - "control": "select", - "type": "string", - "values": ["DATETIME", "INT"], - "hint": { - "en_US": "Column type for the indexField", - "zh_CN": "索引字段的列类型" - }, - "label": { - "en_US": "Index Field Type", - "zh_CN": "索引字段格式" - } - }, - "dateTimeFormat": { - "name": "dateTimeFormat", - "default": "", - "optional": true, - "control": "text", - "type": "string", - "hint": { - "en_US": "dateTimeFormat", - "zh_CN": "dateTimeFormat" - }, - "label": { - "en_US": "DateTime Format", - "zh_CN": "时间格式" - } - } - }, - "optional": true, - "control": "list", - "type": "object", - "hint": { - "en_US": "basic configuration for the query", - "zh_CN": "查询基础配置" - }, - "label": { - "en_US": "Query Parameters", - "zh_CN": "查询参数" - } - }, - { - "name": "templateSqlQueryCfg", - "default": { - "TemplateSql": { - "name": "TemplateSql", - "default": "", - "optional": false, - "control": "textarea", - "type": "string", - "hint": { - "en_US": "SQL statement template", - "zh_CN": "SQL 语句模版" - }, - "label": { - "en_US": "Query template", - "zh_CN": "查询语句模版" - } - }, - "indexField": { - "name": "indexField", - "default": "", - "optional": true, - "control": "text", - "type": "string", - "hint": { - "en_US": "Which column for the table act as index to record the offset", - "zh_CN": "表的哪一列作为索引来记录偏移量" - }, - "label": { - "en_US": "Index Field", - "zh_CN": "索引字段名" - } - }, - "indexValue": { - "name": "indexValue", - "default": "", - "optional": true, - "control": "text", - "type": "string", - "hint": { - "en_US": "Initial index value", - "zh_CN": "初始索引值" - }, - "label": { - "en_US": "Index init value", - "zh_CN": "索引字段初始值" - } - }, - "indexFieldType":{ - "name": "indexFieldType", - "default": "", - "optional": true, - "control": "select", - "type": "string", - "values": ["DATETIME", "INT"], - "hint": { - "en_US": "Column type for the indexField", - "zh_CN": "索引字段的列类型" - }, - "label": { - "en_US": "Index Field Type", - "zh_CN": "索引字段格式" - } - }, - "dateTimeFormat": { - "name": "dateTimeFormat", - "default": "", - "optional": true, - "control": "text", - "type": "string", - "hint": { - "en_US": "Data time format for the index field", - "zh_CN": "索引字段的时间格式" - }, - "label": { - "en_US": "DateTime Format", - "zh_CN": "时间格式" - } - } - }, - "optional": true, - "control": "list", - "type": "object", - "hint": { - "en_US": "Query Template", - "zh_CN": "查询模版" - }, - "label": { - "en_US": "Query Template", - "zh_CN": "查询模版" - } - } - ] - }, - "outputs": [ - { - "label": { - "en_US": "Output", - "zh_CN": "输出" - }, - "value": "signal" - } - ], - "node": { - "category": "source", - "icon": "iconPath", - "label": { - "en_US": "SQL", - "zh_CN": "SQL" - } - } -} diff --git a/etc/sources/sql.yaml b/etc/sources/sql.yaml deleted file mode 100644 index 72fe778738..0000000000 --- a/etc/sources/sql.yaml +++ /dev/null @@ -1,8 +0,0 @@ -default: - dburl: mysql://username:password@127.0.0.1:3306/testdb?parseTime=true - interval: "10s" - -mysql_config: - dburl: mysql://username:password@127.0.0.1:3306/testdb?parseTime=true - interval: "10s" - diff --git a/internal/meta/msgUtil.go b/internal/meta/msgUtil.go index e0beb385a1..2bbd61493a 100644 --- a/internal/meta/msgUtil.go +++ b/internal/meta/msgUtil.go @@ -1,4 +1,4 @@ -// Copyright 2021 EMQ Technologies Co., Ltd. +// Copyright 2021-2024 EMQ Technologies Co., Ltd. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -52,7 +52,6 @@ func ReadUiMsgDir() error { for _, entry := range dirEntries { fName := entry.Name() - kconf.Log.Infof("uiMsg file : %s", fName) fPath := path.Join(dir, fName) if conf, err := ini.Load(fPath); nil != err { return err diff --git a/internal/meta/sinkMeta.go b/internal/meta/sinkMeta.go index e639545283..f90128f31d 100644 --- a/internal/meta/sinkMeta.go +++ b/internal/meta/sinkMeta.go @@ -253,7 +253,6 @@ func ReadSinkMetaFile(filePath string, installed bool) error { return err } loadConfigOperatorForSink(strings.TrimSuffix(finame, `.json`)) - conf.Log.Infof("Loading metadata file for sink: %s", finame) return nil } diff --git a/internal/meta/sourceMeta.go b/internal/meta/sourceMeta.go index 76c6acf78f..6e3293bd93 100644 --- a/internal/meta/sourceMeta.go +++ b/internal/meta/sourceMeta.go @@ -132,7 +132,6 @@ func ReadSourceMetaDir(scanChecker InstallChecker, lookupChecker InstallChecker) if err = ReadSourceMetaFile(path.Join(confDir, "mqtt_source.json"), true, false); nil != err { return err } - conf.Log.Infof("Loading metadata file for source : %s", "mqtt_source.json") for _, entry := range dirEntries { fileName := entry.Name() @@ -145,7 +144,6 @@ func ReadSourceMetaDir(scanChecker InstallChecker, lookupChecker InstallChecker) if err = ReadSourceMetaFile(filePath, isScan, isLookup); nil != err { return err } - conf.Log.Infof("Loading metadata file for source : %s", fileName) } else { conf.Log.Warnf("Find source metadata file but not installed : %s", fileName) } diff --git a/internal/meta/yamlConfigMeta.go b/internal/meta/yamlConfigMeta.go index c6baa25c64..0422723dc8 100644 --- a/internal/meta/yamlConfigMeta.go +++ b/internal/meta/yamlConfigMeta.go @@ -1,4 +1,4 @@ -// Copyright 2022-2023 EMQ Technologies Co., Ltd. +// Copyright 2022-2024 EMQ Technologies Co., Ltd. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -71,7 +71,6 @@ func loadConfigOperatorForSource(pluginName string) { ConfigManager.lock.Lock() ConfigManager.cfgOperators[yamlKey] = cfg ConfigManager.lock.Unlock() - conf.Log.Infof("Loading yaml file for source: %s", pluginName) } } @@ -85,7 +84,6 @@ func loadConfigOperatorForSink(pluginName string) { ConfigManager.lock.Lock() ConfigManager.cfgOperators[yamlKey] = cfg ConfigManager.lock.Unlock() - conf.Log.Infof("Loading yaml file for sink: %s", pluginName) } } @@ -99,7 +97,6 @@ func loadConfigOperatorForConnection(pluginName string) { ConfigManager.lock.Lock() ConfigManager.cfgOperators[yamlKey] = cfg ConfigManager.lock.Unlock() - conf.Log.Infof("Loading yaml file for connection: %s", pluginName) } } diff --git a/internal/server/prebuild_plugins.go b/internal/server/prebuild_plugins.go index f9b4d3014b..06e690ddb5 100644 --- a/internal/server/prebuild_plugins.go +++ b/internal/server/prebuild_plugins.go @@ -1,4 +1,4 @@ -// Copyright 2023 EMQ Technologies Co., Ltd. +// Copyright 2023-2024 EMQ Technologies Co., Ltd. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,6 +18,6 @@ package server var ( NativeSourcePlugin = []string{"random", "zmq", "sql", "video", "kafka"} - NativeSinkPlugin = []string{"image", "influx", "influx2", "tdengine", "zmq", "kafka", "sql"} + NativeSinkPlugin = []string{"image", "influx", "influx2", "zmq", "kafka", "sql"} NativeFunctionPlugin = []string{"accumulateWordCount", "countPlusOne", "echo", "geohash", "image", "labelImage", "tfLite"} ) diff --git a/internal/server/prebuild_plugins_full.go b/internal/server/prebuild_plugins_full.go index 3871710e18..1a1beb6a7a 100644 --- a/internal/server/prebuild_plugins_full.go +++ b/internal/server/prebuild_plugins_full.go @@ -1,4 +1,4 @@ -// Copyright 2023 EMQ Technologies Co., Ltd. +// Copyright 2023-2024 EMQ Technologies Co., Ltd. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,6 +18,6 @@ package server var ( NativeSourcePlugin = []string{"zmq"} - NativeSinkPlugin = []string{"tdengine", "zmq"} + NativeSinkPlugin = []string{"zmq"} NativeFunctionPlugin = []string{"accumulateWordCount", "countPlusOne", "echo", "geohash", "image", "labelImage", "tfLite"} ) diff --git a/internal/server/server.go b/internal/server/server.go index adb74d765e..4229a16f17 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -47,6 +47,7 @@ import ( "github.com/lf-edge/ekuiper/v2/internal/topo/rule" "github.com/lf-edge/ekuiper/v2/pkg/cast" "github.com/lf-edge/ekuiper/v2/pkg/connection" + "github.com/lf-edge/ekuiper/v2/pkg/modules" "github.com/lf-edge/ekuiper/v2/pkg/tracer" ) @@ -138,6 +139,20 @@ func StartUp(Version string) { conf.SetupEnv() conf.InitConf() + // Print inited modules + for n := range modules.Sources { + conf.Log.Infof("register source %s", n) + } + for n := range modules.Sinks { + conf.Log.Infof("register sink %s", n) + } + for n := range modules.LookupSources { + conf.Log.Infof("register lookup source %s", n) + } + for n := range modules.Converters { + conf.Log.Infof("register format %s", n) + } + serverCtx, serverCancel := context.WithCancel(context.Background()) if conf.Config.Basic.EnableResourceProfiling { err := StartCPUProfiling(serverCtx, &ekuiperProfile{})