mirror of
https://github.com/falcosecurity/falco.git
synced 2025-08-01 06:29:47 +00:00
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:
parent
6cce448206
commit
826ad0b271
@ -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)
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user