toad-eye 2.4.5 → 2.5.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 (34) hide show
  1. package/README.md +1 -1
  2. package/dist/agent.js +6 -2
  3. package/dist/context/error.d.ts +15 -0
  4. package/dist/context/error.js +17 -0
  5. package/dist/context/guard.d.ts +8 -0
  6. package/dist/context/guard.js +41 -0
  7. package/dist/context/index.d.ts +2 -0
  8. package/dist/context/index.js +2 -0
  9. package/dist/core/metrics.d.ts +4 -1
  10. package/dist/core/metrics.js +32 -2
  11. package/dist/core/pricing.d.ts +2 -0
  12. package/dist/core/pricing.js +51 -15
  13. package/dist/core/spans.js +27 -2
  14. package/dist/core/tracer.js +2 -0
  15. package/dist/index.d.ts +1 -0
  16. package/dist/index.js +1 -0
  17. package/dist/instrumentations/anthropic.js +8 -2
  18. package/dist/instrumentations/create.js +47 -3
  19. package/dist/instrumentations/types.d.ts +2 -0
  20. package/dist/types/attributes.d.ts +1 -0
  21. package/dist/types/attributes.js +1 -0
  22. package/dist/types/config.d.ts +7 -0
  23. package/dist/types/metrics.d.ts +3 -0
  24. package/dist/types/metrics.js +4 -0
  25. package/dist/types/spans.d.ts +4 -0
  26. package/package.json +1 -1
  27. package/templates/grafana/dashboards/agent-workflow.json +154 -31
  28. package/templates/grafana/dashboards/cost-breakdown.json +168 -40
  29. package/templates/grafana/dashboards/error-drilldown.json +155 -37
  30. package/templates/grafana/dashboards/finops-attribution.json +192 -43
  31. package/templates/grafana/dashboards/latency-analysis.json +103 -24
  32. package/templates/grafana/dashboards/llm-overview.json +268 -66
  33. package/templates/grafana/dashboards/model-comparison.json +119 -26
  34. package/templates/grafana/dashboards/provider-health.json +137 -31
@@ -1,5 +1,7 @@
1
1
  {
2
- "annotations": { "list": [] },
2
+ "annotations": {
3
+ "list": []
4
+ },
3
5
  "editable": true,
4
6
  "fiscalYearStartMonth": 0,
5
7
  "graphTooltip": 1,
@@ -9,11 +11,19 @@
9
11
  {
10
12
  "title": "Total Errors",
11
13
  "type": "stat",
12
- "gridPos": { "h": 4, "w": 8, "x": 0, "y": 0 },
13
- "datasource": { "type": "prometheus", "uid": "prometheus" },
14
+ "gridPos": {
15
+ "h": 4,
16
+ "w": 8,
17
+ "x": 0,
18
+ "y": 0
19
+ },
20
+ "datasource": {
21
+ "type": "prometheus",
22
+ "uid": "prometheus"
23
+ },
14
24
  "targets": [
15
25
  {
16
- "expr": "sum(gen_ai_client_errors_total{gen_ai_provider_name=~\"$provider\", gen_ai_request_model=~\"$model\"})",
26
+ "expr": "sum(gen_ai_client_errors_total{job=~\"$service\", gen_ai_provider_name=~\"$provider\", gen_ai_request_model=~\"$model\"})",
17
27
  "refId": "A"
18
28
  }
19
29
  ],
@@ -22,9 +32,18 @@
22
32
  "unit": "short",
23
33
  "thresholds": {
24
34
  "steps": [
25
- { "color": "green", "value": null },
26
- { "color": "yellow", "value": 10 },
27
- { "color": "red", "value": 100 }
35
+ {
36
+ "color": "green",
37
+ "value": null
38
+ },
39
+ {
40
+ "color": "yellow",
41
+ "value": 10
42
+ },
43
+ {
44
+ "color": "red",
45
+ "value": 100
46
+ }
28
47
  ]
29
48
  }
30
49
  },
@@ -34,11 +53,19 @@
34
53
  {
35
54
  "title": "Error Rate %",
36
55
  "type": "stat",
37
- "gridPos": { "h": 4, "w": 8, "x": 8, "y": 0 },
38
- "datasource": { "type": "prometheus", "uid": "prometheus" },
56
+ "gridPos": {
57
+ "h": 4,
58
+ "w": 8,
59
+ "x": 8,
60
+ "y": 0
61
+ },
62
+ "datasource": {
63
+ "type": "prometheus",
64
+ "uid": "prometheus"
65
+ },
39
66
  "targets": [
40
67
  {
41
- "expr": "sum(gen_ai_client_errors_total{gen_ai_provider_name=~\"$provider\", gen_ai_request_model=~\"$model\"}) / sum(gen_ai_client_requests_total{gen_ai_provider_name=~\"$provider\", gen_ai_request_model=~\"$model\"}) * 100",
68
+ "expr": "sum(gen_ai_client_errors_total{job=~\"$service\", gen_ai_provider_name=~\"$provider\", gen_ai_request_model=~\"$model\"}) / sum(gen_ai_client_requests_total{job=~\"$service\", gen_ai_provider_name=~\"$provider\", gen_ai_request_model=~\"$model\"}) * 100",
42
69
  "refId": "A"
43
70
  }
44
71
  ],
@@ -47,9 +74,18 @@
47
74
  "unit": "percent",
48
75
  "thresholds": {
49
76
  "steps": [
50
- { "color": "green", "value": null },
51
- { "color": "yellow", "value": 5 },
52
- { "color": "red", "value": 20 }
77
+ {
78
+ "color": "green",
79
+ "value": null
80
+ },
81
+ {
82
+ "color": "yellow",
83
+ "value": 5
84
+ },
85
+ {
86
+ "color": "red",
87
+ "value": 20
88
+ }
53
89
  ]
54
90
  }
55
91
  },
@@ -59,11 +95,19 @@
59
95
  {
60
96
  "title": "Errors Last Hour",
61
97
  "type": "stat",
62
- "gridPos": { "h": 4, "w": 8, "x": 16, "y": 0 },
63
- "datasource": { "type": "prometheus", "uid": "prometheus" },
98
+ "gridPos": {
99
+ "h": 4,
100
+ "w": 8,
101
+ "x": 16,
102
+ "y": 0
103
+ },
104
+ "datasource": {
105
+ "type": "prometheus",
106
+ "uid": "prometheus"
107
+ },
64
108
  "targets": [
65
109
  {
66
- "expr": "sum(increase(gen_ai_client_errors_total{gen_ai_provider_name=~\"$provider\", gen_ai_request_model=~\"$model\"}[1h]))",
110
+ "expr": "sum(increase(gen_ai_client_errors_total{job=~\"$service\", gen_ai_provider_name=~\"$provider\", gen_ai_request_model=~\"$model\"}[1h]))",
67
111
  "refId": "A"
68
112
  }
69
113
  ],
@@ -72,9 +116,18 @@
72
116
  "unit": "short",
73
117
  "thresholds": {
74
118
  "steps": [
75
- { "color": "green", "value": null },
76
- { "color": "yellow", "value": 5 },
77
- { "color": "red", "value": 50 }
119
+ {
120
+ "color": "green",
121
+ "value": null
122
+ },
123
+ {
124
+ "color": "yellow",
125
+ "value": 5
126
+ },
127
+ {
128
+ "color": "red",
129
+ "value": 50
130
+ }
78
131
  ]
79
132
  }
80
133
  },
@@ -84,11 +137,19 @@
84
137
  {
85
138
  "title": "Error Rate by Provider",
86
139
  "type": "timeseries",
87
- "gridPos": { "h": 8, "w": 12, "x": 0, "y": 4 },
88
- "datasource": { "type": "prometheus", "uid": "prometheus" },
140
+ "gridPos": {
141
+ "h": 8,
142
+ "w": 12,
143
+ "x": 0,
144
+ "y": 4
145
+ },
146
+ "datasource": {
147
+ "type": "prometheus",
148
+ "uid": "prometheus"
149
+ },
89
150
  "targets": [
90
151
  {
91
- "expr": "sum(rate(gen_ai_client_errors_total{gen_ai_provider_name=~\"$provider\", gen_ai_request_model=~\"$model\"}[1m])) by (gen_ai_provider_name) * 60",
152
+ "expr": "sum(rate(gen_ai_client_errors_total{job=~\"$service\", gen_ai_provider_name=~\"$provider\", gen_ai_request_model=~\"$model\"}[1m])) by (gen_ai_provider_name) * 60",
92
153
  "legendFormat": "{{ gen_ai_provider_name }}",
93
154
  "refId": "A"
94
155
  }
@@ -96,7 +157,11 @@
96
157
  "fieldConfig": {
97
158
  "defaults": {
98
159
  "unit": "reqpm",
99
- "custom": { "drawStyle": "line", "fillOpacity": 15, "lineWidth": 2 }
160
+ "custom": {
161
+ "drawStyle": "line",
162
+ "fillOpacity": 15,
163
+ "lineWidth": 2
164
+ }
100
165
  },
101
166
  "overrides": []
102
167
  }
@@ -104,11 +169,19 @@
104
169
  {
105
170
  "title": "Error Rate by Model",
106
171
  "type": "timeseries",
107
- "gridPos": { "h": 8, "w": 12, "x": 12, "y": 4 },
108
- "datasource": { "type": "prometheus", "uid": "prometheus" },
172
+ "gridPos": {
173
+ "h": 8,
174
+ "w": 12,
175
+ "x": 12,
176
+ "y": 4
177
+ },
178
+ "datasource": {
179
+ "type": "prometheus",
180
+ "uid": "prometheus"
181
+ },
109
182
  "targets": [
110
183
  {
111
- "expr": "sum(rate(gen_ai_client_errors_total{gen_ai_provider_name=~\"$provider\", gen_ai_request_model=~\"$model\"}[1m])) by (gen_ai_request_model) * 60",
184
+ "expr": "sum(rate(gen_ai_client_errors_total{job=~\"$service\", gen_ai_provider_name=~\"$provider\", gen_ai_request_model=~\"$model\"}[1m])) by (gen_ai_request_model) * 60",
112
185
  "legendFormat": "{{ gen_ai_request_model }}",
113
186
  "refId": "A"
114
187
  }
@@ -116,7 +189,11 @@
116
189
  "fieldConfig": {
117
190
  "defaults": {
118
191
  "unit": "reqpm",
119
- "custom": { "drawStyle": "line", "fillOpacity": 15, "lineWidth": 2 }
192
+ "custom": {
193
+ "drawStyle": "line",
194
+ "fillOpacity": 15,
195
+ "lineWidth": 2
196
+ }
120
197
  },
121
198
  "overrides": []
122
199
  }
@@ -124,16 +201,24 @@
124
201
  {
125
202
  "title": "Error vs Success Rate",
126
203
  "type": "timeseries",
127
- "gridPos": { "h": 8, "w": 24, "x": 0, "y": 12 },
128
- "datasource": { "type": "prometheus", "uid": "prometheus" },
204
+ "gridPos": {
205
+ "h": 8,
206
+ "w": 24,
207
+ "x": 0,
208
+ "y": 12
209
+ },
210
+ "datasource": {
211
+ "type": "prometheus",
212
+ "uid": "prometheus"
213
+ },
129
214
  "targets": [
130
215
  {
131
- "expr": "sum(rate(gen_ai_client_errors_total{gen_ai_provider_name=~\"$provider\", gen_ai_request_model=~\"$model\"}[1m])) * 60",
216
+ "expr": "sum(rate(gen_ai_client_errors_total{job=~\"$service\", gen_ai_provider_name=~\"$provider\", gen_ai_request_model=~\"$model\"}[1m])) * 60",
132
217
  "legendFormat": "errors/min",
133
218
  "refId": "A"
134
219
  },
135
220
  {
136
- "expr": "(sum(rate(gen_ai_client_requests_total{gen_ai_provider_name=~\"$provider\", gen_ai_request_model=~\"$model\"}[1m])) - sum(rate(gen_ai_client_errors_total{gen_ai_provider_name=~\"$provider\", gen_ai_request_model=~\"$model\"}[1m]))) * 60",
221
+ "expr": "(sum(rate(gen_ai_client_requests_total{job=~\"$service\", gen_ai_provider_name=~\"$provider\", gen_ai_request_model=~\"$model\"}[1m])) - sum(rate(gen_ai_client_errors_total{job=~\"$service\", gen_ai_provider_name=~\"$provider\", gen_ai_request_model=~\"$model\"}[1m]))) * 60",
137
222
  "legendFormat": "success/min",
138
223
  "refId": "B"
139
224
  }
@@ -145,7 +230,9 @@
145
230
  "drawStyle": "line",
146
231
  "fillOpacity": 15,
147
232
  "lineWidth": 2,
148
- "stacking": { "mode": "normal" }
233
+ "stacking": {
234
+ "mode": "normal"
235
+ }
149
236
  }
150
237
  },
151
238
  "overrides": []
@@ -157,29 +244,60 @@
157
244
  "tags": ["llm", "observability", "toad-eye"],
158
245
  "templating": {
159
246
  "list": [
247
+ {
248
+ "name": "service",
249
+ "type": "query",
250
+ "datasource": {
251
+ "type": "prometheus",
252
+ "uid": "prometheus"
253
+ },
254
+ "query": "label_values(gen_ai_client_requests_total, job)",
255
+ "includeAll": true,
256
+ "allValue": ".*",
257
+ "current": {
258
+ "text": "All",
259
+ "value": "$__all"
260
+ },
261
+ "multi": true
262
+ },
160
263
  {
161
264
  "name": "provider",
162
265
  "type": "query",
163
- "datasource": { "type": "prometheus", "uid": "prometheus" },
266
+ "datasource": {
267
+ "type": "prometheus",
268
+ "uid": "prometheus"
269
+ },
164
270
  "query": "label_values(gen_ai_client_requests_total, gen_ai_provider_name)",
165
271
  "includeAll": true,
166
272
  "allValue": ".*",
167
- "current": { "text": "All", "value": "$__all" },
273
+ "current": {
274
+ "text": "All",
275
+ "value": "$__all"
276
+ },
168
277
  "multi": true
169
278
  },
170
279
  {
171
280
  "name": "model",
172
281
  "type": "query",
173
- "datasource": { "type": "prometheus", "uid": "prometheus" },
282
+ "datasource": {
283
+ "type": "prometheus",
284
+ "uid": "prometheus"
285
+ },
174
286
  "query": "label_values(gen_ai_client_requests_total{gen_ai_provider_name=~\"$provider\"}, gen_ai_request_model)",
175
287
  "includeAll": true,
176
288
  "allValue": ".*",
177
- "current": { "text": "All", "value": "$__all" },
289
+ "current": {
290
+ "text": "All",
291
+ "value": "$__all"
292
+ },
178
293
  "multi": true
179
294
  }
180
295
  ]
181
296
  },
182
- "time": { "from": "now-15m", "to": "now" },
297
+ "time": {
298
+ "from": "now-15m",
299
+ "to": "now"
300
+ },
183
301
  "timepicker": {},
184
302
  "timezone": "browser",
185
303
  "title": "toad-eye: Error Drill-down",