-
Notifications
You must be signed in to change notification settings - Fork 454
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
[Fix CQL Sticher 3/4] Populate map of streams to frames during parsing #1716
Conversation
for (auto& frame : new_frames) { | ||
// GetStreamID returns 0 by default if not implemented in protocol. | ||
TKey key = GetStreamID<TKey, TFrameType>(&frame); | ||
(*frames)[key].push_back(frame); | ||
} |
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.
Have you tried pushing the GetStreamID
call into the ParseFramesLoop
function? It seems like we could avoid this loop if GetStreamID could be called here as the frame is pushed into the deque.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
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.
On second thought, I think it is better to have the call to GetStreamID
in ParseFramesLoop
. To avoid this PR getting too large, I've moved that change to #1732
f2a75fe
to
75ab302
Compare
cde760c
to
b1020b9
Compare
…1731) Summary: Raises the stirling size limit for `dbg` builds by 5 MiB (to 300mb) to accommodate upcoming changes and additions, including mongodb parsing/stitching and `StitchFrames` interface changes (#1716). Type of change: /kind cleanup Test Plan: Existing targets Signed-off-by: Benjamin Kilimnik <bkilimnik@pixielabs.ai>
fba504e
to
5af5520
Compare
src/stirling/source_connectors/socket_tracer/protocols/cql/types.h
Outdated
Show resolved
Hide resolved
Signed-off-by: Benjamin Kilimnik <bkilimnik@pixielabs.ai>
5af5520
to
06b3c0b
Compare
Signed-off-by: Benjamin Kilimnik <bkilimnik@pixielabs.ai>
Signed-off-by: Benjamin Kilimnik <bkilimnik@pixielabs.ai>
Signed-off-by: Benjamin Kilimnik <bkilimnik@pixielabs.ai>
std::get<std::deque<TFrameType>>(frames_).empty()); | ||
bool data_buffer_empty = data_buffer_.empty(); | ||
bool monostate = std::holds_alternative<std::monostate>(frames_); | ||
if (data_buffer_empty || monostate) { |
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.
Can this be a constexpr
if?
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 believe the condition of the if statement depends on the runtime state of data_buffer_
and frames_
, so we can't use a constexpr
.
// std::monostate. | ||
ECHECK((conn_tracker->send_data() | ||
.Empty<protocols::http::stream_id_t, protocols::http::Message>())); | ||
ECHECK((conn_tracker->recv_data() | ||
.Empty<protocols::http::stream_id_t, protocols::http::Message>())); |
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.
We should probably make this a DCHECK
.
Also, is it possible to create a type alias so that the line breaks are avoided, e.g.
using stream_id_t = protocols::http::stream_id_t;
using message_t = protocols::http::Message;
.Empty<stream_id_t, message_t>();
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.
Added type alias and changed to DCHECK
… function Signed-off-by: Benjamin Kilimnik <bkilimnik@pixielabs.ai>
Summary: Modifies all protocol parsers to use a map of streams to deques by default. Protocols which do not have a notion of streams are encoded as single keys in a map. This completes the CQL stitcher fix and should simplify stitching frames for protocols with streams.
The final PR in this sequence #1732 populates a map of streamIDs to deque of frames in ParseFramesLoop instead of ParseFrames. This should provide a small efficiency boost, as we won't have to loop over the frames twice.
Related issues: Closes #1375
Type of change: /kind bug
Test Plan: Updated parsing tests to use new interface.
Note
: this PR relies on changes introduced in #1689 and #1715