diff --git a/src/stirling/source_connectors/socket_tracer/protocols/mongodb/parse.cc b/src/stirling/source_connectors/socket_tracer/protocols/mongodb/parse.cc index 56f58a8754d..dc2cc1abbdb 100644 --- a/src/stirling/source_connectors/socket_tracer/protocols/mongodb/parse.cc +++ b/src/stirling/source_connectors/socket_tracer/protocols/mongodb/parse.cc @@ -97,6 +97,15 @@ size_t FindFrameBoundary(message_type_t, std::string_view, size_ return std::string::npos; } +template <> +mongodb::stream_id_t GetStreamID(mongodb::Frame* frame) { + if (frame->response_to == 0) { + return frame->request_id; + } + + return frame->response_to; +} + } // namespace protocols } // namespace stirling } // namespace px diff --git a/src/stirling/source_connectors/socket_tracer/protocols/mongodb/parse.h b/src/stirling/source_connectors/socket_tracer/protocols/mongodb/parse.h index 97c282570a1..d38f8424c73 100644 --- a/src/stirling/source_connectors/socket_tracer/protocols/mongodb/parse.h +++ b/src/stirling/source_connectors/socket_tracer/protocols/mongodb/parse.h @@ -40,6 +40,9 @@ template <> size_t FindFrameBoundary(message_type_t type, std::string_view buf, size_t start_pos, NoState*); +template <> +mongodb::stream_id_t GetStreamID(mongodb::Frame* frame); + } // namespace protocols } // namespace stirling } // namespace px diff --git a/src/stirling/source_connectors/socket_tracer/protocols/mongodb/types.h b/src/stirling/source_connectors/socket_tracer/protocols/mongodb/types.h index b33457ce608..673349ada60 100644 --- a/src/stirling/source_connectors/socket_tracer/protocols/mongodb/types.h +++ b/src/stirling/source_connectors/socket_tracer/protocols/mongodb/types.h @@ -178,6 +178,7 @@ struct ProtocolTraits : public BaseProtocolTraits { using record_type = Record; using state_type = StateWrapper; using key_type = stream_id_t; + static constexpr StreamSupport stream_support = BaseProtocolTraits::UseStream; }; } // namespace mongodb