-
Notifications
You must be signed in to change notification settings - Fork 430
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
Enable support for MQTT stitcher in stirling #1918
base: main
Are you sure you want to change the base?
Enable support for MQTT stitcher in stirling #1918
Conversation
Signed-off-by: Chinmay <[email protected]>
Signed-off-by: Chinmay <[email protected]>
src/stirling/source_connectors/socket_tracer/protocols/mqtt/stitcher.h
Outdated
Show resolved
Hide resolved
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.
@ChinmayaSharma-hue sorry for the late review and really appreciate all your work on the MQTT protocol support!
src/stirling/source_connectors/socket_tracer/protocols/mqtt/stitcher.cc
Outdated
Show resolved
Hide resolved
src/stirling/source_connectors/socket_tracer/protocols/mqtt/stitcher.cc
Outdated
Show resolved
Hide resolved
src/stirling/source_connectors/socket_tracer/protocols/mqtt/stitcher.cc
Outdated
Show resolved
Hide resolved
src/stirling/source_connectors/socket_tracer/protocols/mqtt/stitcher_test.cc
Show resolved
Hide resolved
src/stirling/source_connectors/socket_tracer/protocols/mqtt/stitcher_test.cc
Outdated
Show resolved
Hide resolved
src/stirling/source_connectors/socket_tracer/protocols/mqtt/stitcher.cc
Outdated
Show resolved
Hide resolved
Signed-off-by: Chinmay <[email protected]>
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.
Thanks for the latest updates! I know this latest round has quite a bit of comments, but stitching is a challenging component and the more thought that's put into the edge cases now will save time when we move onto the next step!
As for the tests that clear the reqs/resps maps before the next batch of assertions, it might be helpful to split each of those into their own test case (TEST(MqttStitchTest, XXX)
macro). I assume the map .clears()
are there to prevent the earlier "test cases" from causing unrelated failures for the later test code. In my opinion, that is a signal that they should be independent cases and any shared setup should be refactored into another function.
src/stirling/source_connectors/socket_tracer/protocols/mqtt/test_utils.h
Outdated
Show resolved
Hide resolved
src/stirling/source_connectors/socket_tracer/protocols/mqtt/stitcher.cc
Outdated
Show resolved
Hide resolved
src/stirling/source_connectors/socket_tracer/protocols/mqtt/stitcher.cc
Outdated
Show resolved
Hide resolved
src/stirling/source_connectors/socket_tracer/protocols/mqtt/stitcher.cc
Outdated
Show resolved
Hide resolved
src/stirling/source_connectors/socket_tracer/protocols/mqtt/stitcher_test.cc
Outdated
Show resolved
Hide resolved
src/stirling/source_connectors/socket_tracer/protocols/mqtt/stitcher_test.cc
Outdated
Show resolved
Hide resolved
src/stirling/source_connectors/socket_tracer/protocols/mqtt/stitcher_test.cc
Outdated
Show resolved
Hide resolved
src/stirling/source_connectors/socket_tracer/protocols/mqtt/stitcher_test.cc
Outdated
Show resolved
Hide resolved
src/stirling/source_connectors/socket_tracer/protocols/mqtt/stitcher_test.cc
Show resolved
Hide resolved
Signed-off-by: Chinmay <[email protected]>
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.
Thanks again for all the hard work on this. This round of feedback is only a few minor things and I expect that after these are addressed we can move forward with merging this!
} else { | ||
if (type == message_type_t::kRequest) { | ||
state->send[std::tuple<uint32_t, uint32_t>(result->header_fields["packet_identifier"], | ||
result->header_fields["qos"])] = 0; | ||
} else { | ||
state->recv[std::tuple<uint32_t, uint32_t>(result->header_fields["packet_identifier"], | ||
result->header_fields["qos"])] = 0; | ||
} | ||
} |
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.
Is it necessary to store a key in the state for PUBLISH
'es that don't have any dups?
The ::operator[]
method will insert into the map if the key doesn't exist. So I believe the +=
operator will work as expected without the non dup branch.
state->send[unique_publish_identifier] > 0) { | ||
state->send[unique_publish_identifier] -= 1; | ||
req_frame.consumed = true; | ||
continue; | ||
} | ||
|
||
if (req_frame.type == message_type_t::kResponse && | ||
state->recv[unique_publish_identifier] > 0) { | ||
state->recv[unique_publish_identifier] -= 1; |
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.
Related to my earlier comment about avoiding excess inserts into state->{recv,send}
. Can we use ::find()
instead of ::operator[]
?
{0xc0, 0xd0}, | ||
// AUTH to AUTH |
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 thought we decided that we were skipping supporting AUTH
frames for now. If that changed, I'm ok with keeping this. However, I'd like to add a comment explaining what the gap is (if any) while it's still fresh in our minds.
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 decided to remove the mapping from the map itself, and a TODO before the logic of skipping AUTH matching in the stitcher function.
…ckets Signed-off-by: Chinmay <[email protected]>
Signed-off-by: Chinmay <[email protected]>
Signed-off-by: Chinmay <[email protected]>
Signed-off-by: Chinmay <[email protected]>
Summary: This PR adds the stitcher component of MQTT (v5), a newly added protocol.
Related issues: #341
Type of change: /kind feature
Test Plan: Added tests