diff --git a/userspace/falco/grpc_context.cpp b/userspace/falco/grpc_context.cpp index 4c6d5c4d..c5257049 100644 --- a/userspace/falco/grpc_context.cpp +++ b/userspace/falco/grpc_context.cpp @@ -29,16 +29,23 @@ context::context(grpc::ServerContext* ctx): get_metadata(meta_session, session_id); get_metadata(meta_session, request_id); + bool has_meta = false; std::stringstream meta; if(!session_id.empty()) { meta << "[sid=" << session_id << "]"; + has_meta = true; } - if(!request_id.empty()) { meta << "[rid=" << request_id << "]"; + has_meta = true; } + if(has_meta) + { + meta << " "; + } + m_prefix = meta.str(); } void context::get_metadata(std::string key, std::string& val) diff --git a/userspace/falco/grpc_context.h b/userspace/falco/grpc_context.h index c8c73dbe..4781517a 100644 --- a/userspace/falco/grpc_context.h +++ b/userspace/falco/grpc_context.h @@ -18,6 +18,8 @@ limitations under the License. #pragma once +#include + #ifdef GRPC_INCLUDE_IS_GRPCPP #include #else @@ -37,6 +39,7 @@ public: private: grpc::ServerContext* m_ctx = nullptr; + std::string m_prefix; }; class stream_context : public context