-
Notifications
You must be signed in to change notification settings - Fork 25
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
Use the new collector internal service for process information #2063
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 27.49% 26.94% -0.56%
==========================================
Files 93 98 +5
Lines 5731 6064 +333
Branches 2538 2708 +170
==========================================
+ Hits 1576 1634 +58
- Misses 3488 3711 +223
- Partials 667 719 +52
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.
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.
0ce72d6
to
a30992b
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
Manually tested the changes and modified the existing integration tests to use the new service.