-
Notifications
You must be signed in to change notification settings - Fork 24
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
Allow to ignore process arguments #1898
Conversation
b474823
to
330b1d4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just a couple of minor comments, but they are nothing major, so feel free to ignore them.
@@ -52,6 +56,8 @@ class ProcessSignalFormatter : public ProtoSignalFormatter<sensor::SignalStreamM | |||
const EventNames& event_names_; | |||
std::unique_ptr<system_inspector::EventExtractor> event_extractor_; | |||
ContainerMetadata container_metadata_; | |||
|
|||
const CollectorConfig* config_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we store this as a reference to make it clear it can never be null and it won't be reassigned? (at least for now).
const CollectorConfig* config_; | |
const CollectorConfig& config_; |
collector/lib/ProcessSignalHandler.h
Outdated
@@ -34,6 +42,8 @@ class ProcessSignalHandler : public SignalHandler { | |||
ProcessSignalFormatter formatter_; | |||
system_inspector::Stats* stats_; | |||
RateLimitCache rate_limiter_; | |||
|
|||
const CollectorConfig* config_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question here.
class MockCollectorConfig : public CollectorConfig { | ||
public: | ||
MockCollectorConfig() = default; | ||
|
||
void SetDisableProcessArguments(bool value) { | ||
disable_process_arguments_ = value; | ||
} | ||
}; | ||
|
||
class MockProcessSignalFormatter : public ProcessSignalFormatter { | ||
public: | ||
MockProcessSignalFormatter(sinsp* inspector, const CollectorConfig& config) : ProcessSignalFormatter(inspector, config) {}; | ||
|
||
ProcessSignal* MockCreateProcessSignal(sinsp_evt* event) { | ||
return CreateProcessSignal(event); | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use FRIEND_TEST
definitions here instead of mocks? Ideally, we would have an easy way to create a config object with any configuration we want without any of these methods, but for now, I think I prefer not having mocks when all we are using them for is access to private/protected fields, WDYT?
http://google.github.io/googletest/reference/testing.html#FRIEND_TEST
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, why not. It sorts of leaks tests details into the implementation, but it's not so bad.
Pass CollectorConfig to the ProcessSignalHandler and ProcessSignalFormatter. It's needed for the future work, involving conditional logic in the process handler.
330b1d4
to
22a9998
Compare
Description
Add an internal option to not collect process arguments, as a workaround for ROX-25845.
Checklist
Automated testing
Testing Performed
Previous evaluation in the field with the debugging image.