Skip to content
Open
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
6 changes: 6 additions & 0 deletions collector/lib/CollectionMethod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const char* CollectionMethodName(CollectionMethod method) {
return "ebpf";
case CollectionMethod::CORE_BPF:
return "core_bpf";
case CollectionMethod::PROCFS_ONLY:
return "procfs_only";
default:
CLOG(WARNING) << "Unexpected CollectionMethod: " << static_cast<uint8_t>(method);
return "unknown";
Expand All @@ -38,6 +40,10 @@ CollectionMethod ParseCollectionMethod(std::string_view method) {
return CollectionMethod::CORE_BPF;
}

if (cm == "procfs_only") {
return CollectionMethod::PROCFS_ONLY;
}

CLOG(WARNING) << "Invalid collection-method (" << cm << "), using CO-RE BPF";
return CollectionMethod::CORE_BPF;
}
Expand Down
1 change: 1 addition & 0 deletions collector/lib/CollectionMethod.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace collector {
enum class CollectionMethod : uint8_t {
EBPF = 0,
CORE_BPF,
PROCFS_ONLY,
};

std::ostream& operator<<(std::ostream& os, CollectionMethod method);
Expand Down
3 changes: 2 additions & 1 deletion collector/lib/CollectorConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class CollectorConfig {
static constexpr bool kTurnOffScrape = false;
static constexpr int kScrapeInterval = 30;
static constexpr int64_t kMaxConnectionsPerMinute = 2048;
static constexpr CollectionMethod kCollectionMethod = CollectionMethod::CORE_BPF;
// static constexpr CollectionMethod kCollectionMethod = CollectionMethod::CORE_BPF;
static constexpr CollectionMethod kCollectionMethod = CollectionMethod::PROCFS_ONLY;
static constexpr const char* kSyscalls[] = {
"accept",
"accept4",
Expand Down
20 changes: 15 additions & 5 deletions collector/lib/CollectorService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,17 @@ void CollectorService::RunForever() {
server.addHandler(collector_config_inspector->kBaseRoute, collector_config_inspector.get());
}

system_inspector_.Init(config_, conn_tracker);
system_inspector_.Start();
if (config_.GetCollectionMethod() != CollectionMethod::PROCFS_ONLY) {
system_inspector_.Init(config_, conn_tracker);
system_inspector_.Start();
}

ControlValue cv;
while ((cv = control_->load(std::memory_order_relaxed)) != STOP_COLLECTOR) {
system_inspector_.Run(*control_);
CLOG(DEBUG) << "Interrupted collector!";
if (config_.GetCollectionMethod() != CollectionMethod::PROCFS_ONLY) {
system_inspector_.Run(*control_);
CLOG(DEBUG) << "Interrupted collector!";
}
}

int signal = signum_.load();
Expand All @@ -144,7 +148,9 @@ void CollectorService::RunForever() {
exporter.stop();
server.close();

system_inspector_.CleanUp();
if (config_.GetCollectionMethod() != CollectionMethod::PROCFS_ONLY) {
system_inspector_.CleanUp();
}
}

bool CollectorService::InitKernel() {
Expand All @@ -158,6 +164,10 @@ bool CollectorService::WaitForGRPCServer() {
}

bool SetupKernelDriver(CollectorService& collector, const CollectorConfig& config) {
if (config.GetCollectionMethod() == CollectionMethod::PROCFS_ONLY) {
return true;
}

auto& startup_diagnostics = StartupDiagnostics::GetInstance();
std::string cm_name(CollectionMethodName(config.GetCollectionMethod()));

Expand Down
10 changes: 6 additions & 4 deletions integration-tests/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
)

const (
CollectionMethodEBPF = "ebpf"
CollectionMethodCoreBPF = "core-bpf"
CollectionMethodEBPF = "ebpf"
CollectionMethodCoreBPF = "core-bpf"
CollectionMethodProcfsOnly = "procfs_only"

runtimeDefaultCommand = "docker"
runtimeDefaultSocket = "/var/run/docker.sock"
Expand All @@ -27,8 +28,9 @@ const (

var (
qa_tag = ReadEnvVar(envQATag)
collection_method = ReadEnvVarWithDefault(envCollectionMethod, CollectionMethodCoreBPF)
stop_timeout = ReadEnvVarWithDefault(envStopTimeout, defaultStopTimeoutSeconds)
collection_method = ReadEnvVarWithDefault(envCollectionMethod, CollectionMethodProcfsOnly)
//collection_method = ReadEnvVarWithDefault(envCollectionMethod, CollectionMethodCoreBPF)
stop_timeout = ReadEnvVarWithDefault(envStopTimeout, defaultStopTimeoutSeconds)

image_store *ImageStore
collector_options *CollectorOptions
Expand Down
Loading