From 04032fb03e94db4d82adb2e639a9068e1cdeb755 Mon Sep 17 00:00:00 2001 From: "m.kindritskiy" Date: Wed, 4 Dec 2024 17:11:05 +0200 Subject: [PATCH] add debug to rpc.Exchange to investigate bug --- featureflags/graph/proto_adapter.py | 3 ++- featureflags/rpc/servicer.py | 21 ++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/featureflags/graph/proto_adapter.py b/featureflags/graph/proto_adapter.py index 539fa23..9b5c926 100644 --- a/featureflags/graph/proto_adapter.py +++ b/featureflags/graph/proto_adapter.py @@ -85,7 +85,8 @@ def variable(self, obj, value): obj.variable.Variable = value.ident.hex def operator(self, obj, value): - obj.operator = value.to_pb() + if value is not None: + obj.operator = value.to_pb() def value_string(self, obj, value): if value is not None: diff --git a/featureflags/rpc/servicer.py b/featureflags/rpc/servicer.py index be93947..d293ba8 100644 --- a/featureflags/rpc/servicer.py +++ b/featureflags/rpc/servicer.py @@ -93,7 +93,26 @@ async def Exchange(self, stream: Stream) -> None: # noqa: N802 db_engine=self._db_engine, session=user_session.get(), ) - populate_result_proto(result, exchange_reply.result) + try: + log.debug( + "Graph result: %r", + result.__idx__, + extra={ + "project_name": request.project, + "request_verion": request.version, + "project_version": version, + }, + ) + populate_result_proto(result, exchange_reply.result) + except: # noqa + log.error( + "Failed to populate result proto", + extra={ + "project_name": request.project, + "request_verion": request.version, + "project_version": version, + }, + ) exchange_reply.version = version