-
Notifications
You must be signed in to change notification settings - Fork 25
Use the new collector internal service for process information #2063
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
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## master #2063 +/- ##
==========================================
- Coverage 28.40% 27.73% -0.68%
==========================================
Files 94 99 +5
Lines 5717 6050 +333
Branches 2531 2701 +170
==========================================
+ Hits 1624 1678 +54
- Misses 3383 3611 +228
- Partials 710 761 +51
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
5770ec0
to
a2d44bc
Compare
4a61b27
to
3ce1606
Compare
1c58c3c
to
98ff9f9
Compare
6c65509
to
a39570d
Compare
a39570d
to
45d33bc
Compare
/retest |
9a78993
to
10b071b
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.
This file is essentially a copy of ProcessSignalFormatter.cpp
, but building a sensor::MsgFromCollector
instead of a storage::ProcessSignal
.
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.
This file is essentially a copy of ProcessSignalFormatter.h
, but building a sensor::MsgFromCollector
instead of a storage::ProcessSignal
.
|
||
if (first_write_ && msg.has_process_signal()) { | ||
first_write_ = false; | ||
return SignalHandler::NEEDS_REFRESH; |
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.
It seems that SignalHandler::NEEDS_REFRESH
is returned when first_write_
is true and that is the case only after Refresh
has been called. So, SignalHandler::NEEDS_REFRESH
is returned after a refresh has been done and returning SignalHandler::NEEDS_REFRESH
does not result in a refresh, as the name implies. It does result in SendMsg
being called again. In which case first_write_
will be true and this will be skipped and the message will be sent the second time. I don't understand what returning here instead of sending the message the first time accomplishes.
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.
This is poor naming conventions on my part. NEEDS_REFRESH
is used when the process stream has just started and it causes collector to send all processes that are stored in the threadinfo table, at startup this sends all scraped processes, while running it will ensure any processes that were not sent as part of a disconnect to be sent on reconnection.
I probably need to come up with a better term than Refresh
for the method called after grpc is reconnected. I'll think it over and rename the method.
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.
I've renamed the Refresh
method to Recreate
, hopefully that makes it less ambiguous.
0ce72d6
to
a30992b
Compare
This needs more explanation of how you validated your change. You should mention your stackrox/stackrox PR and how that passing CI validates the changes here. Since you are requiring that this works with old versions of sensor, you should also validate that. You could create a stackrox/stackrox PR that just updates the collector version and sets the environment variable that you introduced for the qa e2e tests. Having those tests pass should be enough. Other than that, this looks good. |
a30992b
to
ddfe9e2
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!
9a81385
to
785dffb
Compare
This change makes it possible to have backwards compatibility with older sensor versions that might no implement the new service.
- Rollback no grpc channel behaviour. - Add documentation to new classes. - Remove unneeded workaround for old kernels. - Minor refactorings in SensorClientFormatter.
785dffb
to
81a7b0c
Compare
Description
This PR makes it so collector starts using the new unified internal service for communicating with sensor. For now the implementation only handles process information, but lays the groundwork to also move network flows into this new internal service.
In order to better abstract how we forward messages, a new
CollectorOutput
class has been added. The responsibility for this class is to hold all gRPC clients that we might need for sending messages to collector, both through the new internal service and the legacy ones, as well as ensuring the connection between sensor and collector is up. This change means the responsibility for theProcessSignalClient
class has been reduced to simply sending the message through the grpc client it holds. A new client has also been added for the new service.Alongside this new
CollectorOutput
class, a new formatter has been added to generate messages that will be sent through the new service and the existing process signal handler has been modified to start using it.Sibling PR stackrox/stackrox#14652
Checklist
Automated testing
If any of these don't apply, please comment below.
Testing Performed
Deployed this version of collector with the sensor version from stackrox/stackrox#14652 and checked process information is still available in the Risk tab.
Modified the existing integration tests to use the new service.