From 86e9a31a81a2687de403671462d53faa2f2e9f96 Mon Sep 17 00:00:00 2001 From: Adam Toth Date: Wed, 2 Sep 2026 08:34:34 -0700 Subject: [PATCH 1/8] Python(fix): adjusting gRPC limits and page size --- .../sift_client/_internal/grpc_transport/transport.py | 5 ++++- .../sift_client/_internal/low_level_wrappers/data.py | 2 +- python/lib/sift_client/transport/grpc_transport.py | 10 ++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/python/lib/sift_client/_internal/grpc_transport/transport.py b/python/lib/sift_client/_internal/grpc_transport/transport.py index f982be61c4..af736ed604 100644 --- a/python/lib/sift_client/_internal/grpc_transport/transport.py +++ b/python/lib/sift_client/_internal/grpc_transport/transport.py @@ -168,7 +168,8 @@ def _compute_channel_options(opts: SiftChannelConfig) -> list[tuple[str, Any]]: # Primary cannot be overriden: # https://github.com/grpc/grpc/blob/0498194240f55d7f4b12633ad01339fb690621bf/src/core/ext/filters/http/client/http_client_filter.cc#L97 ("grpc.secondary_user_agent", _compute_user_agent()), - ("grpc.max_receive_message_length", MAX_DECODING_MESSAGE_SIZE), + ("grpc.max_receive_message_length", opts.get("max_receive_message_length", MAX_DECODING_MESSAGE_SIZE)), + ("grpc.max_send_message_length", opts.get("max_send_message_length", MAX_DECODING_MESSAGE_SIZE)), ] enable_keepalive = opts.get("enable_keepalive", True) @@ -251,3 +252,5 @@ class SiftChannelConfig(TypedDict): use_ssl: NotRequired[bool] cert_via_openssl: NotRequired[bool] request_timeout: NotRequired[float | None] + max_receive_message_length: NotRequired[int] + max_send_message_length: NotRequired[int] diff --git a/python/lib/sift_client/_internal/low_level_wrappers/data.py b/python/lib/sift_client/_internal/low_level_wrappers/data.py index 5a2dd522f6..6661a710cb 100644 --- a/python/lib/sift_client/_internal/low_level_wrappers/data.py +++ b/python/lib/sift_client/_internal/low_level_wrappers/data.py @@ -30,7 +30,7 @@ # Configure logging logger = logging.getLogger(__name__) -CHANNELS_DEFAULT_PAGE_SIZE = 10_000 +CHANNELS_DEFAULT_PAGE_SIZE = 100_000 # TODO: There is a pagination issue API side when requesting multiple channels in single request. # If all data points for all channels in a single request don't fit into a single page, then # paging seems to omit all but a single channel. We can increase this batch size once that issue diff --git a/python/lib/sift_client/transport/grpc_transport.py b/python/lib/sift_client/transport/grpc_transport.py index 07a64b905e..22e4d7e2c0 100644 --- a/python/lib/sift_client/transport/grpc_transport.py +++ b/python/lib/sift_client/transport/grpc_transport.py @@ -48,6 +48,8 @@ def __init__( cert_via_openssl: bool = False, metadata: dict[str, str] | None = None, request_timeout: float | None = DEFAULT_REQUEST_TIMEOUT_SECONDS, + max_receive_message_length: int = 50 * 1024 * 1024, + max_send_message_length: int = 50 * 1024 * 1024, ): """Initialize the gRPC configuration. @@ -60,6 +62,10 @@ def __init__( metadata: Additional metadata to include in all requests. request_timeout: Default deadline in seconds applied to unary RPCs that don't set their own. Defaults to 60s. Set to None to disable the default deadline. + max_receive_message_length: Maximum gRPC message size the client will accept (bytes). + Defaults to 50 MiB to match the server-side ceiling. + max_send_message_length: Maximum gRPC message size the client will send (bytes). + Defaults to 50 MiB to match the server-side ceiling. """ parsed_url = urlparse(url) normalized_url = url @@ -77,6 +83,8 @@ def __init__( self.cert_via_openssl = cert_via_openssl self.metadata = metadata or {} self.request_timeout = request_timeout + self.max_receive_message_length = max_receive_message_length + self.max_send_message_length = max_send_message_length def _to_sift_channel_config(self) -> SiftChannelConfig: """Convert to a SiftChannelConfig. @@ -90,6 +98,8 @@ def _to_sift_channel_config(self) -> SiftChannelConfig: "use_ssl": self.use_ssl, "cert_via_openssl": self.cert_via_openssl, "request_timeout": self.request_timeout, + "max_receive_message_length": self.max_receive_message_length, + "max_send_message_length": self.max_send_message_length, } From cf0259e93fb3b38862b6d27d598e29aee78f1743 Mon Sep 17 00:00:00 2001 From: Adam Toth Date: Wed, 2 Sep 2026 09:13:06 -0700 Subject: [PATCH 2/8] Python(fix): apply ruff formatting to transport.py Co-Authored-By: Claude Sonnet 4.6 --- .../sift_client/_internal/grpc_transport/transport.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/python/lib/sift_client/_internal/grpc_transport/transport.py b/python/lib/sift_client/_internal/grpc_transport/transport.py index af736ed604..11d67e9e95 100644 --- a/python/lib/sift_client/_internal/grpc_transport/transport.py +++ b/python/lib/sift_client/_internal/grpc_transport/transport.py @@ -168,8 +168,14 @@ def _compute_channel_options(opts: SiftChannelConfig) -> list[tuple[str, Any]]: # Primary cannot be overriden: # https://github.com/grpc/grpc/blob/0498194240f55d7f4b12633ad01339fb690621bf/src/core/ext/filters/http/client/http_client_filter.cc#L97 ("grpc.secondary_user_agent", _compute_user_agent()), - ("grpc.max_receive_message_length", opts.get("max_receive_message_length", MAX_DECODING_MESSAGE_SIZE)), - ("grpc.max_send_message_length", opts.get("max_send_message_length", MAX_DECODING_MESSAGE_SIZE)), + ( + "grpc.max_receive_message_length", + opts.get("max_receive_message_length", MAX_DECODING_MESSAGE_SIZE), + ), + ( + "grpc.max_send_message_length", + opts.get("max_send_message_length", MAX_DECODING_MESSAGE_SIZE), + ), ] enable_keepalive = opts.get("enable_keepalive", True) From eed1922d2ba95c7d24ff4d32ad34715f3f11ad53 Mon Sep 17 00:00:00 2001 From: Adam Toth Date: Wed, 2 Sep 2026 09:14:47 -0700 Subject: [PATCH 3/8] Python(fix): use MAX_DECODING_MESSAGE_SIZE constant for gRPC message length defaults Co-Authored-By: Claude Sonnet 4.6 --- python/lib/sift_client/transport/grpc_transport.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python/lib/sift_client/transport/grpc_transport.py b/python/lib/sift_client/transport/grpc_transport.py index 22e4d7e2c0..a45118315c 100644 --- a/python/lib/sift_client/transport/grpc_transport.py +++ b/python/lib/sift_client/transport/grpc_transport.py @@ -16,6 +16,7 @@ from sift_client._internal.grpc_transport.transport import ( DEFAULT_REQUEST_TIMEOUT_SECONDS, + MAX_DECODING_MESSAGE_SIZE, SiftChannelConfig, use_sift_async_channel, ) @@ -48,8 +49,8 @@ def __init__( cert_via_openssl: bool = False, metadata: dict[str, str] | None = None, request_timeout: float | None = DEFAULT_REQUEST_TIMEOUT_SECONDS, - max_receive_message_length: int = 50 * 1024 * 1024, - max_send_message_length: int = 50 * 1024 * 1024, + max_receive_message_length: int = MAX_DECODING_MESSAGE_SIZE, + max_send_message_length: int = MAX_DECODING_MESSAGE_SIZE, ): """Initialize the gRPC configuration. From cc9000c22629f4653310e1de25bc5e4bcb778d27 Mon Sep 17 00:00:00 2001 From: Adam Toth Date: Wed, 2 Sep 2026 09:23:06 -0700 Subject: [PATCH 4/8] Python(fix): replace hardcoded MiB values in docstrings with constant reference Co-Authored-By: Claude Sonnet 4.6 --- python/lib/sift_client/transport/grpc_transport.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/lib/sift_client/transport/grpc_transport.py b/python/lib/sift_client/transport/grpc_transport.py index a45118315c..8a829030ea 100644 --- a/python/lib/sift_client/transport/grpc_transport.py +++ b/python/lib/sift_client/transport/grpc_transport.py @@ -64,9 +64,9 @@ def __init__( request_timeout: Default deadline in seconds applied to unary RPCs that don't set their own. Defaults to 60s. Set to None to disable the default deadline. max_receive_message_length: Maximum gRPC message size the client will accept (bytes). - Defaults to 50 MiB to match the server-side ceiling. + Defaults to :data:`~sift_client._internal.grpc_transport.transport.MAX_DECODING_MESSAGE_SIZE`. max_send_message_length: Maximum gRPC message size the client will send (bytes). - Defaults to 50 MiB to match the server-side ceiling. + Defaults to :data:`~sift_client._internal.grpc_transport.transport.MAX_DECODING_MESSAGE_SIZE`. """ parsed_url = urlparse(url) normalized_url = url From 1f4c9969e01a5d8d4a3747b782f9bcee94b29944 Mon Sep 17 00:00:00 2001 From: Adam Toth Date: Wed, 2 Sep 2026 09:55:44 -0700 Subject: [PATCH 5/8] Python(fix): move MAX_DECODING_MESSAGE_SIZE to public scope for docs Co-Authored-By: Claude Sonnet 4.6 --- .../lib/sift_client/_internal/grpc_transport/transport.py | 6 +++--- python/lib/sift_client/transport/grpc_transport.py | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/python/lib/sift_client/_internal/grpc_transport/transport.py b/python/lib/sift_client/_internal/grpc_transport/transport.py index 11d67e9e95..00d4b6c56f 100644 --- a/python/lib/sift_client/_internal/grpc_transport/transport.py +++ b/python/lib/sift_client/_internal/grpc_transport/transport.py @@ -34,7 +34,7 @@ DEFAULT_REQUEST_TIMEOUT_SECONDS = 60.0 """Default per-call deadline applied to unary RPCs that don't set their own.""" -MAX_DECODING_MESSAGE_SIZE = 50 * 1024 * 1024 +_MAX_DECODING_MESSAGE_SIZE = 50 * 1024 * 1024 """Largest gRPC response the client will decode, in bytes (50 MiB).""" @@ -170,11 +170,11 @@ def _compute_channel_options(opts: SiftChannelConfig) -> list[tuple[str, Any]]: ("grpc.secondary_user_agent", _compute_user_agent()), ( "grpc.max_receive_message_length", - opts.get("max_receive_message_length", MAX_DECODING_MESSAGE_SIZE), + opts.get("max_receive_message_length", _MAX_DECODING_MESSAGE_SIZE), ), ( "grpc.max_send_message_length", - opts.get("max_send_message_length", MAX_DECODING_MESSAGE_SIZE), + opts.get("max_send_message_length", _MAX_DECODING_MESSAGE_SIZE), ), ] diff --git a/python/lib/sift_client/transport/grpc_transport.py b/python/lib/sift_client/transport/grpc_transport.py index 8a829030ea..0dcd43c0cc 100644 --- a/python/lib/sift_client/transport/grpc_transport.py +++ b/python/lib/sift_client/transport/grpc_transport.py @@ -16,11 +16,13 @@ from sift_client._internal.grpc_transport.transport import ( DEFAULT_REQUEST_TIMEOUT_SECONDS, - MAX_DECODING_MESSAGE_SIZE, SiftChannelConfig, use_sift_async_channel, ) +MAX_DECODING_MESSAGE_SIZE = 50 * 1024 * 1024 +"""Largest gRPC message the client will accept or send, in bytes (50 MiB).""" + # Configure logging logger = logging.getLogger(__name__) @@ -64,9 +66,9 @@ def __init__( request_timeout: Default deadline in seconds applied to unary RPCs that don't set their own. Defaults to 60s. Set to None to disable the default deadline. max_receive_message_length: Maximum gRPC message size the client will accept (bytes). - Defaults to :data:`~sift_client._internal.grpc_transport.transport.MAX_DECODING_MESSAGE_SIZE`. + Defaults to [MAX_DECODING_MESSAGE_SIZE][]. max_send_message_length: Maximum gRPC message size the client will send (bytes). - Defaults to :data:`~sift_client._internal.grpc_transport.transport.MAX_DECODING_MESSAGE_SIZE`. + Defaults to [MAX_DECODING_MESSAGE_SIZE][]. """ parsed_url = urlparse(url) normalized_url = url From 635289521e353eeca804d6b17ec36d2fc9da6224 Mon Sep 17 00:00:00 2001 From: Adam Toth Date: Wed, 2 Sep 2026 09:58:06 -0700 Subject: [PATCH 6/8] Python(fix): update test import of MAX_DECODING_MESSAGE_SIZE to public module Co-Authored-By: Claude Sonnet 4.6 --- python/lib/sift_client/_tests/_internal/test_transport.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/python/lib/sift_client/_tests/_internal/test_transport.py b/python/lib/sift_client/_tests/_internal/test_transport.py index 9d05289c5b..0cac17a87c 100644 --- a/python/lib/sift_client/_tests/_internal/test_transport.py +++ b/python/lib/sift_client/_tests/_internal/test_transport.py @@ -5,10 +5,9 @@ import pytest from sift_client._internal.grpc_transport.transport import ( - MAX_DECODING_MESSAGE_SIZE, _compute_channel_options, ) -from sift_client.transport.grpc_transport import GrpcClient, GrpcConfig +from sift_client.transport.grpc_transport import MAX_DECODING_MESSAGE_SIZE, GrpcClient, GrpcConfig from sift_client.transport.rest_transport import DEFAULT_REST_TIMEOUT, RestClient, RestConfig From 3473613a297c2ae3d4c857a6d30a44c53c085159 Mon Sep 17 00:00:00 2001 From: Adam Toth Date: Wed, 2 Sep 2026 10:12:29 -0700 Subject: [PATCH 7/8] Python(fix): remove unnecessary underscore prefix from internal MAX_DECODING_MESSAGE_SIZE Co-Authored-By: Claude Sonnet 4.6 --- .../lib/sift_client/_internal/grpc_transport/transport.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/lib/sift_client/_internal/grpc_transport/transport.py b/python/lib/sift_client/_internal/grpc_transport/transport.py index 00d4b6c56f..11d67e9e95 100644 --- a/python/lib/sift_client/_internal/grpc_transport/transport.py +++ b/python/lib/sift_client/_internal/grpc_transport/transport.py @@ -34,7 +34,7 @@ DEFAULT_REQUEST_TIMEOUT_SECONDS = 60.0 """Default per-call deadline applied to unary RPCs that don't set their own.""" -_MAX_DECODING_MESSAGE_SIZE = 50 * 1024 * 1024 +MAX_DECODING_MESSAGE_SIZE = 50 * 1024 * 1024 """Largest gRPC response the client will decode, in bytes (50 MiB).""" @@ -170,11 +170,11 @@ def _compute_channel_options(opts: SiftChannelConfig) -> list[tuple[str, Any]]: ("grpc.secondary_user_agent", _compute_user_agent()), ( "grpc.max_receive_message_length", - opts.get("max_receive_message_length", _MAX_DECODING_MESSAGE_SIZE), + opts.get("max_receive_message_length", MAX_DECODING_MESSAGE_SIZE), ), ( "grpc.max_send_message_length", - opts.get("max_send_message_length", _MAX_DECODING_MESSAGE_SIZE), + opts.get("max_send_message_length", MAX_DECODING_MESSAGE_SIZE), ), ] From cecc3d099baf33fb94a8c91450c9636d1e580cbf Mon Sep 17 00:00:00 2001 From: Adam Toth Date: Wed, 2 Sep 2026 10:22:32 -0700 Subject: [PATCH 8/8] Python(fix): use backtick reference for MAX_DECODING_MESSAGE_SIZE in docstring Co-Authored-By: Claude Sonnet 4.6 --- python/lib/sift_client/transport/grpc_transport.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/lib/sift_client/transport/grpc_transport.py b/python/lib/sift_client/transport/grpc_transport.py index 0dcd43c0cc..738ba40c36 100644 --- a/python/lib/sift_client/transport/grpc_transport.py +++ b/python/lib/sift_client/transport/grpc_transport.py @@ -66,9 +66,9 @@ def __init__( request_timeout: Default deadline in seconds applied to unary RPCs that don't set their own. Defaults to 60s. Set to None to disable the default deadline. max_receive_message_length: Maximum gRPC message size the client will accept (bytes). - Defaults to [MAX_DECODING_MESSAGE_SIZE][]. + Defaults to `MAX_DECODING_MESSAGE_SIZE`. max_send_message_length: Maximum gRPC message size the client will send (bytes). - Defaults to [MAX_DECODING_MESSAGE_SIZE][]. + Defaults to `MAX_DECODING_MESSAGE_SIZE`. """ parsed_url = urlparse(url) normalized_url = url