Skip to content

support V2 config #1188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 130 commits into from
Dec 24, 2023
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
756d817
complete pipeline definition (#1185)
henryzhx8 Oct 18, 2023
04b64ad
polish code
henryzhx8 Oct 18, 2023
5b301b9
Merge remote-tracking branch 'upstream/main' into feat/pipeline
henryzhx8 Oct 19, 2023
ef6b2a0
polish code
henryzhx8 Oct 19, 2023
5b76185
add pipeline implementation
henryzhx8 Oct 21, 2023
18ce59b
Merge remote-tracking branch 'upstream/main' into feat/pipeline
henryzhx8 Oct 21, 2023
b81b5bf
polish code
henryzhx8 Oct 21, 2023
b0fb7b0
seperate params from input_file
henryzhx8 Oct 22, 2023
255e512
polish code
henryzhx8 Oct 23, 2023
fbe3121
polish code
henryzhx8 Oct 23, 2023
a3ccba1
add file server
henryzhx8 Oct 23, 2023
f9af3e4
polish code
henryzhx8 Oct 24, 2023
fe77de3
polish code
henryzhx8 Oct 24, 2023
e2b622a
polish code
henryzhx8 Oct 24, 2023
957f820
Merge remote-tracking branch 'upstream/main' into feat/pipeline
henryzhx8 Oct 29, 2023
ae09dbb
fix bug
henryzhx8 Oct 29, 2023
adc9d3f
polish code
henryzhx8 Oct 29, 2023
e8b30b4
fix bug
henryzhx8 Oct 30, 2023
01c138d
polish code
henryzhx8 Oct 30, 2023
73f1dc4
refactor code
henryzhx8 Oct 30, 2023
5a0083f
refactor event dispatcher
henryzhx8 Oct 31, 2023
77eb3db
remove global filter
henryzhx8 Oct 31, 2023
39a35ae
refactor app config
henryzhx8 Oct 31, 2023
22be81f
remove shennong and streamlog
henryzhx8 Oct 31, 2023
25a3418
fix bug
henryzhx8 Oct 31, 2023
a16470d
upgrade V1 config to V2
henryzhx8 Oct 31, 2023
6cecdf1
fix bug
henryzhx8 Oct 31, 2023
a341cda
refactor pipeline management
henryzhx8 Nov 14, 2023
5819cfe
add ut
henryzhx8 Nov 15, 2023
696ddb1
add ut
henryzhx8 Nov 16, 2023
05fa6a3
fix e2e
henryzhx8 Nov 16, 2023
4921b06
polish code
henryzhx8 Nov 17, 2023
fc7784a
for tmp use
henryzhx8 Nov 18, 2023
1974bfd
for tmp use
henryzhx8 Nov 18, 2023
be7981a
polish code
henryzhx8 Nov 19, 2023
6bf179f
for tmp use
henryzhx8 Nov 19, 2023
ae7d4d6
for tmp use
henryzhx8 Nov 19, 2023
5e56fa0
fix
henryzhx8 Nov 19, 2023
565337f
fix e2e
henryzhx8 Nov 20, 2023
a7eebaf
temporarily remove observer case
henryzhx8 Nov 20, 2023
0270a36
fix e2e
henryzhx8 Nov 20, 2023
0b51b20
fix e2e
henryzhx8 Nov 20, 2023
2b7123f
polish code
henryzhx8 Nov 20, 2023
d4e558b
Yaml (#3)
quzard Nov 20, 2023
83e0a92
polish code
henryzhx8 Nov 20, 2023
fb24ba3
fix e2e
henryzhx8 Nov 21, 2023
e51de7e
remove old config
henryzhx8 Nov 21, 2023
46ef30c
cleanup gflags
henryzhx8 Nov 21, 2023
7ff3f01
merge main into branch
henryzhx8 Nov 21, 2023
82472c0
fix bug
henryzhx8 Nov 21, 2023
dc5ec41
merge main into branch
henryzhx8 Nov 21, 2023
a5c4cd8
merge pipeline into branch
henryzhx8 Nov 21, 2023
42fba17
polish code
henryzhx8 Nov 23, 2023
98bd681
polish code
henryzhx8 Nov 23, 2023
263a4d3
polish code
henryzhx8 Nov 23, 2023
f6a8588
fix bug
henryzhx8 Nov 24, 2023
b245b70
polish code
henryzhx8 Nov 24, 2023
3f8fba6
polish code
henryzhx8 Nov 24, 2023
f7ab5d9
fix code
henryzhx8 Nov 26, 2023
330d390
polish code
henryzhx8 Nov 26, 2023
1c457aa
polish
henryzhx8 Nov 26, 2023
bdf622a
fix code
henryzhx8 Nov 26, 2023
340db5c
fix
henryzhx8 Nov 26, 2023
04a2fa7
fix
henryzhx8 Nov 27, 2023
924a95c
polish code
henryzhx8 Nov 27, 2023
d00df4c
fix
henryzhx8 Nov 27, 2023
4843055
fix
henryzhx8 Nov 28, 2023
57694f7
fix
henryzhx8 Nov 28, 2023
10a62a3
polish
henryzhx8 Nov 28, 2023
a2a1f16
polish
henryzhx8 Nov 28, 2023
b6069cc
polish code
henryzhx8 Nov 28, 2023
6b41e7c
test
henryzhx8 Nov 28, 2023
790db9c
merge upstream/main into branch
henryzhx8 Nov 28, 2023
cca9087
merge upstream/pipeline into branch
henryzhx8 Nov 28, 2023
22f76fd
test
henryzhx8 Nov 28, 2023
9f4cc0b
polish
henryzhx8 Nov 29, 2023
0e6d6fd
fix observer
henryzhx8 Nov 29, 2023
0564f97
polish test
henryzhx8 Nov 29, 2023
d1413e6
fix code
henryzhx8 Nov 29, 2023
3a5d24f
polish code
henryzhx8 Nov 29, 2023
53a27ba
polish code
henryzhx8 Nov 29, 2023
7781d0a
fix bug
henryzhx8 Nov 30, 2023
566a118
Pipeline processor (#2)
quzard Nov 30, 2023
2fdaa44
polish code
henryzhx8 Dec 3, 2023
23c41d6
polish
henryzhx8 Dec 3, 2023
1e685f7
polish
henryzhx8 Dec 3, 2023
6da4fb3
polish code
henryzhx8 Dec 4, 2023
3426d6d
Merge pull request #1238 from henryzhx8/stage4
henryzhx8 Dec 4, 2023
c3d0a9a
polish code
henryzhx8 Dec 4, 2023
500a83b
In order to achieve a relatively unified interface for SPL and other …
linrunqi08 Dec 5, 2023
3e8b2b1
polish code
henryzhx8 Dec 5, 2023
689c977
Merge remote-tracking branch 'upstream/feat/pipeline' into feat/pipeline
henryzhx8 Dec 5, 2023
f3fbeb2
polish
henryzhx8 Dec 5, 2023
5763b6a
polish
henryzhx8 Dec 5, 2023
71ae546
polish code
henryzhx8 Dec 5, 2023
61c31fd
polish
henryzhx8 Dec 5, 2023
0ecc49c
fix code
henryzhx8 Dec 6, 2023
75d3d24
fix
henryzhx8 Dec 6, 2023
2875046
fix
henryzhx8 Dec 7, 2023
229f4df
polish code
henryzhx8 Dec 7, 2023
8215df6
add log
henryzhx8 Dec 7, 2023
03451e0
fix
henryzhx8 Dec 7, 2023
7ae34b3
fix bug
henryzhx8 Dec 7, 2023
209d6c6
fix
henryzhx8 Dec 8, 2023
759d499
fix bug
henryzhx8 Dec 8, 2023
28d87ed
polish
henryzhx8 Dec 8, 2023
b801628
fix
quzard Dec 8, 2023
ba72059
fix
quzard Dec 8, 2023
448925e
fix
quzard Dec 8, 2023
736b1b1
fix
quzard Dec 8, 2023
a2a6935
merge remote branch into feat/pipeline
henryzhx8 Dec 8, 2023
3e50f45
fix
henryzhx8 Dec 8, 2023
fd4ac3b
Merge remote-tracking branch 'github_alibaba/feat/pipeline' into merg…
SteveYitao Dec 8, 2023
46d4cee
Merge remote-tracking branch 'github_alibaba/main' into mergeMain
SteveYitao Dec 8, 2023
814b3eb
fix
henryzhx8 Dec 8, 2023
328f04b
Merge processor changes of main branches (#1259)
quzard Dec 8, 2023
801405e
Merge remote-tracking branch 'github_alibaba/feat/pipeline' into merg…
SteveYitao Dec 8, 2023
aa436b9
Merge pull request #1261 from quzard/mergeMain
henryzhx8 Dec 8, 2023
9c9286c
polish
henryzhx8 Dec 9, 2023
33fe1d0
Merge remote-tracking branch 'upstream/feat/pipeline' into feat/pipeline
henryzhx8 Dec 9, 2023
e5c8af9
add alarm
Dec 11, 2023
456f718
polish
Dec 11, 2023
2e5733e
polish
Dec 11, 2023
9f02230
polish
Dec 11, 2023
94ff42a
Merge remote-tracking branch 'upstream/main' into feat/pipeline
Dec 11, 2023
2a01ca6
polish code
Dec 11, 2023
49a3f07
polish
Dec 11, 2023
2121627
Merge remote-tracking branch 'upstream/main' into feat/pipeline
Dec 23, 2023
4a3747a
polish code
Dec 23, 2023
0998621
polish
Dec 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/common/Version.cpp.in ${VERSION_CPP_F
if (UNIX)
if (WITHOUTGDB)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fpic -fPIC -D_LARGEFILE64_SOURCE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -fpic -fPIC -D_LARGEFILE64_SOURCE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -fpic -fPIC -D_LARGEFILE64_SOURCE")
else ()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -g -ggdb -fpic -fPIC -D_LARGEFILE64_SOURCE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -g -ggdb -fpic -fPIC -D_LARGEFILE64_SOURCE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -g -ggdb -fpic -fPIC -D_LARGEFILE64_SOURCE")
endif ()
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")
Expand Down Expand Up @@ -86,8 +86,8 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/dependencies.cmake)

# Subdirectories (modules).
set(SUB_DIRECTORIES_LIST
aggregator app_config checkpoint common config config_manager config_server_pb
controller event event_handler event_listener file_server go_pipeline helper input log_pb logger models monitor
aggregator app_config checkpoint common config config_manager config_server_pb container_manager
controller event event_handler event_listener file_server flusher go_pipeline helper input log_pb logger models monitor
parser pipeline plugin plugin/creator plugin/instance plugin/interface polling processor processor/daemon profile_sender reader sdk sender shennong sls_control
fuse
)
Expand Down
20 changes: 10 additions & 10 deletions core/common/LogtailCommonFlags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
#include "LogtailCommonFlags.h"

// Windows only has polling, give a bigger tail limit.
#if defined(__linux__)
DEFINE_FLAG_INT32(default_tail_limit_kb,
"when first open file, if offset little than this value, move offset to beginning, KB",
1024);
#elif defined(_MSC_VER)
DEFINE_FLAG_INT32(default_tail_limit_kb,
"when first open file, if offset little than this value, move offset to beginning, KB",
1024 * 50);
#endif
// #if defined(__linux__)
// DEFINE_FLAG_INT32(default_tail_limit_kb,
// "when first open file, if offset little than this value, move offset to beginning, KB",
// 1024);
// #elif defined(_MSC_VER)
// DEFINE_FLAG_INT32(default_tail_limit_kb,
// "when first open file, if offset little than this value, move offset to beginning, KB",
// 1024 * 50);
// #endif
DEFINE_FLAG_INT32(monitor_interval, "program monitor interval, seconds", 30);
DEFINE_FLAG_DOUBLE(cpu_usage_up_limit, "cpu usage upper limit, cores", 2.0);
DEFINE_FLAG_DOUBLE(pub_cpu_usage_up_limit, "cpu usage upper limit, cores", 0.4);
Expand Down Expand Up @@ -71,7 +71,7 @@ DEFINE_FLAG_STRING(local_machine_uuid, "use this value if not empty, for ut/debu
DEFINE_FLAG_STRING(user_defined_id_file, "", "user_defined_id");
DEFINE_FLAG_STRING(logtail_sys_conf_users_dir, "", "users");
DEFINE_FLAG_INT32(sls_client_send_timeout, "timeout time of one operation for SlsClient", 15);
DEFINE_FLAG_BOOL(sls_client_send_compress, "whether compresses the data or not when put data", true);
// DEFINE_FLAG_BOOL(sls_client_send_compress, "whether compresses the data or not when put data", true);
DEFINE_FLAG_INT32(send_retrytimes, "how many times should retry if PostLogStoreLogs operation fail", 3);
DEFINE_FLAG_INT32(default_StreamLog_tcp_port, "", 11111);
DEFINE_FLAG_INT32(default_StreamLog_poll_size_in_mb, "", 50);
Expand Down
4 changes: 2 additions & 2 deletions core/common/LogtailCommonFlags.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/////////////////////////////////////////////////////////////////////////

DECLARE_FLAG_INT32(default_max_inotify_watch_num);
DECLARE_FLAG_INT32(default_tail_limit_kb);
// DECLARE_FLAG_INT32(default_tail_limit_kb);
DECLARE_FLAG_STRING(logtail_send_address);
DECLARE_FLAG_STRING(logtail_config_address);
DECLARE_FLAG_INT32(cpu_limit_num);
Expand Down Expand Up @@ -56,7 +56,7 @@ DECLARE_FLAG_STRING(default_aliuid);
DECLARE_FLAG_STRING(default_access_key_id);
DECLARE_FLAG_STRING(default_access_key);
DECLARE_FLAG_INT32(sls_client_send_timeout);
DECLARE_FLAG_BOOL(sls_client_send_compress);
// DECLARE_FLAG_BOOL(sls_client_send_compress);
DECLARE_FLAG_INT32(send_retrytimes);
DECLARE_FLAG_STRING(user_log_config);
DECLARE_FLAG_STRING(ilogtail_config);
Expand Down
142 changes: 142 additions & 0 deletions core/common/ParamExtractor.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
// Copyright 2023 iLogtail Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "common/ParamExtractor.h"

#include "boost/regex.hpp"

using namespace std;

namespace logtail {

string ExtractCurrentKey(const string& key) {
size_t pos = key.rfind('.');
if (pos == string::npos) {
return key;
}
return key.substr(pos + 1);
}

bool GetOptionalBoolParam(const Json::Value& config, const string& key, bool& param, string& errorMsg) {
errorMsg.clear();
string curKey = ExtractCurrentKey(key);
const Json::Value* itr = config.find(curKey.c_str(), curKey.c_str() + curKey.length());
if (itr != nullptr) {
if (!itr->isBool()) {
errorMsg = "param " + key + " is not of type bool";
return false;
}
param = itr->asBool();
}
return true;
}

bool GetOptionalIntParam(const Json::Value& config, const string& key, int32_t& param, string& errorMsg) {
errorMsg.clear();
string curKey = ExtractCurrentKey(key);
const Json::Value* itr = config.find(curKey.c_str(), curKey.c_str() + curKey.length());
if (itr != nullptr) {
if (!itr->isInt()) {
errorMsg = "param " + key + " is not of type int";
return false;
}
param = itr->asInt();
}
return true;
}

bool GetOptionalUIntParam(const Json::Value& config, const string& key, uint32_t& param, string& errorMsg) {
errorMsg.clear();
string curKey = ExtractCurrentKey(key);
const Json::Value* itr = config.find(curKey.c_str(), curKey.c_str() + curKey.length());
if (itr != nullptr) {
if (!itr->isUInt()) {
errorMsg = "param " + key + " is not of type uint";
return false;
}
param = itr->asUInt();
}
return true;
}

bool GetOptionalStringParam(const Json::Value& config, const string& key, string& param, string& errorMsg) {
errorMsg.clear();
string curKey = ExtractCurrentKey(key);
const Json::Value* itr = config.find(curKey.c_str(), curKey.c_str() + curKey.length());
if (itr != nullptr) {
if (!itr->isString()) {
errorMsg = "param " + key + " is not of type string";
return false;
}
param = itr->asString();
}
return true;
}

bool GetMandatoryBoolParam(const Json::Value& config, const string& key, bool& param, string& errorMsg) {
errorMsg.clear();
if (!config.isMember(ExtractCurrentKey(key))) {
errorMsg = "madatory param " + key + " is missing";
return false;
}
return GetOptionalBoolParam(config, key, param, errorMsg);
}

bool GetMandatoryIntParam(const Json::Value& config, const string& key, int32_t& param, string& errorMsg) {
errorMsg.clear();
if (!config.isMember(ExtractCurrentKey(key))) {
errorMsg = "madatory param " + key + " is missing";
return false;
}
return GetOptionalIntParam(config, key, param, errorMsg);
}

bool GetMandatoryUIntParam(const Json::Value& config, const string& key, uint32_t& param, string& errorMsg) {
errorMsg.clear();
if (!config.isMember(ExtractCurrentKey(key))) {
errorMsg = "madatory param " + key + " is missing";
return false;
}
return GetOptionalUIntParam(config, key, param, errorMsg);
}

bool GetMandatoryStringParam(const Json::Value& config, const string& key, string& param, string& errorMsg) {
errorMsg.clear();
if (!config.isMember(ExtractCurrentKey(key))) {
errorMsg = "madatory param " + key + " is missing";
return false;
}
if (!GetOptionalStringParam(config, key, param, errorMsg)) {
return false;
}
if (param.empty()) {
errorMsg = "madatory string param " + key + " is empty";
return false;
}
return true;
}

bool IsRegexValid(const string& regStr) {
if (regStr.empty()) {
return true;
}
try {
boost::regex reg(regStr);
} catch (...) {
return false;
}
return true;
}

} // namespace logtail
Loading