Skip to content

Commit 433c054

Browse files
authored
Remove all mentions of Sysdig and Falco in our codebase (#1346)
1 parent 977090d commit 433c054

28 files changed

+185
-182
lines changed

collector/CMakeLists.txt

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -62,29 +62,7 @@ add_definitions("-DINTERESTING_SUBSYS=\"perf_event\", \"cpu\", \"cpuset\", \"mem
6262

6363
add_definitions(-DASSERT_TO_LOG)
6464

65-
file(GLOB COLLECTOR_LIB_SRC_FILES ${PROJECT_SOURCE_DIR}/lib/*.cpp)
66-
add_library(collector_lib ${DRIVER_HEADERS} ${COLLECTOR_LIB_SRC_FILES})
67-
add_dependencies(collector_lib sinsp)
68-
target_link_libraries(collector_lib sinsp)
69-
target_link_libraries(collector_lib stdc++fs) # This is needed for GCC-8 to link against the filesystem library
70-
target_link_libraries(collector_lib cap-ng)
71-
target_link_libraries(collector_lib uuid)
72-
target_link_libraries(collector_lib libgrpc++.a libgrpc.a libgpr.a libupb.a libabsl_bad_optional_access.a libabsl_base.a libabsl_log_severity.a libabsl_spinlock_wait.a libabsl_str_format_internal.a libabsl_strings.a libabsl_strings_internal.a libabsl_throw_delegate.a libabsl_int128.a libabsl_raw_logging_internal.a libaddress_sorting.a)
73-
target_link_libraries(collector_lib civetweb-cpp civetweb)
74-
75-
target_link_libraries(collector_lib rox-proto)
76-
77-
if(DEFINED ENV{WITH_RHEL_RPMS})
78-
target_link_libraries(collector_lib protobuf cares)
79-
else()
80-
target_link_libraries(collector_lib libprotobuf.a libcares.a)
81-
endif()
82-
83-
if(NOT DISABLE_PROFILING)
84-
target_link_libraries(collector_lib profiler tcmalloc)
85-
endif()
86-
87-
target_link_libraries(collector_lib z ssl crypto CURL::libcurl bpf)
65+
add_subdirectory(lib)
8866

8967
add_executable(collector collector.cpp)
9068
target_link_libraries(collector collector_lib)

collector/lib/CMakeLists.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
file(GLOB COLLECTOR_LIB_SRC_FILES
2+
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
3+
${CMAKE_CURRENT_SOURCE_DIR}/system-inspector/*.cpp
4+
)
5+
6+
add_library(collector_lib ${DRIVER_HEADERS} ${COLLECTOR_LIB_SRC_FILES})
7+
add_dependencies(collector_lib sinsp)
8+
target_link_libraries(collector_lib sinsp)
9+
target_link_libraries(collector_lib stdc++fs) # This is needed for GCC-8 to link against the filesystem library
10+
target_link_libraries(collector_lib cap-ng)
11+
target_link_libraries(collector_lib uuid)
12+
target_link_libraries(collector_lib libgrpc++.a libgrpc.a libgpr.a libupb.a libabsl_bad_optional_access.a libabsl_base.a libabsl_log_severity.a libabsl_spinlock_wait.a libabsl_str_format_internal.a libabsl_strings.a libabsl_strings_internal.a libabsl_throw_delegate.a libabsl_int128.a libabsl_raw_logging_internal.a libaddress_sorting.a)
13+
target_link_libraries(collector_lib civetweb-cpp civetweb)
14+
15+
target_link_libraries(collector_lib rox-proto)
16+
17+
if(DEFINED ENV{WITH_RHEL_RPMS})
18+
target_link_libraries(collector_lib protobuf cares)
19+
else()
20+
target_link_libraries(collector_lib libprotobuf.a libcares.a)
21+
endif()
22+
23+
if(NOT DISABLE_PROFILING)
24+
target_link_libraries(collector_lib profiler tcmalloc)
25+
endif()
26+
27+
target_link_libraries(collector_lib z ssl crypto CURL::libcurl bpf)

collector/lib/CollectorService.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ extern "C" {
1717
#include "LogLevel.h"
1818
#include "NetworkStatusNotifier.h"
1919
#include "ProfilerHandler.h"
20-
#include "SysdigService.h"
2120
#include "Utility.h"
2221
#include "prometheus/exposer.h"
22+
#include "system-inspector/Service.h"
2323

2424
extern unsigned char g_bpf_drop_syscalls[]; // defined in libscap
2525

@@ -40,7 +40,7 @@ void CollectorService::RunForever() {
4040

4141
std::shared_ptr<ConnectionTracker> conn_tracker;
4242

43-
GetStatus getStatus(config_.Hostname(), &sysdig_);
43+
GetStatus getStatus(config_.Hostname(), &system_inspector_);
4444

4545
std::shared_ptr<prometheus::Registry> registry = std::make_shared<prometheus::Registry>();
4646

@@ -54,7 +54,7 @@ void CollectorService::RunForever() {
5454
prometheus::Exposer exposer("9090");
5555
exposer.RegisterCollectable(registry);
5656

57-
CollectorStatsExporter exporter(registry, &config_, &sysdig_);
57+
CollectorStatsExporter exporter(registry, &config_, &system_inspector_);
5858

5959
std::unique_ptr<NetworkStatusNotifier> net_status_notifier;
6060

@@ -75,7 +75,7 @@ void CollectorService::RunForever() {
7575
// up and use stdout instead.
7676
std::shared_ptr<ProcessStore> process_store;
7777
if (config_.IsProcessesListeningOnPortsEnabled()) {
78-
process_store = std::make_shared<ProcessStore>(&sysdig_);
78+
process_store = std::make_shared<ProcessStore>(&system_inspector_);
7979
}
8080
std::shared_ptr<IConnScraper> conn_scraper = std::make_shared<ConnScraper>(config_.HostProc(), process_store);
8181
conn_tracker = std::make_shared<ConnectionTracker>();
@@ -99,12 +99,12 @@ void CollectorService::RunForever() {
9999
CLOG(FATAL) << "Unable to start collector stats exporter";
100100
}
101101

102-
sysdig_.Init(config_, conn_tracker);
103-
sysdig_.Start();
102+
system_inspector_.Init(config_, conn_tracker);
103+
system_inspector_.Start();
104104

105105
ControlValue cv;
106106
while ((cv = control_->load(std::memory_order_relaxed)) != STOP_COLLECTOR) {
107-
sysdig_.Run(*control_);
107+
system_inspector_.Run(*control_);
108108
CLOG(DEBUG) << "Interrupted collector!";
109109
}
110110

@@ -117,15 +117,15 @@ void CollectorService::RunForever() {
117117
CLOG(INFO) << "Shutting down collector.";
118118

119119
if (net_status_notifier) net_status_notifier->Stop();
120-
// Shut down these first since they access the sysdig object.
120+
// Shut down these first since they access the system inspector object.
121121
exporter.stop();
122122
server.close();
123123

124-
sysdig_.CleanUp();
124+
system_inspector_.CleanUp();
125125
}
126126

127127
bool CollectorService::InitKernel(const DriverCandidate& candidate) {
128-
return sysdig_.InitKernel(config_, candidate);
128+
return system_inspector_.InitKernel(config_, candidate);
129129
}
130130

131131
bool CollectorService::WaitForGRPCServer() {

collector/lib/CollectorService.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
#ifndef _COLLECTOR_SERVICE_H_
22
#define _COLLECTOR_SERVICE_H_
33

4-
#include <vector>
5-
64
#include "CollectorConfig.h"
7-
#include "CollectorStats.h"
85
#include "Control.h"
96
#include "DriverCandidates.h"
10-
#include "SysdigService.h"
7+
#include "system-inspector/Service.h"
118

129
namespace collector {
1310

14-
class SysdigService;
15-
1611
class CollectorService {
1712
public:
1813
CollectorService(const CollectorConfig& config, std::atomic<ControlValue>* control, const std::atomic<int>* signum);
@@ -29,7 +24,7 @@ class CollectorService {
2924
std::atomic<ControlValue>* control_;
3025
const std::atomic<int>& signum_;
3126

32-
SysdigService sysdig_;
27+
system_inspector::Service system_inspector_;
3328
};
3429

3530
bool SetupKernelDriver(CollectorService& collector, const std::string& GRPCServer, const CollectorConfig& config);

collector/lib/CollectorStatsExporter.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
#include "Containers.h"
88
#include "EventNames.h"
99
#include "Logging.h"
10-
#include "SysdigService.h"
1110
#include "Utility.h"
1211
#include "prometheus/gauge.h"
1312
#include "prometheus/summary.h"
13+
#include "system-inspector/Service.h"
1414

1515
namespace collector {
1616

@@ -58,10 +58,10 @@ class CollectorConnectionStatsPrometheus : public CollectorConnectionStats<T> {
5858
}
5959
};
6060

61-
CollectorStatsExporter::CollectorStatsExporter(std::shared_ptr<prometheus::Registry> registry, const CollectorConfig* config, SysdigService* sysdig)
61+
CollectorStatsExporter::CollectorStatsExporter(std::shared_ptr<prometheus::Registry> registry, const CollectorConfig* config, system_inspector::Service* si)
6262
: registry_(std::move(registry)),
6363
config_(config),
64-
sysdig_(sysdig),
64+
system_inspector_(si),
6565
connections_total_reporter_(std::make_shared<CollectorConnectionStatsPrometheus<unsigned int>>(
6666
registry_,
6767
"rox_connections_total",
@@ -216,8 +216,8 @@ void CollectorStatsExporter::run() {
216216
}
217217

218218
while (thread_.Pause(std::chrono::seconds(5))) {
219-
SysdigStats stats;
220-
if (!sysdig_->GetStats(&stats)) {
219+
system_inspector::Stats stats;
220+
if (!system_inspector_->GetStats(&stats)) {
221221
continue;
222222
}
223223

collector/lib/CollectorStatsExporter.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
#include "CollectorConfig.h"
77
#include "CollectorStats.h"
88
#include "StoppableThread.h"
9-
#include "SysdigService.h"
109
#include "prometheus/registry.h"
10+
#include "system-inspector/Service.h"
1111

1212
namespace collector {
1313

1414
class CollectorStatsExporter {
1515
public:
16-
CollectorStatsExporter(std::shared_ptr<prometheus::Registry> registry, const CollectorConfig* config, SysdigService* sysdig);
16+
CollectorStatsExporter(std::shared_ptr<prometheus::Registry> registry, const CollectorConfig* config, system_inspector::Service* si);
1717

1818
bool start();
1919
void run();
@@ -25,7 +25,7 @@ class CollectorStatsExporter {
2525
private:
2626
std::shared_ptr<prometheus::Registry> registry_;
2727
const CollectorConfig* config_;
28-
SysdigService* sysdig_;
28+
system_inspector::Service* system_inspector_;
2929
std::shared_ptr<CollectorConnectionStats<unsigned int>> connections_total_reporter_;
3030
std::shared_ptr<CollectorConnectionStats<float>> connections_rate_reporter_;
3131
StoppableThread thread_;

collector/lib/Control.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
namespace collector {
55

66
enum ControlValue {
7-
RUN = 0, // Keep running
8-
INTERRUPT_SYSDIG, // Stop running sysdig, but resume collector operation (e.g., for chisel update)
9-
STOP_COLLECTOR, // Stop the collector (e.g., SIGINT or SIGTERM received).
7+
RUN = 0, // Keep running
8+
STOP_COLLECTOR, // Stop the collector (e.g., SIGINT or SIGTERM received).
109
};
1110

1211
}

collector/lib/DriverCandidates.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
#include <string_view>
66

77
#include "HostInfo.h"
8-
#include "SysdigService.h"
98
#include "Utility.h"
9+
#include "system-inspector/Service.h"
1010

1111
namespace collector {
1212

1313
namespace {
1414

1515
std::string driverFullName(const std::string& shortName) {
16-
return std::string{SysdigService::kProbeName} + "-" + shortName + ".o";
16+
return std::string{system_inspector::Service::kProbeName} + "-" + shortName + ".o";
1717
}
1818

1919
// Retrieves the ubuntu backport version from the host kernel's release

collector/lib/GetKernelObject.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ extern "C" {
1414
#include "FileDownloader.h"
1515
#include "FileSystem.h"
1616
#include "Logging.h"
17-
#include "SysdigService.h"
1817
#include "Utility.h"
18+
#include "system-inspector/Service.h"
1919

2020
namespace collector {
2121

@@ -177,7 +177,7 @@ bool GetKernelObject(const std::string& hostname, const Json::Value& tls_config,
177177

178178
std::string expected_path = candidate.GetPath() + "/" + candidate.GetName();
179179
std::string expected_path_compressed = expected_path + ".gz";
180-
std::string module_path = candidate.GetCollectionMethod() == CollectionMethod::EBPF ? SysdigService::kProbePath : SysdigService::kModulePath;
180+
std::string module_path = candidate.GetCollectionMethod() == CollectionMethod::EBPF ? system_inspector::Service::kProbePath : system_inspector::Service::kModulePath;
181181
struct stat sb;
182182

183183
// first check for an existing compressed kernel object in the

collector/lib/GetStatus.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ bool GetStatus::handleGet(CivetServer* server, struct mg_connection* conn) {
1111

1212
Json::Value status(Json::objectValue);
1313

14-
SysdigStats stats;
15-
bool ready = sysdig_->GetStats(&stats);
14+
system_inspector::Stats stats;
15+
bool ready = system_inspector_->GetStats(&stats);
1616

1717
if (ready) {
1818
status["status"] = "ok";

collector/lib/GetStatus.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
#include <string>
55

66
#include "CivetServer.h"
7-
#include "Sysdig.h"
7+
#include "system-inspector/SystemInspector.h"
88

99
namespace collector {
1010

1111
class GetStatus : public CivetHandler {
1212
public:
13-
GetStatus(std::string node_name, const Sysdig* sysdig)
14-
: node_name_(std::move(node_name)), sysdig_(sysdig) {}
13+
GetStatus(std::string node_name, const system_inspector::SystemInspector* si)
14+
: node_name_(std::move(node_name)), system_inspector_(si) {}
1515
bool handleGet(CivetServer* server, struct mg_connection* conn);
1616

1717
private:
1818
std::string node_name_;
19-
const Sysdig* sysdig_;
19+
const system_inspector::SystemInspector* system_inspector_;
2020
};
2121

2222
} /* namespace collector */

collector/lib/KernelDriver.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ extern "C" {
1414
#include "EventNames.h"
1515
#include "FileSystem.h"
1616
#include "Logging.h"
17-
#include "SysdigService.h"
1817
#include "Utility.h"
18+
#include "system-inspector/Service.h"
1919

2020
extern const struct syscall_evt_pair g_syscall_table[]; // defined in libscap
2121
static const unsigned long DRIVER_BUFFER_DIM = 16UL * 1024UL * 1024UL;
@@ -63,17 +63,17 @@ class KernelDriverEBPF : public IKernelDriver {
6363
KernelDriverEBPF() = default;
6464

6565
bool Setup(const CollectorConfig& config, sinsp& inspector) override {
66-
FDHandle fd = FDHandle(open(SysdigService::kProbePath, O_RDONLY));
66+
FDHandle fd = FDHandle(open(system_inspector::Service::kProbePath, O_RDONLY));
6767
if (!fd.valid()) {
68-
CLOG(ERROR) << "Cannot open eBPF probe at " << SysdigService::kProbePath;
68+
CLOG(ERROR) << "Cannot open eBPF probe at " << system_inspector::Service::kProbePath;
6969
return false;
7070
}
7171

7272
/* Get only necessary tracepoints. */
7373
std::unordered_set<ppm_sc_code> ppm_sc = GetSyscallList(config);
7474

7575
try {
76-
inspector.open_bpf(SysdigService::kProbePath,
76+
inspector.open_bpf(system_inspector::Service::kProbePath,
7777
config.GetSinspBufferSize(),
7878
ppm_sc);
7979
} catch (const sinsp_exception& ex) {

collector/lib/NetworkSignalHandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ std::optional<Connection> NetworkSignalHandler::GetConnection(sinsp_evt* evt) {
5151
// With collect_connection_status_ set, we can prevent reporting of asynchronous
5252
// connections which fail.
5353
if (collect_connection_status_) {
54-
// note: connection status tracking enablement is managed in SysdigService
54+
// note: connection status tracking enablement is managed in system_inspector::Service
5555
if (fd_info->is_socket_failed()) {
5656
// connect() failed or getsockopt(SO_ERROR) returned a failure
5757
return std::nullopt;

collector/lib/NetworkSignalHandler.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55

66
#include "ConnTracker.h"
77
#include "SignalHandler.h"
8-
#include "SysdigEventExtractor.h"
9-
#include "SysdigService.h"
8+
#include "system-inspector/EventExtractor.h"
9+
#include "system-inspector/SystemInspector.h"
1010

1111
namespace collector {
1212

1313
class NetworkSignalHandler final : public SignalHandler {
1414
public:
15-
explicit NetworkSignalHandler(sinsp* inspector, std::shared_ptr<ConnectionTracker> conn_tracker, SysdigStats* stats)
15+
explicit NetworkSignalHandler(sinsp* inspector, std::shared_ptr<ConnectionTracker> conn_tracker, system_inspector::Stats* stats)
1616
: conn_tracker_(std::move(conn_tracker)), stats_(stats), collect_connection_status_(true) {
1717
event_extractor_.Init(inspector);
1818
}
@@ -27,9 +27,9 @@ class NetworkSignalHandler final : public SignalHandler {
2727
private:
2828
std::optional<Connection> GetConnection(sinsp_evt* evt);
2929

30-
SysdigEventExtractor event_extractor_;
30+
system_inspector::EventExtractor event_extractor_;
3131
std::shared_ptr<ConnectionTracker> conn_tracker_;
32-
SysdigStats* stats_;
32+
system_inspector::Stats* stats_;
3333

3434
bool collect_connection_status_;
3535
};

0 commit comments

Comments
 (0)