Skip to content

Commit

Permalink
[WIP]: add metric new (#1015)
Browse files Browse the repository at this point in the history
* add metric

* refine code

* refine code

* refine code

* refine code

* refine code

* add exportor

* add exportor

* refine code and test

* refine code

* fix comment

* fix comment

* fix raw ptr

* fix comment

* add change log

* add group by region

* fix comments

* fix cooment

* fix cooment

* fix comments

* refine code

* refine code

* refine code

* refine code

* refine code

* refine code

* refine code

* refine code

* refine code

* refine code

* refine code

* refine code

* refine coder

* refine coder

* refine code

* refine code

* refine code

* refine code

* refine code
  • Loading branch information
linrunqi08 authored Aug 24, 2023
1 parent 06ca877 commit 733f853
Show file tree
Hide file tree
Showing 70 changed files with 961 additions and 111 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ your changes, such as:
- [public] [both] [updated] add a new feature

## [Unreleased]

- [public] [both] [added] add new logtail metric module
5 changes: 2 additions & 3 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,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 helper log_pb logger monitor
parser plugin polling processor profiler reader profile_sender sender shennong sdk
controller event event_handler event_listener helper log_pb logger monitor
parser plugin polling processor reader profile_sender sender shennong sdk
fuse sls_control
)
if (UNIX)
Expand Down Expand Up @@ -120,7 +120,6 @@ target_link_libraries(${LOGTAIL_TARGET}
plugin
monitor
sender
profiler
profile_sender
app_config
sls_control
Expand Down
2 changes: 1 addition & 1 deletion core/aggregator/Aggregator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

#include <processor/LogFilter.h>
#include <profiler/LogFileProfiler.h>
#include <monitor/LogFileProfiler.h>
#include <common/Constants.h>
#include <config_manager/ConfigManager.h>
#include <common/StringTools.h>
Expand Down
2 changes: 1 addition & 1 deletion core/aggregator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ target_link_libraries(${PROJECT_NAME} common)
target_link_libraries(${PROJECT_NAME} config_manager)
target_link_libraries(${PROJECT_NAME} sender)
target_link_libraries(${PROJECT_NAME} shennong)
target_link_libraries(${PROJECT_NAME} profiler)
target_link_libraries(${PROJECT_NAME} monitor)
4 changes: 2 additions & 2 deletions core/app_config/AppConfigBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
#endif
#include "shennong/MetricSender.h"
#include "sender/Sender.h"
#include "profiler/LogFileProfiler.h"
#include "profiler/LogtailAlarm.h"
#include "monitor/LogFileProfiler.h"
#include "monitor/LogtailAlarm.h"
#include "monitor/Monitor.h"
#include "common/util.h"
#include "common/LogtailCommonFlags.h"
Expand Down
2 changes: 1 addition & 1 deletion core/app_config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ target_link_libraries(${PROJECT_NAME} common)
target_link_libraries(${PROJECT_NAME} config_manager)
target_link_libraries(${PROJECT_NAME} sender)
target_link_libraries(${PROJECT_NAME} shennong)
target_link_libraries(${PROJECT_NAME} profiler)
target_link_libraries(${PROJECT_NAME} monitor)
2 changes: 1 addition & 1 deletion core/checkpoint/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ append_source_files(LIB_SOURCE_FILES)
add_library(${PROJECT_NAME} STATIC ${LIB_SOURCE_FILES})
target_link_libraries(${PROJECT_NAME} common)
target_link_libraries(${PROJECT_NAME} logger)
target_link_libraries(${PROJECT_NAME} profiler)
target_link_libraries(${PROJECT_NAME} monitor)
target_link_libraries(${PROJECT_NAME} config_manager)
target_link_libraries(${PROJECT_NAME} app_config)
link_leveldb(${PROJECT_NAME})
2 changes: 1 addition & 1 deletion core/checkpoint/CheckPointManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <fstream>
#include <thread>
#include <fcntl.h>
#include "profiler/LogtailAlarm.h"
#include "monitor/LogtailAlarm.h"
#include "app_config/AppConfig.h"
#include "config_manager/ConfigManager.h"
#include "common/Flags.h"
Expand Down
2 changes: 1 addition & 1 deletion core/checkpoint/CheckpointManagerV2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "common/ScopeInvoker.h"
#include "common/TimeUtil.h"
#include "logger/Logger.h"
#include "profiler/LogtailAlarm.h"
#include "monitor/LogtailAlarm.h"
#include "app_config/AppConfig.h"
#include "config/Config.h"
#include "config_manager/ConfigManager.h"
Expand Down
2 changes: 1 addition & 1 deletion core/common/LogFileCollectOffsetIndicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "LogFileCollectOffsetIndicator.h"
#include <vector>
#include <algorithm>
#include "profiler/LogtailAlarm.h"
#include "monitor/LogtailAlarm.h"
#include "common/Flags.h"
#include "common/LogstoreSenderQueue.h"
#include "sender/Sender.h"
Expand Down
2 changes: 1 addition & 1 deletion core/common/LogGroupContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#pragma once
#include "config/IntegrityConfig.h"
#include "profiler/LogtailAlarm.h"
#include "monitor/LogtailAlarm.h"
#include "FileInfo.h"
#include "RangeCheckpoint.h"

Expand Down
2 changes: 1 addition & 1 deletion core/common/LogstoreSenderQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "LogstoreSenderQueue.h"
#include "common/Flags.h"
#include "common/StringTools.h"
#include "profiler/LogtailAlarm.h"
#include "monitor/LogtailAlarm.h"


DEFINE_FLAG_INT32(max_client_send_error_count, "set disabled if last send is all failed", 60);
Expand Down
2 changes: 1 addition & 1 deletion core/config_manager/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ target_link_libraries(${PROJECT_NAME} config_server_pb)
target_link_libraries(${PROJECT_NAME} controller)
target_link_libraries(${PROJECT_NAME} event_handler)
target_link_libraries(${PROJECT_NAME} sender)
target_link_libraries(${PROJECT_NAME} profiler)
target_link_libraries(${PROJECT_NAME} monitor)
target_link_libraries(${PROJECT_NAME} checkpoint)
target_link_libraries(${PROJECT_NAME} app_config)
target_link_libraries(${PROJECT_NAME} processor)
Expand Down
8 changes: 4 additions & 4 deletions core/config_manager/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
#include "common/GlobalPara.h"
#include "common/version.h"
#include "config/UserLogConfigParser.h"
#include "profiler/LogtailAlarm.h"
#include "profiler/LogFileProfiler.h"
#include "profiler/LogIntegrity.h"
#include "profiler/LogLineCount.h"
#include "monitor/LogtailAlarm.h"
#include "monitor/LogFileProfiler.h"
#include "monitor/LogIntegrity.h"
#include "monitor/LogLineCount.h"
#include "sdk/Common.h"
#include "sdk/CurlImp.h"
#include "sdk/Exception.h"
Expand Down
8 changes: 4 additions & 4 deletions core/config_manager/ConfigManagerBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
#include "common/GlobalPara.h"
#include "common/version.h"
#include "config/UserLogConfigParser.h"
#include "profiler/LogtailAlarm.h"
#include "profiler/LogFileProfiler.h"
#include "profiler/LogIntegrity.h"
#include "profiler/LogLineCount.h"
#include "monitor/LogtailAlarm.h"
#include "monitor/LogFileProfiler.h"
#include "monitor/LogIntegrity.h"
#include "monitor/LogLineCount.h"
#include "app_config/AppConfig.h"
#include "config_manager/ConfigYamlToJson.h"
#include "checkpoint/CheckPointManager.h"
Expand Down
2 changes: 1 addition & 1 deletion core/controller/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ target_link_libraries(${PROJECT_NAME} event)
target_link_libraries(${PROJECT_NAME} event_handler)
target_link_libraries(${PROJECT_NAME} event_listener)
target_link_libraries(${PROJECT_NAME} sender)
target_link_libraries(${PROJECT_NAME} profiler)
target_link_libraries(${PROJECT_NAME} monitor)
target_link_libraries(${PROJECT_NAME} app_config)
target_link_libraries(${PROJECT_NAME} log_pb)
target_link_libraries(${PROJECT_NAME} shennong)
Expand Down
8 changes: 4 additions & 4 deletions core/controller/EventDispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@
#include "event/Event.h"
#include "processor/LogProcess.h"
#include "sender/Sender.h"
#include "profiler/LogFileProfiler.h"
#include "profiler/LogtailAlarm.h"
#include "profiler/LogIntegrity.h"
#include "profiler/LogLineCount.h"
#include "monitor/LogFileProfiler.h"
#include "monitor/LogtailAlarm.h"
#include "monitor/LogIntegrity.h"
#include "monitor/LogLineCount.h"
#include "log_pb/metric.pb.h"
#include "log_pb/sls_logs.pb.h"
#include "checkpoint/CheckPointManager.h"
Expand Down
2 changes: 1 addition & 1 deletion core/controller/EventDispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <unordered_map>
#include <unordered_set>
#include <set>
#include "profiler/LogFileProfiler.h"
#include "monitor/LogFileProfiler.h"
#include "polling/PollingModify.h"
#include "polling/PollingDirFile.h"
#include "event_listener/EventListener.h"
Expand Down
10 changes: 6 additions & 4 deletions core/controller/EventDispatcherBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@
#include "event/Event.h"
#include "processor/LogProcess.h"
#include "sender/Sender.h"
#include "profiler/LogFileProfiler.h"
#include "profiler/LogtailAlarm.h"
#include "profiler/LogIntegrity.h"
#include "profiler/LogLineCount.h"
#include "monitor/LogFileProfiler.h"
#include "monitor/LogtailAlarm.h"
#include "monitor/LogIntegrity.h"
#include "monitor/LogLineCount.h"
#include "monitor/MetricExportor.h"
#include "log_pb/metric.pb.h"
#include "log_pb/sls_logs.pb.h"
#include "checkpoint/CheckPointManager.h"
Expand Down Expand Up @@ -878,6 +879,7 @@ bool EventDispatcherBase::Dispatch() {
DumpCheckPointPeriod(curTime);
if (curTime - lastCheckDir >= INT32_FLAG(main_loop_check_interval)) {
LogFileProfiler::GetInstance()->SendProfileData();
MetricExportor::GetInstance()->PushMetrics(false);
#if defined(__linux__)
CheckShennong();
#endif
Expand Down
2 changes: 1 addition & 1 deletion core/controller/EventDispatcherBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <unordered_map>
#include <unordered_set>
#include <set>
#include "profiler/LogFileProfiler.h"
#include "monitor/LogFileProfiler.h"
#include "polling/PollingModify.h"
#include "polling/PollingDirFile.h"
#include "event_listener/EventListener.h"
Expand Down
2 changes: 1 addition & 1 deletion core/event_handler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ target_link_libraries(${PROJECT_NAME} app_config)
target_link_libraries(${PROJECT_NAME} event)
target_link_libraries(${PROJECT_NAME} controller)
target_link_libraries(${PROJECT_NAME} config_manager)
target_link_libraries(${PROJECT_NAME} profiler)
target_link_libraries(${PROJECT_NAME} monitor)
target_link_libraries(${PROJECT_NAME} processor)
target_link_libraries(${PROJECT_NAME} fuse)
2 changes: 1 addition & 1 deletion core/event_handler/EventHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "event/BlockEventManager.h"
#include "controller/EventDispatcher.h"
#include "config_manager/ConfigManager.h"
#include "profiler/LogtailAlarm.h"
#include "monitor/LogtailAlarm.h"
#include "processor/LogProcess.h"
#include "logger/Logger.h"
#include "fuse/FuseFileBlacklist.h"
Expand Down
2 changes: 1 addition & 1 deletion core/event_handler/LogInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "monitor/Monitor.h"
#include "processor/LogProcess.h"
#include "controller/EventDispatcher.h"
#include "profiler/LogtailAlarm.h"
#include "monitor/LogtailAlarm.h"
#include "checkpoint/CheckPointManager.h"
#include "polling/PollingDirFile.h"
#include "polling/PollingModify.h"
Expand Down
2 changes: 1 addition & 1 deletion core/event_listener/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ target_link_libraries(${PROJECT_NAME} common)
target_link_libraries(${PROJECT_NAME} logger)
target_link_libraries(${PROJECT_NAME} polling)
target_link_libraries(${PROJECT_NAME} event)
target_link_libraries(${PROJECT_NAME} profiler)
target_link_libraries(${PROJECT_NAME} monitor)
target_link_libraries(${PROJECT_NAME} controller)
2 changes: 1 addition & 1 deletion core/event_listener/EventListener_Linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <unistd.h>
#include <sys/ioctl.h>
#include "logger/Logger.h"
#include "profiler/LogtailAlarm.h"
#include "monitor/LogtailAlarm.h"
#include "common/ErrorUtil.h"
#include "common/Flags.h"
#include "controller/EventDispatcher.h"
Expand Down
8 changes: 4 additions & 4 deletions core/logtail.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
#include "controller/EventDispatcher.h"
#include "monitor/Monitor.h"
#include "sender/Sender.h"
#include "profiler/LogtailAlarm.h"
#include "profiler/LogFileProfiler.h"
#include "profiler/LogIntegrity.h"
#include "profiler/LogLineCount.h"
#include "monitor/LogtailAlarm.h"
#include "monitor/LogFileProfiler.h"
#include "monitor/LogIntegrity.h"
#include "monitor/LogLineCount.h"
#include "app_config/AppConfig.h"
#include "ObserverManager.h"
using namespace logtail;
Expand Down
8 changes: 4 additions & 4 deletions core/logtail_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
#include "controller/EventDispatcher.h"
#include "monitor/Monitor.h"
#include "sender/Sender.h"
#include "profiler/LogtailAlarm.h"
#include "profiler/LogFileProfiler.h"
#include "profiler/LogIntegrity.h"
#include "profiler/LogLineCount.h"
#include "monitor/LogtailAlarm.h"
#include "monitor/LogFileProfiler.h"
#include "monitor/LogIntegrity.h"
#include "monitor/LogLineCount.h"
#include "app_config/AppConfig.h"
using namespace logtail;

Expand Down
1 change: 0 additions & 1 deletion core/monitor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ target_link_libraries(${PROJECT_NAME} common)
target_link_libraries(${PROJECT_NAME} logger)
target_link_libraries(${PROJECT_NAME} log_pb)
target_link_libraries(${PROJECT_NAME} sender)
target_link_libraries(${PROJECT_NAME} profiler)
target_link_libraries(${PROJECT_NAME} config_manager)
target_link_libraries(${PROJECT_NAME} app_config)
target_link_libraries(${PROJECT_NAME} event_handler)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 733f853

Please sign in to comment.