Commit bd01dcd
Fix gRPC client interceptor breaking bidirectional streaming (open-telemetry#1180) (open-telemetry#4259)
* Fix gRPC client interceptor breaking bidirectional streaming (open-telemetry#1180)
Route bidi (stream-stream) RPCs through `_intercept` instead of the
generator-based `_intercept_server_stream`. The generator wrapper strips
the grpc.Call/grpc.Future interface, causing downstream code (e.g.
google.api_core.bidi.BidiRpc) to crash with:
AttributeError: 'generator' object has no attribute 'add_done_callback'
The fix adds `and not client_info.is_client_stream` to the condition in
`intercept_stream()` so only unary-stream RPCs use the generator path.
Includes a regression test verifying the bidi stream response preserves
the grpc.Call interface (add_done_callback, cancel, is_active).
Co-authored-by: Cursor <cursoragent@cursor.com>
* Add gRPC status code attributes to error handling in client
* Remove redundant status description from span error status
The gRPC status code is already captured in the RPC_GRPC_STATUS_CODE
attribute, making the description in span status unnecessary.
* Update CHANGELOG.md
* Update CHANGELOG.md
* Add RPC_GRPC_STATUS_CODE assertions to client error tests
Verify that error spans include the correct gRPC status code attribute
(INVALID_ARGUMENT) in both sync and async client interceptor tests.
---------
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>1 parent 7930a15 commit bd01dcd
4 files changed
Lines changed: 86 additions & 1 deletion
File tree
- instrumentation/opentelemetry-instrumentation-grpc
- src/opentelemetry/instrumentation/grpc
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| |||
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
63 | 69 | | |
64 | 70 | | |
65 | 71 | | |
| |||
228 | 234 | | |
229 | 235 | | |
230 | 236 | | |
231 | | - | |
| 237 | + | |
232 | 238 | | |
233 | 239 | | |
234 | 240 | | |
| |||
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
227 | 231 | | |
228 | 232 | | |
229 | 233 | | |
| |||
237 | 241 | | |
238 | 242 | | |
239 | 243 | | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
240 | 248 | | |
241 | 249 | | |
242 | 250 | | |
| |||
249 | 257 | | |
250 | 258 | | |
251 | 259 | | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
252 | 264 | | |
253 | 265 | | |
254 | 266 | | |
| |||
264 | 276 | | |
265 | 277 | | |
266 | 278 | | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
267 | 283 | | |
268 | 284 | | |
269 | 285 | | |
| |||
Lines changed: 61 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
224 | 269 | | |
225 | 270 | | |
226 | 271 | | |
| |||
232 | 277 | | |
233 | 278 | | |
234 | 279 | | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
235 | 284 | | |
236 | 285 | | |
237 | 286 | | |
| |||
244 | 293 | | |
245 | 294 | | |
246 | 295 | | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
247 | 300 | | |
248 | 301 | | |
249 | 302 | | |
| |||
256 | 309 | | |
257 | 310 | | |
258 | 311 | | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
259 | 316 | | |
260 | 317 | | |
261 | 318 | | |
| |||
268 | 325 | | |
269 | 326 | | |
270 | 327 | | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
271 | 332 | | |
272 | 333 | | |
273 | 334 | | |
| |||
0 commit comments