new(userspace/falco): context metadata

Co-authored-by: Lorenzo Fontana <lo@linux.com>
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
This commit is contained in:
Leonardo Di Donato 2019-09-11 14:03:27 +00:00 committed by Leo Di Donato
parent 6cce448206
commit 826ad0b271
2 changed files with 21 additions and 1 deletions

View File

@ -16,12 +16,29 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
#include <sstream>
#include "grpc_context.h"
context::context(grpc::ServerContext* ctx):
m_ctx(ctx)
{
// todo: set thread-specific prefix "[session id][request id]"
std::string session_id;
std::string request_id;
get_metadata(meta_session, session_id);
get_metadata(meta_session, request_id);
std::stringstream meta;
if(!session_id.empty())
{
meta << "[sid=" << session_id << "]";
}
if(!request_id.empty())
{
meta << "[rid=" << request_id << "]";
}
}
void context::get_metadata(std::string key, std::string& val)

View File

@ -24,6 +24,9 @@ limitations under the License.
#include <grpc++/grpc++.h>
#endif
const std::string meta_session = "session_id";
const std::string meta_request = "request_id";
class context
{
public: