This repository was archived by the owner on Mar 31, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3131# If `opentelemetry-sdk` is available, enable the tracer
3232try :
3333 from opentelemetry import trace
34- from opentelemetry .trace .propagation .tracecontext TraceContextTextMapPropagator
34+ from opentelemetry .trace .propagation .tracecontext import TraceContextTextMapPropagator
3535
3636 otel_propagator = TraceContextTextMapPropagator ()
3737 otel_tracer = trace .get_tracer (__name__ )
@@ -207,9 +207,13 @@ def _is_message_too_large(rpc_error: grpc.RpcError) -> bool:
207207 RESOURCE_EXHAUSTED is also used for rate limiting / quota errors, which are transient and
208208 should not be treated the same as a permanent message-size violation.
209209 """
210+ if rpc_error .code () != grpc .StatusCode .RESOURCE_EXHAUSTED :
211+ return False
212+ details = (rpc_error .details () or "" ).lower ()
210213 return (
211- rpc_error .code () == grpc .StatusCode .RESOURCE_EXHAUSTED
212- and "received message larger than max" in (rpc_error .details () or "" ).lower ()
214+ "message larger than max" in details
215+ or "received message larger than max" in details
216+ or "sent message larger than max" in details
213217 )
214218
215219
You can’t perform that action at this time.
0 commit comments