Skip to content

Commit

Permalink
1. add ebpf server
Browse files Browse the repository at this point in the history
2. add source manager

Signed-off-by: qianlu.kk <[email protected]>
  • Loading branch information
KayzzzZ authored and alph00 committed Aug 10, 2024
1 parent f6113dd commit 1fd7009
Show file tree
Hide file tree
Showing 21 changed files with 2,079 additions and 8 deletions.
2 changes: 1 addition & 1 deletion core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ set(SUB_DIRECTORIES_LIST
batch application app_config checkpoint compression config config/feedbacker config/provider config/watcher config_manager config_server_pb/v1 config_server_pb/v2
container_manager controller event event_handler event_listener file_server go_pipeline log_pb logger
models monitor parser pipeline plugin plugin/creator plugin/instance plugin/interface polling
profile_sender queue reader sdk sender serializer sls_control fuse prometheus sink/http route
profile_sender queue reader sdk sender serializer sls_control fuse prometheus sink/http route ebpf/observer ebpf/security ebpf/handler ebpf
)
if (LINUX)
if (ENABLE_ENTERPRISE)
Expand Down
53 changes: 53 additions & 0 deletions core/common/ParamExtractor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,20 @@ bool GetOptionalStringParam(const Json::Value& config, const string& key, string
return true;
}

bool GetOptionalDoubleParam(const Json::Value& config, const string& key, double& 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->isDouble()) {
errorMsg = "param " + key + " is not of type double";
return false;
}
param = itr->asDouble();
}
return true;
}

bool GetMandatoryBoolParam(const Json::Value& config, const string& key, bool& param, string& errorMsg) {
errorMsg.clear();
if (!config.isMember(ExtractCurrentKey(key))) {
Expand Down Expand Up @@ -127,6 +141,15 @@ bool GetMandatoryStringParam(const Json::Value& config, const string& key, strin
return true;
}

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

bool IsRegexValid(const string& regStr) {
if (regStr.empty()) {
return true;
Expand All @@ -139,4 +162,34 @@ bool IsRegexValid(const string& regStr) {
return true;
}

bool IsValidList(const Json::Value& config, const string& key, 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) {
errorMsg = "param " + key + " is missing";
return false;
}
if (!itr->isArray()) {
errorMsg = "param " + key + " is not of type list";
return false;
}
return true;
}

bool IsValidMap(const Json::Value& config, const string& key, 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) {
errorMsg = "param " + key + " is missing";
return false;
}
if (!itr->isObject()) {
errorMsg = "param " + key + " is not of type map";
return false;
}
return true;
}

} // namespace logtail
8 changes: 8 additions & 0 deletions core/common/ParamExtractor.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ bool GetOptionalStringParam(const Json::Value& config,
std::string& param,
std::string& errorMsg);

bool GetOptionalDoubleParam(const Json::Value& config, const std::string& key, double& param, std::string& errorMsg);

template <class T>
bool GetOptionalListParam(const Json::Value& config,
const std::string& key,
Expand Down Expand Up @@ -203,6 +205,8 @@ bool GetMandatoryStringParam(const Json::Value& config,
std::string& param,
std::string& errorMsg);

bool GetMandatoryDoubleParam(const Json::Value& config, const std::string& key, double& param, std::string& errorMsg);

template <class T>
bool GetMandatoryListParam(const Json::Value& config,
const std::string& key,
Expand All @@ -225,4 +229,8 @@ bool GetMandatoryListParam(const Json::Value& config,

bool IsRegexValid(const std::string& regStr);

bool IsValidList(const Json::Value& config, const std::string& key, std::string& errorMsg);

bool IsValidMap(const Json::Value& config, const std::string& key, std::string& errorMsg);

} // namespace logtail
Loading

0 comments on commit 1fd7009

Please sign in to comment.