@@ -112,7 +112,7 @@ def _extract_endpoint_attributes(
112112 return attrs
113113
114114
115- def _extract_t4_attributes (request : Any ) -> dict [str , Any ]:
115+ def _extract_grpc_request_attributes (request : Any ) -> dict [str , Any ]:
116116 """Extracts Google Cloud T4 semantic and resource attributes from a gRPC request object.
117117
118118 Args:
@@ -142,15 +142,15 @@ def _extract_t4_attributes(request: Any) -> dict[str, Any]:
142142 return attrs
143143
144144
145- def _make_client_request_hook (
145+ def _make_grpc_client_request_hook (
146146 endpoint_attrs : dict [str , Any ] | None = None ,
147147) -> Callable [[Any , Any ], None ]:
148- """Creates an OpenTelemetry client request hook with optional endpoint attributes."""
148+ """Creates an OpenTelemetry gRPC client request hook with optional endpoint attributes."""
149149
150150 def client_request_hook (span : Any , request : Any ) -> None :
151151 if span is None or not getattr (span , "is_recording" , lambda : True )():
152152 return
153- attrs = _extract_t4_attributes (request )
153+ attrs = _extract_grpc_request_attributes (request )
154154 if endpoint_attrs :
155155 attrs .update (endpoint_attrs )
156156 for key , value in attrs .items ():
@@ -159,11 +159,11 @@ def client_request_hook(span: Any, request: Any) -> None:
159159 return client_request_hook
160160
161161
162- _client_request_hook = _make_client_request_hook ()
162+ _grpc_client_request_hook = _make_grpc_client_request_hook ()
163163
164164
165- def _client_response_hook (span : Any , response : Any ) -> None :
166- """OpenTelemetry client response hook to inject gRPC response status attributes into the span."""
165+ def _grpc_client_response_hook (span : Any , response : Any ) -> None :
166+ """OpenTelemetry gRPC client response hook to inject response status attributes into the span."""
167167 if span is None or not getattr (span , "is_recording" , lambda : True )():
168168 return
169169
@@ -230,15 +230,15 @@ def get_otel_interceptor(
230230
231231 endpoint_attrs = _extract_endpoint_attributes (client_options )
232232 request_hook = (
233- _make_client_request_hook (endpoint_attrs )
233+ _make_grpc_client_request_hook (endpoint_attrs )
234234 if endpoint_attrs
235- else _client_request_hook
235+ else _grpc_client_request_hook
236236 )
237237
238238 interceptor : ClientInterceptor = otel_grpc .client_interceptor (
239239 tracer_provider = _get_tracer_provider (client_options ),
240240 request_hook = request_hook ,
241- response_hook = _client_response_hook ,
241+ response_hook = _grpc_client_response_hook ,
242242 )
243243
244244 def otel_interceptor (channel : grpc .Channel ) -> grpc .Channel :
@@ -268,13 +268,13 @@ def get_otel_async_interceptor(
268268
269269 endpoint_attrs = _extract_endpoint_attributes (client_options )
270270 request_hook = (
271- _make_client_request_hook (endpoint_attrs )
271+ _make_grpc_client_request_hook (endpoint_attrs )
272272 if endpoint_attrs
273- else _client_request_hook
273+ else _grpc_client_request_hook
274274 )
275275
276276 return otel_grpc .aio_client_interceptors (
277277 tracer_provider = _get_tracer_provider (client_options ),
278278 request_hook = request_hook ,
279- response_hook = _client_response_hook ,
279+ response_hook = _grpc_client_response_hook ,
280280 )
0 commit comments