Commit 4816963
authored
ref(core): Do not emit spans for chats.create in google-genai (#19990)
We currently emit spans for the google-genai `chats.create()` API. I
think this is basically useless because `chats.create()` doesn't
represent an actual interaction with an LLM model, instead it just
constructs a local chat object as a result that then further exposes
methods like `sendMessage()` that represent actual LLM interactions.
This PR removes the spans for `chats.create()`.
Since this API is a special case where we actually need to proxy the
return object instead of the method call itself we had some surrounding
logic hardcoded to this method. To make this a bit more future proof and
also more explicit we now add a `proxyResultPath` field to the method
registry that allows to define this behavior in the method registry
without needing any hardcoded logic. Another benefit this has is that
the full logic in the `createDeepProxy` methods in all our client-proxy
based AI integrations (google-genai, openai, anthropic) is now
essentially the same so could potentially in the future be easily merged
into a shared abstraction.
Limitation: We do"loose" some data by not emitting this create span
anymore, because the way this API works is that the user defines certain
parameters only on the `chats.create()` call and these are then
subsequently used for each `chat.sendMessage()` call. The correct way
would be to send this data as part of each `chat.sendMessage()` chat
span. We can think about doing this as part of this PR or doing a follow
up.1 parent ff0cee1 commit 4816963
File tree
8 files changed
+50
-142
lines changed- dev-packages
- browser-integration-tests/suites/tracing/ai-providers/google-genai
- cloudflare-integration-tests/suites/tracing/google-genai
- node-integration-tests/suites/tracing/google-genai
- packages/core/src/tracing
- ai
- anthropic-ai
- google-genai
- openai
8 files changed
+50
-142
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
Lines changed: 3 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 30 | + | |
47 | 31 | | |
48 | 32 | | |
49 | 33 | | |
| |||
59 | 43 | | |
60 | 44 | | |
61 | 45 | | |
62 | | - | |
| 46 | + | |
63 | 47 | | |
64 | 48 | | |
65 | 49 | | |
| |||
78 | 62 | | |
79 | 63 | | |
80 | 64 | | |
81 | | - | |
| 65 | + | |
82 | 66 | | |
83 | 67 | | |
84 | 68 | | |
| |||
Lines changed: 14 additions & 83 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 35 | + | |
53 | 36 | | |
54 | 37 | | |
55 | 38 | | |
| |||
66 | 49 | | |
67 | 50 | | |
68 | 51 | | |
69 | | - | |
| 52 | + | |
70 | 53 | | |
71 | 54 | | |
72 | 55 | | |
| |||
86 | 69 | | |
87 | 70 | | |
88 | 71 | | |
89 | | - | |
| 72 | + | |
90 | 73 | | |
91 | 74 | | |
92 | 75 | | |
| |||
106 | 89 | | |
107 | 90 | | |
108 | 91 | | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
| 92 | + | |
128 | 93 | | |
129 | 94 | | |
130 | 95 | | |
| |||
143 | 108 | | |
144 | 109 | | |
145 | 110 | | |
146 | | - | |
| 111 | + | |
147 | 112 | | |
148 | 113 | | |
149 | 114 | | |
| |||
165 | 130 | | |
166 | 131 | | |
167 | 132 | | |
168 | | - | |
| 133 | + | |
169 | 134 | | |
170 | 135 | | |
171 | 136 | | |
| |||
309 | 274 | | |
310 | 275 | | |
311 | 276 | | |
312 | | - | |
| 277 | + | |
313 | 278 | | |
314 | 279 | | |
315 | 280 | | |
| |||
333 | 298 | | |
334 | 299 | | |
335 | 300 | | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
| 301 | + | |
354 | 302 | | |
355 | 303 | | |
356 | 304 | | |
| |||
367 | 315 | | |
368 | 316 | | |
369 | 317 | | |
370 | | - | |
| 318 | + | |
371 | 319 | | |
372 | 320 | | |
373 | 321 | | |
| |||
379 | 327 | | |
380 | 328 | | |
381 | 329 | | |
382 | | - | |
| 330 | + | |
383 | 331 | | |
384 | 332 | | |
385 | 333 | | |
| |||
397 | 345 | | |
398 | 346 | | |
399 | 347 | | |
400 | | - | |
| 348 | + | |
401 | 349 | | |
402 | 350 | | |
403 | 351 | | |
| |||
422 | 370 | | |
423 | 371 | | |
424 | 372 | | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
| 373 | + | |
443 | 374 | | |
444 | 375 | | |
445 | 376 | | |
| |||
461 | 392 | | |
462 | 393 | | |
463 | 394 | | |
464 | | - | |
| 395 | + | |
465 | 396 | | |
466 | 397 | | |
467 | 398 | | |
| |||
478 | 409 | | |
479 | 410 | | |
480 | 411 | | |
481 | | - | |
| 412 | + | |
482 | 413 | | |
483 | 414 | | |
484 | 415 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
| 31 | + | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
256 | | - | |
| 256 | + | |
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
| 13 | + | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
21 | | - | |
22 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
267 | | - | |
268 | 267 | | |
269 | 268 | | |
270 | 269 | | |
271 | 270 | | |
272 | | - | |
| 271 | + | |
273 | 272 | | |
274 | 273 | | |
275 | 274 | | |
| |||
308 | 307 | | |
309 | 308 | | |
310 | 309 | | |
311 | | - | |
| 310 | + | |
312 | 311 | | |
313 | 312 | | |
314 | 313 | | |
| |||
326 | 325 | | |
327 | 326 | | |
328 | 327 | | |
329 | | - | |
330 | | - | |
| 328 | + | |
| 329 | + | |
331 | 330 | | |
332 | 331 | | |
333 | 332 | | |
| |||
348 | 347 | | |
349 | 348 | | |
350 | 349 | | |
351 | | - | |
| 350 | + | |
| 351 | + | |
352 | 352 | | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
370 | 360 | | |
371 | 361 | | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
379 | 373 | | |
380 | 374 | | |
381 | 375 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
| 145 | + | |
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
| |||
0 commit comments