Skip to content

DNM: experiment with source structure #2098

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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 7 additions & 6 deletions collector/collector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ extern "C" {
#include <sys/syscall.h>
#include <sys/types.h>
}
#include "grpc/GRPC.h"
#include "grpc/GRPCUtil.h"

#include "AbortHandler.h"
#include "CollectorArgs.h"
#include "CollectorService.h"
Expand All @@ -35,14 +38,12 @@ extern "C" {
#include "Control.h"
#include "Diagnostics.h"
#include "EventNames.h"
#include "FileSystem.h"
#include "GRPC.h"
#include "GRPCUtil.h"
#include "GetStatus.h"
#include "HostInfo.h"
#include "LogLevel.h"
#include "Logging.h"
#include "Utility.h"
#include "log/LogLevel.h"
#include "log/Logging.h"
#include "utils/FileSystem.h"
#include "utils/Utility.h"

static const int MAX_GRPC_CONNECTION_POLLS = 30;

Expand Down
2 changes: 1 addition & 1 deletion collector/connscrape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include <iostream>

#include "EnvVar.h"
#include "ProcfsScraper.h"
#include "utils/EnvVar.h"

using namespace collector;

Expand Down
2 changes: 1 addition & 1 deletion collector/lib/AbortHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extern "C" {
#include <unistd.h>
}

#include "Utility.h"
#include "utils/Utility.h"

// Standards before C++17 [1] specify that a signal handler installed via
// std::signal should have a C language linkage, otherwise resulting in
Expand Down
3 changes: 3 additions & 0 deletions collector/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
file(GLOB COLLECTOR_LIB_SRC_FILES
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/log/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/grpc/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/utils/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/system-inspector/*.cpp
)

Expand Down
2 changes: 1 addition & 1 deletion collector/lib/CollectionMethod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include <sys/types.h>

#include "Logging.h"
#include "log/Logging.h"

namespace collector {

Expand Down
5 changes: 3 additions & 2 deletions collector/lib/CollectorArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
#include <sstream>
#include <string>

#include "grpc/GRPC.h"

#include "CollectorConfig.h"
#include "GRPC.h"
#include "Logging.h"
#include "log/Logging.h"
#include "optionparser.h"

namespace collector {
Expand Down
9 changes: 5 additions & 4 deletions collector/lib/CollectorConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@

#include <libsinsp/sinsp.h>

#include "grpc/GRPC.h"

#include "CollectionMethod.h"
#include "CollectorArgs.h"
#include "EnvVar.h"
#include "GRPC.h"
#include "HostHeuristics.h"
#include "HostInfo.h"
#include "Logging.h"
#include "TlsConfig.h"
#include "Utility.h"
#include "log/Logging.h"
#include "optionparser.h"
#include "utils/EnvVar.h"
#include "utils/Utility.h"

namespace collector {

Expand Down
2 changes: 1 addition & 1 deletion collector/lib/CollectorConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

#include "CollectionMethod.h"
#include "HostConfig.h"
#include "Logging.h"
#include "NetworkConnection.h"
#include "TlsConfig.h"
#include "json/value.h"
#include "log/Logging.h"
#include "optionparser.h"

namespace collector {
Expand Down
3 changes: 2 additions & 1 deletion collector/lib/CollectorRuntimeConfigInspector.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#include "CollectorRuntimeConfigInspector.h"

#include <Logging.h>
#include <string>

#include <log/Logging.h>

#include <google/protobuf/util/json_util.h>

namespace collector {
Expand Down
7 changes: 4 additions & 3 deletions collector/lib/CollectorService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@

#include <memory>

#include "grpc/GRPCUtil.h"

#include "CollectionMethod.h"
#include "CollectorRuntimeConfigInspector.h"
#include "CollectorStatsExporter.h"
#include "ConfigLoader.h"
#include "ConnTracker.h"
#include "ContainerInfoInspector.h"
#include "Diagnostics.h"
#include "GRPCUtil.h"
#include "GetStatus.h"
#include "LogLevel.h"
#include "NetworkSignalHandler.h"
#include "NetworkStatusInspector.h"
#include "NetworkStatusNotifier.h"
#include "ProfilerHandler.h"
#include "Utility.h"
#include "log/LogLevel.h"
#include "system-inspector/Service.h"
#include "utils/Utility.h"

namespace collector {

Expand Down
2 changes: 1 addition & 1 deletion collector/lib/CollectorStats.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <unordered_map>
#include <vector>

#include "TimeUtil.h"
#include "utils/TimeUtil.h"

#define TIMER_NAMES \
X(net_scrape_read) \
Expand Down
6 changes: 3 additions & 3 deletions collector/lib/CollectorStatsExporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
#include <iostream>
#include <math.h>

#include "Containers.h"
#include "EventNames.h"
#include "Logging.h"
#include "Utility.h"
#include "log/Logging.h"
#include "prometheus/gauge.h"
#include "prometheus/summary.h"
#include "system-inspector/Service.h"
#include "utils/Containers.h"
#include "utils/Utility.h"

namespace collector {

Expand Down
2 changes: 1 addition & 1 deletion collector/lib/CollectorStatsExporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

#include "CollectorConfig.h"
#include "CollectorStats.h"
#include "StoppableThread.h"
#include "prometheus/registry.h"
#include "system-inspector/Service.h"
#include "utils/StoppableThread.h"

namespace collector {

Expand Down
4 changes: 2 additions & 2 deletions collector/lib/ConfigLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

#include "internalapi/sensor/collector.pb.h"

#include "EnvVar.h"
#include "Logging.h"
#include "log/Logging.h"
#include "utils/EnvVar.h"

namespace collector {

Expand Down
2 changes: 1 addition & 1 deletion collector/lib/ConfigLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "CollectorConfig.h"
#include "Inotify.h"
#include "StoppableThread.h"
#include "utils/StoppableThread.h"

namespace collector {

Expand Down
6 changes: 3 additions & 3 deletions collector/lib/ConnTracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#include <utility>

#include "CollectorStats.h"
#include "Containers.h"
#include "Logging.h"
#include "Utility.h"
#include "log/Logging.h"
#include "utils/Containers.h"
#include "utils/Utility.h"

namespace collector {

Expand Down
6 changes: 3 additions & 3 deletions collector/lib/ConnTracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
#include <mutex>
#include <vector>

#include "Containers.h"
#include "Hash.h"
#include "NRadix.h"
#include "NetworkConnection.h"
#include "utils/Containers.h"
#include "utils/Hash.h"
#include "utils/NRadix.h"

namespace collector {

Expand Down
2 changes: 1 addition & 1 deletion collector/lib/Diagnostics.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <sstream>
#include <string>

#include "Logging.h"
#include "log/Logging.h"

namespace collector {

Expand Down
2 changes: 1 addition & 1 deletion collector/lib/HostHeuristics.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "HostHeuristics.h"

#include "Logging.h"
#include "log/Logging.h"

namespace collector {

Expand Down
4 changes: 2 additions & 2 deletions collector/lib/HostInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ You should have received a copy of the GNU General Public License along with thi
#include <bpf/libbpf.h>
#include <linux/bpf.h>

#include "FileSystem.h"
#include "Logging.h"
#include "log/Logging.h"
#include "utils/FileSystem.h"

namespace collector {

Expand Down
4 changes: 2 additions & 2 deletions collector/lib/HostInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ extern "C" {
#include <regex>
#include <string>

#include "Logging.h"
#include "Utility.h"
#include "log/Logging.h"
#include "utils/Utility.h"

namespace collector {

Expand Down
4 changes: 2 additions & 2 deletions collector/lib/Inotify.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

#include <sys/inotify.h>

#include "Logging.h"
#include "Utility.h"
#include "log/Logging.h"
#include "utils/Utility.h"

namespace collector {

Expand Down
6 changes: 3 additions & 3 deletions collector/lib/KernelDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ extern "C" {

#include "CollectorConfig.h"
#include "EventNames.h"
#include "FileSystem.h"
#include "Logging.h"
#include "Utility.h"
#include "log/Logging.h"
#include "system-inspector/Service.h"
#include "utils/FileSystem.h"
#include "utils/Utility.h"

extern const struct syscall_evt_pair g_syscall_table[]; // defined in libscap
static const unsigned long DRIVER_BUFFER_DIM = 16UL * 1024UL * 1024UL;
Expand Down
2 changes: 1 addition & 1 deletion collector/lib/NetworkConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include <string>
#include <vector>

#include "Hash.h"
#include "Process.h"
#include "utils/Hash.h"

namespace collector {

Expand Down
5 changes: 3 additions & 2 deletions collector/lib/NetworkConnectionInfoServiceComm.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#include "NetworkConnectionInfoServiceComm.h"

#include "GRPCUtil.h"
#include "grpc/GRPCUtil.h"

#include "HostInfo.h"
#include "Utility.h"
#include "utils/Utility.h"

namespace collector {

Expand Down
3 changes: 1 addition & 2 deletions collector/lib/NetworkConnectionInfoServiceComm.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <memory>

#include "grpc/DuplexGRPC.h"
#include <grpc/grpc.h>
#include <grpcpp/channel.h>
#include <grpcpp/client_context.h>
Expand All @@ -11,8 +12,6 @@

#include "internalapi/sensor/network_connection_iservice.grpc.pb.h"

#include "DuplexGRPC.h"

namespace collector {

// Gathers all the communication routines targeted at NetworkConnectionInfoService.
Expand Down
10 changes: 5 additions & 5 deletions collector/lib/NetworkStatusNotifier.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#include "NetworkStatusNotifier.h"

#include "grpc/DuplexGRPC.h"
#include "grpc/GRPCUtil.h"
#include <google/protobuf/util/time_util.h>

#include "CollectorStats.h"
#include "DuplexGRPC.h"
#include "GRPCUtil.h"
#include "Logging.h"
#include "Profiler.h"
#include "ProtoUtil.h"
#include "RateLimit.h"
#include "TimeUtil.h"
#include "Utility.h"
#include "log/Logging.h"
#include "utils/TimeUtil.h"
#include "utils/Utility.h"

namespace collector {

Expand Down
2 changes: 1 addition & 1 deletion collector/lib/NetworkStatusNotifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "ProcfsScraper.h"
#include "ProtoAllocator.h"
#include "RateLimit.h"
#include "StoppableThread.h"
#include "utils/StoppableThread.h"

namespace collector {

Expand Down
4 changes: 2 additions & 2 deletions collector/lib/ProcessSignalFormatter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

#include "CollectorStats.h"
#include "EventMap.h"
#include "Logging.h"
#include "Utility.h"
#include "log/Logging.h"
#include "system-inspector/EventExtractor.h"
#include "utils/Utility.h"

namespace collector {

Expand Down
10 changes: 5 additions & 5 deletions collector/lib/ProcfsScraper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
#include <netinet/tcp.h>

#include "CollectorStats.h"
#include "Containers.h"
#include "FileSystem.h"
#include "Hash.h"
#include "Logging.h"
#include "ProcfsScraper_internal.h"
#include "Utility.h"
#include "log/Logging.h"
#include "utils/Containers.h"
#include "utils/FileSystem.h"
#include "utils/Hash.h"
#include "utils/Utility.h"

namespace collector {

Expand Down
Loading
Loading