@adonis-agora/telescope 0.26.1 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/providers/telescope_provider.d.ts +10 -0
  3. package/dist/providers/telescope_provider.d.ts.map +1 -1
  4. package/dist/providers/telescope_provider.js +37 -1
  5. package/dist/providers/telescope_provider.js.map +1 -1
  6. package/dist/providers/telescope_ui_provider.d.ts.map +1 -1
  7. package/dist/providers/telescope_ui_provider.js +29 -0
  8. package/dist/providers/telescope_ui_provider.js.map +1 -1
  9. package/dist/src/ai/factory.d.ts.map +1 -1
  10. package/dist/src/ai/factory.js +26 -3
  11. package/dist/src/ai/factory.js.map +1 -1
  12. package/dist/src/ai/index.d.ts +1 -1
  13. package/dist/src/ai/index.js +1 -1
  14. package/dist/src/ai_metrics/agent_events.d.ts +106 -0
  15. package/dist/src/ai_metrics/agent_events.d.ts.map +1 -0
  16. package/dist/src/ai_metrics/agent_events.js +170 -0
  17. package/dist/src/ai_metrics/agent_events.js.map +1 -0
  18. package/dist/src/ai_metrics/agent_metrics.d.ts +103 -0
  19. package/dist/src/ai_metrics/agent_metrics.d.ts.map +1 -0
  20. package/dist/src/ai_metrics/agent_metrics.js +255 -0
  21. package/dist/src/ai_metrics/agent_metrics.js.map +1 -0
  22. package/dist/src/ai_metrics/ai_usage.d.ts +123 -0
  23. package/dist/src/ai_metrics/ai_usage.d.ts.map +1 -0
  24. package/dist/src/ai_metrics/ai_usage.js +207 -0
  25. package/dist/src/ai_metrics/ai_usage.js.map +1 -0
  26. package/dist/src/ai_metrics/index.d.ts +11 -0
  27. package/dist/src/ai_metrics/index.d.ts.map +1 -0
  28. package/dist/src/ai_metrics/index.js +11 -0
  29. package/dist/src/ai_metrics/index.js.map +1 -0
  30. package/dist/src/ai_metrics/otel_metrics_exporter.d.ts +60 -0
  31. package/dist/src/ai_metrics/otel_metrics_exporter.d.ts.map +1 -0
  32. package/dist/src/ai_metrics/otel_metrics_exporter.js +66 -0
  33. package/dist/src/ai_metrics/otel_metrics_exporter.js.map +1 -0
  34. package/dist/src/ai_metrics/subscribe.d.ts +17 -0
  35. package/dist/src/ai_metrics/subscribe.d.ts.map +1 -0
  36. package/dist/src/ai_metrics/subscribe.js +38 -0
  37. package/dist/src/ai_metrics/subscribe.js.map +1 -0
  38. package/dist/src/alerts/index.d.ts +1 -1
  39. package/dist/src/alerts/index.js +1 -1
  40. package/dist/src/client_errors/ingestor.d.ts.map +1 -1
  41. package/dist/src/client_errors/ingestor.js +3 -2
  42. package/dist/src/client_errors/ingestor.js.map +1 -1
  43. package/dist/src/define_config.d.ts +72 -0
  44. package/dist/src/define_config.d.ts.map +1 -1
  45. package/dist/src/define_config.js +24 -4
  46. package/dist/src/define_config.js.map +1 -1
  47. package/dist/src/diagnostics_watcher.d.ts.map +1 -1
  48. package/dist/src/diagnostics_watcher.js +12 -4
  49. package/dist/src/diagnostics_watcher.js.map +1 -1
  50. package/dist/src/index.d.ts +2 -1
  51. package/dist/src/index.d.ts.map +1 -1
  52. package/dist/src/index.js +2 -1
  53. package/dist/src/index.js.map +1 -1
  54. package/dist/src/mcp/index.d.ts +1 -1
  55. package/dist/src/mcp/index.js +1 -1
  56. package/dist/src/metrics/metrics_service.d.ts +22 -0
  57. package/dist/src/metrics/metrics_service.d.ts.map +1 -1
  58. package/dist/src/metrics/metrics_service.js +49 -0
  59. package/dist/src/metrics/metrics_service.js.map +1 -1
  60. package/dist/src/profiling/index.d.ts +1 -1
  61. package/dist/src/profiling/index.js +1 -1
  62. package/dist/src/registry.d.ts +9 -0
  63. package/dist/src/registry.d.ts.map +1 -1
  64. package/dist/src/registry.js +6 -0
  65. package/dist/src/registry.js.map +1 -1
  66. package/dist/src/report_failure.d.ts +31 -0
  67. package/dist/src/report_failure.d.ts.map +1 -0
  68. package/dist/src/report_failure.js +70 -0
  69. package/dist/src/report_failure.js.map +1 -0
  70. package/dist/src/stores/lucid.d.ts +13 -2
  71. package/dist/src/stores/lucid.d.ts.map +1 -1
  72. package/dist/src/stores/lucid.js +85 -12
  73. package/dist/src/stores/lucid.js.map +1 -1
  74. package/dist/src/telescope_middleware.d.ts.map +1 -1
  75. package/dist/src/telescope_middleware.js +3 -2
  76. package/dist/src/telescope_middleware.js.map +1 -1
  77. package/dist/src/ui/api.d.ts +6 -0
  78. package/dist/src/ui/api.d.ts.map +1 -1
  79. package/dist/src/ui/api.js +23 -0
  80. package/dist/src/ui/api.js.map +1 -1
  81. package/dist/src/ui/index.d.ts +1 -1
  82. package/dist/src/ui/index.js +1 -1
  83. package/dist/src/watchers/index.d.ts +1 -1
  84. package/dist/src/watchers/index.js +1 -1
  85. package/dist/src/watchers/record.d.ts.map +1 -1
  86. package/dist/src/watchers/record.js +4 -2
  87. package/dist/src/watchers/record.js.map +1 -1
  88. package/grafana/agora-ai-dashboard.json +813 -0
  89. package/package.json +14 -2
@@ -0,0 +1,813 @@
1
+ {
2
+ "title": "Adonis Telescope — AI usage and agent runs",
3
+ "uid": "agora-ai-usage",
4
+ "description": "AI spend, tokens, unpriced calls and agent run timings from the agora_ai_* / agora_agent_* metrics.",
5
+ "tags": ["telescope", "ai", "agent", "agora"],
6
+ "editable": true,
7
+ "schemaVersion": 39,
8
+ "version": 1,
9
+ "time": {
10
+ "from": "now-6h",
11
+ "to": "now"
12
+ },
13
+ "refresh": "1m",
14
+ "templating": {
15
+ "list": [
16
+ {
17
+ "name": "datasource",
18
+ "label": "Prometheus",
19
+ "type": "datasource",
20
+ "query": "prometheus",
21
+ "current": {},
22
+ "hide": 0,
23
+ "refresh": 1
24
+ },
25
+ {
26
+ "name": "job",
27
+ "label": "Service",
28
+ "type": "query",
29
+ "datasource": {
30
+ "type": "prometheus",
31
+ "uid": "${datasource}"
32
+ },
33
+ "query": {
34
+ "query": "label_values(agora_ai_requests_total, job)",
35
+ "refId": "job"
36
+ },
37
+ "definition": "label_values(agora_ai_requests_total, job)",
38
+ "includeAll": true,
39
+ "multi": true,
40
+ "allValue": ".*",
41
+ "current": {
42
+ "text": "All",
43
+ "value": "$__all"
44
+ },
45
+ "refresh": 2,
46
+ "hide": 0
47
+ }
48
+ ]
49
+ },
50
+ "panels": [
51
+ {
52
+ "id": 1,
53
+ "title": "Total AI spend",
54
+ "type": "stat",
55
+ "datasource": {
56
+ "type": "prometheus",
57
+ "uid": "${datasource}"
58
+ },
59
+ "gridPos": {
60
+ "x": 0,
61
+ "y": 0,
62
+ "w": 4,
63
+ "h": 4
64
+ },
65
+ "targets": [
66
+ {
67
+ "expr": "sum(increase(agora_ai_cost_usd_total{job=~\"$job\"}[$__range]))",
68
+ "instant": true,
69
+ "range": false,
70
+ "datasource": {
71
+ "type": "prometheus",
72
+ "uid": "${datasource}"
73
+ },
74
+ "refId": "A"
75
+ }
76
+ ],
77
+ "description": "Spend over the selected range.",
78
+ "fieldConfig": {
79
+ "defaults": {
80
+ "unit": "currencyUSD",
81
+ "decimals": 2,
82
+ "color": {
83
+ "mode": "fixed",
84
+ "fixedColor": "text"
85
+ }
86
+ },
87
+ "overrides": []
88
+ },
89
+ "options": {
90
+ "reduceOptions": {
91
+ "calcs": ["lastNotNull"],
92
+ "fields": "",
93
+ "values": false
94
+ },
95
+ "colorMode": "value",
96
+ "graphMode": "none",
97
+ "textMode": "value"
98
+ }
99
+ },
100
+ {
101
+ "id": 2,
102
+ "title": "Platform spend",
103
+ "type": "stat",
104
+ "datasource": {
105
+ "type": "prometheus",
106
+ "uid": "${datasource}"
107
+ },
108
+ "gridPos": {
109
+ "x": 4,
110
+ "y": 0,
111
+ "w": 4,
112
+ "h": 4
113
+ },
114
+ "targets": [
115
+ {
116
+ "expr": "sum(increase(agora_ai_cost_usd_total{job=~\"$job\",platform=\"true\"}[$__range]))",
117
+ "instant": true,
118
+ "range": false,
119
+ "datasource": {
120
+ "type": "prometheus",
121
+ "uid": "${datasource}"
122
+ },
123
+ "refId": "A"
124
+ }
125
+ ],
126
+ "description": "Paid by the platform (actorRef @platform).",
127
+ "fieldConfig": {
128
+ "defaults": {
129
+ "unit": "currencyUSD",
130
+ "decimals": 2,
131
+ "color": {
132
+ "mode": "fixed",
133
+ "fixedColor": "text"
134
+ }
135
+ },
136
+ "overrides": []
137
+ },
138
+ "options": {
139
+ "reduceOptions": {
140
+ "calcs": ["lastNotNull"],
141
+ "fields": "",
142
+ "values": false
143
+ },
144
+ "colorMode": "value",
145
+ "graphMode": "none",
146
+ "textMode": "value"
147
+ }
148
+ },
149
+ {
150
+ "id": 3,
151
+ "title": "Estimated spend",
152
+ "type": "stat",
153
+ "datasource": {
154
+ "type": "prometheus",
155
+ "uid": "${datasource}"
156
+ },
157
+ "gridPos": {
158
+ "x": 8,
159
+ "y": 0,
160
+ "w": 4,
161
+ "h": 4
162
+ },
163
+ "targets": [
164
+ {
165
+ "expr": "sum(increase(agora_ai_cost_usd_total{job=~\"$job\",cost_source=\"estimate\"}[$__range]))",
166
+ "instant": true,
167
+ "range": false,
168
+ "datasource": {
169
+ "type": "prometheus",
170
+ "uid": "${datasource}"
171
+ },
172
+ "refId": "A"
173
+ }
174
+ ],
175
+ "description": "Priced by an estimate, not by the provider.",
176
+ "fieldConfig": {
177
+ "defaults": {
178
+ "unit": "currencyUSD",
179
+ "decimals": 2,
180
+ "color": {
181
+ "mode": "fixed",
182
+ "fixedColor": "text"
183
+ }
184
+ },
185
+ "overrides": []
186
+ },
187
+ "options": {
188
+ "reduceOptions": {
189
+ "calcs": ["lastNotNull"],
190
+ "fields": "",
191
+ "values": false
192
+ },
193
+ "colorMode": "value",
194
+ "graphMode": "none",
195
+ "textMode": "value"
196
+ }
197
+ },
198
+ {
199
+ "id": 4,
200
+ "title": "AI calls",
201
+ "type": "stat",
202
+ "datasource": {
203
+ "type": "prometheus",
204
+ "uid": "${datasource}"
205
+ },
206
+ "gridPos": {
207
+ "x": 12,
208
+ "y": 0,
209
+ "w": 4,
210
+ "h": 4
211
+ },
212
+ "targets": [
213
+ {
214
+ "expr": "sum(increase(agora_ai_requests_total{job=~\"$job\"}[$__range]))",
215
+ "instant": true,
216
+ "range": false,
217
+ "datasource": {
218
+ "type": "prometheus",
219
+ "uid": "${datasource}"
220
+ },
221
+ "refId": "A"
222
+ }
223
+ ],
224
+ "description": "Calls in the usage ledger.",
225
+ "fieldConfig": {
226
+ "defaults": {
227
+ "unit": "short",
228
+ "decimals": 0,
229
+ "color": {
230
+ "mode": "fixed",
231
+ "fixedColor": "text"
232
+ }
233
+ },
234
+ "overrides": []
235
+ },
236
+ "options": {
237
+ "reduceOptions": {
238
+ "calcs": ["lastNotNull"],
239
+ "fields": "",
240
+ "values": false
241
+ },
242
+ "colorMode": "value",
243
+ "graphMode": "none",
244
+ "textMode": "value"
245
+ }
246
+ },
247
+ {
248
+ "id": 5,
249
+ "title": "Unpriced calls",
250
+ "type": "stat",
251
+ "datasource": {
252
+ "type": "prometheus",
253
+ "uid": "${datasource}"
254
+ },
255
+ "gridPos": {
256
+ "x": 16,
257
+ "y": 0,
258
+ "w": 4,
259
+ "h": 4
260
+ },
261
+ "targets": [
262
+ {
263
+ "expr": "sum(increase(agora_ai_requests_total{job=~\"$job\",cost_source=\"none\"}[$__range])) or vector(0)",
264
+ "instant": true,
265
+ "range": false,
266
+ "datasource": {
267
+ "type": "prometheus",
268
+ "uid": "${datasource}"
269
+ },
270
+ "refId": "A"
271
+ }
272
+ ],
273
+ "description": "Calls recorded with no cost.",
274
+ "fieldConfig": {
275
+ "defaults": {
276
+ "unit": "short",
277
+ "decimals": 0,
278
+ "color": {
279
+ "mode": "fixed",
280
+ "fixedColor": "orange"
281
+ }
282
+ },
283
+ "overrides": []
284
+ },
285
+ "options": {
286
+ "reduceOptions": {
287
+ "calcs": ["lastNotNull"],
288
+ "fields": "",
289
+ "values": false
290
+ },
291
+ "colorMode": "value",
292
+ "graphMode": "none",
293
+ "textMode": "value"
294
+ }
295
+ },
296
+ {
297
+ "id": 6,
298
+ "title": "Agent runs",
299
+ "type": "stat",
300
+ "datasource": {
301
+ "type": "prometheus",
302
+ "uid": "${datasource}"
303
+ },
304
+ "gridPos": {
305
+ "x": 20,
306
+ "y": 0,
307
+ "w": 4,
308
+ "h": 4
309
+ },
310
+ "targets": [
311
+ {
312
+ "expr": "sum(increase(agora_agent_run_duration_ms_count{job=~\"$job\"}[$__range]))",
313
+ "instant": true,
314
+ "range": false,
315
+ "datasource": {
316
+ "type": "prometheus",
317
+ "uid": "${datasource}"
318
+ },
319
+ "refId": "A"
320
+ }
321
+ ],
322
+ "description": "Terminal agent runs (completed, failed, cancelled).",
323
+ "fieldConfig": {
324
+ "defaults": {
325
+ "unit": "short",
326
+ "decimals": 0,
327
+ "color": {
328
+ "mode": "fixed",
329
+ "fixedColor": "text"
330
+ }
331
+ },
332
+ "overrides": []
333
+ },
334
+ "options": {
335
+ "reduceOptions": {
336
+ "calcs": ["lastNotNull"],
337
+ "fields": "",
338
+ "values": false
339
+ },
340
+ "colorMode": "value",
341
+ "graphMode": "none",
342
+ "textMode": "value"
343
+ }
344
+ },
345
+ {
346
+ "id": 7,
347
+ "title": "Cost per day by feature",
348
+ "type": "timeseries",
349
+ "datasource": {
350
+ "type": "prometheus",
351
+ "uid": "${datasource}"
352
+ },
353
+ "gridPos": {
354
+ "x": 0,
355
+ "y": 4,
356
+ "w": 12,
357
+ "h": 9
358
+ },
359
+ "targets": [
360
+ {
361
+ "expr": "sum by (feature) (increase(agora_ai_cost_usd_total{job=~\"$job\"}[1d] offset -1d))",
362
+ "legendFormat": "{{feature}}",
363
+ "interval": "1d",
364
+ "datasource": {
365
+ "type": "prometheus",
366
+ "uid": "${datasource}"
367
+ },
368
+ "refId": "A"
369
+ }
370
+ ],
371
+ "interval": "1d",
372
+ "timeFrom": "7d",
373
+ "description": "One bar per UTC day: the spend during that day. Uses a negative offset (Prometheus 3+, or 2.x with --enable-feature=promql-negative-offset).",
374
+ "fieldConfig": {
375
+ "defaults": {
376
+ "unit": "currencyUSD",
377
+ "custom": {
378
+ "drawStyle": "bars",
379
+ "fillOpacity": 80,
380
+ "stacking": {
381
+ "mode": "normal",
382
+ "group": "A"
383
+ },
384
+ "lineWidth": 1
385
+ }
386
+ },
387
+ "overrides": []
388
+ },
389
+ "options": {
390
+ "legend": {
391
+ "displayMode": "table",
392
+ "placement": "right",
393
+ "calcs": ["sum"]
394
+ },
395
+ "tooltip": {
396
+ "mode": "multi",
397
+ "sort": "desc"
398
+ }
399
+ }
400
+ },
401
+ {
402
+ "id": 8,
403
+ "title": "Cost by model",
404
+ "type": "bargauge",
405
+ "datasource": {
406
+ "type": "prometheus",
407
+ "uid": "${datasource}"
408
+ },
409
+ "gridPos": {
410
+ "x": 12,
411
+ "y": 4,
412
+ "w": 12,
413
+ "h": 9
414
+ },
415
+ "targets": [
416
+ {
417
+ "expr": "sort_desc(sum by (model) (increase(agora_ai_cost_usd_total{job=~\"$job\"}[$__range])))",
418
+ "legendFormat": "{{model}}",
419
+ "instant": true,
420
+ "range": false,
421
+ "datasource": {
422
+ "type": "prometheus",
423
+ "uid": "${datasource}"
424
+ },
425
+ "refId": "A"
426
+ }
427
+ ],
428
+ "fieldConfig": {
429
+ "defaults": {
430
+ "unit": "currencyUSD",
431
+ "decimals": 2,
432
+ "color": {
433
+ "mode": "palette-classic"
434
+ }
435
+ },
436
+ "overrides": []
437
+ },
438
+ "options": {
439
+ "orientation": "horizontal",
440
+ "displayMode": "gradient",
441
+ "showUnfilled": true,
442
+ "reduceOptions": {
443
+ "calcs": ["lastNotNull"],
444
+ "fields": "",
445
+ "values": false
446
+ }
447
+ }
448
+ },
449
+ {
450
+ "id": 9,
451
+ "title": "Spend rate by feature (USD/hour)",
452
+ "type": "timeseries",
453
+ "datasource": {
454
+ "type": "prometheus",
455
+ "uid": "${datasource}"
456
+ },
457
+ "gridPos": {
458
+ "x": 0,
459
+ "y": 13,
460
+ "w": 12,
461
+ "h": 8
462
+ },
463
+ "targets": [
464
+ {
465
+ "expr": "sum by (feature) (rate(agora_ai_cost_usd_total{job=~\"$job\"}[$__rate_interval])) * 3600",
466
+ "legendFormat": "{{feature}}",
467
+ "datasource": {
468
+ "type": "prometheus",
469
+ "uid": "${datasource}"
470
+ },
471
+ "refId": "A"
472
+ }
473
+ ],
474
+ "fieldConfig": {
475
+ "defaults": {
476
+ "unit": "currencyUSD",
477
+ "custom": {
478
+ "fillOpacity": 15,
479
+ "lineWidth": 1
480
+ }
481
+ },
482
+ "overrides": []
483
+ }
484
+ },
485
+ {
486
+ "id": 10,
487
+ "title": "Tokens per minute by direction",
488
+ "type": "timeseries",
489
+ "datasource": {
490
+ "type": "prometheus",
491
+ "uid": "${datasource}"
492
+ },
493
+ "gridPos": {
494
+ "x": 12,
495
+ "y": 13,
496
+ "w": 12,
497
+ "h": 8
498
+ },
499
+ "targets": [
500
+ {
501
+ "expr": "sum by (direction) (rate(agora_ai_tokens_total{job=~\"$job\"}[$__rate_interval])) * 60",
502
+ "legendFormat": "{{direction}}",
503
+ "datasource": {
504
+ "type": "prometheus",
505
+ "uid": "${datasource}"
506
+ },
507
+ "refId": "A"
508
+ }
509
+ ],
510
+ "fieldConfig": {
511
+ "defaults": {
512
+ "unit": "short",
513
+ "custom": {
514
+ "fillOpacity": 15,
515
+ "lineWidth": 1
516
+ }
517
+ },
518
+ "overrides": []
519
+ }
520
+ },
521
+ {
522
+ "id": 11,
523
+ "title": "Run duration p50 / p90 by agent",
524
+ "type": "timeseries",
525
+ "datasource": {
526
+ "type": "prometheus",
527
+ "uid": "${datasource}"
528
+ },
529
+ "gridPos": {
530
+ "x": 0,
531
+ "y": 21,
532
+ "w": 12,
533
+ "h": 8
534
+ },
535
+ "targets": [
536
+ {
537
+ "expr": "histogram_quantile(0.5, sum by (le, agent) (rate(agora_agent_run_duration_ms_bucket{job=~\"$job\"}[$__rate_interval])))",
538
+ "legendFormat": "{{agent}} p50",
539
+ "datasource": {
540
+ "type": "prometheus",
541
+ "uid": "${datasource}"
542
+ },
543
+ "refId": "A"
544
+ },
545
+ {
546
+ "expr": "histogram_quantile(0.9, sum by (le, agent) (rate(agora_agent_run_duration_ms_bucket{job=~\"$job\"}[$__rate_interval])))",
547
+ "legendFormat": "{{agent}} p90",
548
+ "datasource": {
549
+ "type": "prometheus",
550
+ "uid": "${datasource}"
551
+ },
552
+ "refId": "B"
553
+ }
554
+ ],
555
+ "fieldConfig": {
556
+ "defaults": {
557
+ "unit": "ms",
558
+ "custom": {
559
+ "lineWidth": 1,
560
+ "fillOpacity": 0
561
+ }
562
+ },
563
+ "overrides": []
564
+ }
565
+ },
566
+ {
567
+ "id": 12,
568
+ "title": "Run queue time p50 / p90 by agent",
569
+ "type": "timeseries",
570
+ "datasource": {
571
+ "type": "prometheus",
572
+ "uid": "${datasource}"
573
+ },
574
+ "gridPos": {
575
+ "x": 12,
576
+ "y": 21,
577
+ "w": 12,
578
+ "h": 8
579
+ },
580
+ "targets": [
581
+ {
582
+ "expr": "histogram_quantile(0.5, sum by (le, agent) (rate(agora_agent_run_queue_ms_bucket{job=~\"$job\"}[$__rate_interval])))",
583
+ "legendFormat": "{{agent}} p50",
584
+ "datasource": {
585
+ "type": "prometheus",
586
+ "uid": "${datasource}"
587
+ },
588
+ "refId": "A"
589
+ },
590
+ {
591
+ "expr": "histogram_quantile(0.9, sum by (le, agent) (rate(agora_agent_run_queue_ms_bucket{job=~\"$job\"}[$__rate_interval])))",
592
+ "legendFormat": "{{agent}} p90",
593
+ "datasource": {
594
+ "type": "prometheus",
595
+ "uid": "${datasource}"
596
+ },
597
+ "refId": "B"
598
+ }
599
+ ],
600
+ "fieldConfig": {
601
+ "defaults": {
602
+ "unit": "ms",
603
+ "custom": {
604
+ "lineWidth": 1,
605
+ "fillOpacity": 0
606
+ }
607
+ },
608
+ "overrides": []
609
+ }
610
+ },
611
+ {
612
+ "id": 13,
613
+ "title": "Run model time p50 / p90 by agent",
614
+ "type": "timeseries",
615
+ "datasource": {
616
+ "type": "prometheus",
617
+ "uid": "${datasource}"
618
+ },
619
+ "gridPos": {
620
+ "x": 0,
621
+ "y": 29,
622
+ "w": 12,
623
+ "h": 8
624
+ },
625
+ "targets": [
626
+ {
627
+ "expr": "histogram_quantile(0.5, sum by (le, agent) (rate(agora_agent_run_model_ms_bucket{job=~\"$job\"}[$__rate_interval])))",
628
+ "legendFormat": "{{agent}} p50",
629
+ "datasource": {
630
+ "type": "prometheus",
631
+ "uid": "${datasource}"
632
+ },
633
+ "refId": "A"
634
+ },
635
+ {
636
+ "expr": "histogram_quantile(0.9, sum by (le, agent) (rate(agora_agent_run_model_ms_bucket{job=~\"$job\"}[$__rate_interval])))",
637
+ "legendFormat": "{{agent}} p90",
638
+ "datasource": {
639
+ "type": "prometheus",
640
+ "uid": "${datasource}"
641
+ },
642
+ "refId": "B"
643
+ }
644
+ ],
645
+ "fieldConfig": {
646
+ "defaults": {
647
+ "unit": "ms",
648
+ "custom": {
649
+ "lineWidth": 1,
650
+ "fillOpacity": 0
651
+ }
652
+ },
653
+ "overrides": []
654
+ }
655
+ },
656
+ {
657
+ "id": 14,
658
+ "title": "Run tools time p50 / p90 by agent",
659
+ "type": "timeseries",
660
+ "datasource": {
661
+ "type": "prometheus",
662
+ "uid": "${datasource}"
663
+ },
664
+ "gridPos": {
665
+ "x": 12,
666
+ "y": 29,
667
+ "w": 12,
668
+ "h": 8
669
+ },
670
+ "targets": [
671
+ {
672
+ "expr": "histogram_quantile(0.5, sum by (le, agent) (rate(agora_agent_run_tools_ms_bucket{job=~\"$job\"}[$__rate_interval])))",
673
+ "legendFormat": "{{agent}} p50",
674
+ "datasource": {
675
+ "type": "prometheus",
676
+ "uid": "${datasource}"
677
+ },
678
+ "refId": "A"
679
+ },
680
+ {
681
+ "expr": "histogram_quantile(0.9, sum by (le, agent) (rate(agora_agent_run_tools_ms_bucket{job=~\"$job\"}[$__rate_interval])))",
682
+ "legendFormat": "{{agent}} p90",
683
+ "datasource": {
684
+ "type": "prometheus",
685
+ "uid": "${datasource}"
686
+ },
687
+ "refId": "B"
688
+ }
689
+ ],
690
+ "fieldConfig": {
691
+ "defaults": {
692
+ "unit": "ms",
693
+ "custom": {
694
+ "lineWidth": 1,
695
+ "fillOpacity": 0
696
+ }
697
+ },
698
+ "overrides": []
699
+ }
700
+ },
701
+ {
702
+ "id": 15,
703
+ "title": "Tool duration p50 / p90 by tool",
704
+ "type": "timeseries",
705
+ "datasource": {
706
+ "type": "prometheus",
707
+ "uid": "${datasource}"
708
+ },
709
+ "gridPos": {
710
+ "x": 0,
711
+ "y": 37,
712
+ "w": 12,
713
+ "h": 9
714
+ },
715
+ "targets": [
716
+ {
717
+ "expr": "histogram_quantile(0.5, sum by (le, tool) (rate(agora_agent_tool_duration_ms_bucket{job=~\"$job\"}[$__rate_interval])))",
718
+ "legendFormat": "{{tool}} p50",
719
+ "datasource": {
720
+ "type": "prometheus",
721
+ "uid": "${datasource}"
722
+ },
723
+ "refId": "A"
724
+ },
725
+ {
726
+ "expr": "histogram_quantile(0.9, sum by (le, tool) (rate(agora_agent_tool_duration_ms_bucket{job=~\"$job\"}[$__rate_interval])))",
727
+ "legendFormat": "{{tool}} p90",
728
+ "datasource": {
729
+ "type": "prometheus",
730
+ "uid": "${datasource}"
731
+ },
732
+ "refId": "B"
733
+ }
734
+ ],
735
+ "fieldConfig": {
736
+ "defaults": {
737
+ "unit": "ms",
738
+ "custom": {
739
+ "lineWidth": 1
740
+ }
741
+ },
742
+ "overrides": []
743
+ }
744
+ },
745
+ {
746
+ "id": 16,
747
+ "title": "Unpriced calls by feature / model",
748
+ "type": "table",
749
+ "datasource": {
750
+ "type": "prometheus",
751
+ "uid": "${datasource}"
752
+ },
753
+ "gridPos": {
754
+ "x": 12,
755
+ "y": 37,
756
+ "w": 12,
757
+ "h": 9
758
+ },
759
+ "targets": [
760
+ {
761
+ "expr": "sort_desc(sum by (feature, model, provider) (increase(agora_ai_requests_total{job=~\"$job\",cost_source=\"none\"}[$__range])))",
762
+ "format": "table",
763
+ "instant": true,
764
+ "range": false,
765
+ "datasource": {
766
+ "type": "prometheus",
767
+ "uid": "${datasource}"
768
+ },
769
+ "refId": "A"
770
+ }
771
+ ],
772
+ "fieldConfig": {
773
+ "defaults": {
774
+ "decimals": 0
775
+ },
776
+ "overrides": [
777
+ {
778
+ "matcher": {
779
+ "id": "byName",
780
+ "options": "Value"
781
+ },
782
+ "properties": [
783
+ {
784
+ "id": "displayName",
785
+ "value": "calls"
786
+ }
787
+ ]
788
+ }
789
+ ]
790
+ },
791
+ "transformations": [
792
+ {
793
+ "id": "labelsToFields",
794
+ "options": {
795
+ "mode": "columns"
796
+ }
797
+ },
798
+ {
799
+ "id": "merge",
800
+ "options": {}
801
+ },
802
+ {
803
+ "id": "organize",
804
+ "options": {
805
+ "excludeByName": {
806
+ "Time": true
807
+ }
808
+ }
809
+ }
810
+ ]
811
+ }
812
+ ]
813
+ }