@handsforbots/semantic-event-observability 0.0.0-stage → 0.1.1

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 (55) hide show
  1. package/LICENSE.md +9 -0
  2. package/README.md +141 -2
  3. package/adapters/genericEventBus.js +20 -0
  4. package/adapters/instrumentChannel.js +22 -0
  5. package/core/CorrelationContext.js +49 -0
  6. package/core/EventBuffer.js +37 -0
  7. package/core/MetricsRegistry.js +200 -0
  8. package/core/PhaseTracker.js +143 -0
  9. package/core/Policy.js +87 -0
  10. package/core/SessionTracker.js +23 -0
  11. package/core/TraceContextBridge.js +74 -0
  12. package/core/TraceMapper.js +167 -0
  13. package/core/TurnMetricsCollector.js +19 -0
  14. package/core/TurnModel.js +87 -0
  15. package/core/baggage.d.ts +12 -0
  16. package/core/baggage.js +68 -0
  17. package/core/bucketEventName.js +11 -0
  18. package/core/createObservability.js +611 -0
  19. package/core/definePhaseModel.js +14 -0
  20. package/core/eventInstrumentation.js +21 -0
  21. package/core/isErrorEvent.js +9 -0
  22. package/core/telemetryAttributes.js +44 -0
  23. package/core/turnSpanNaming.js +73 -0
  24. package/docs/architecture.md +106 -0
  25. package/docs/custom-exporter.md +135 -0
  26. package/docs/exporters.md +180 -0
  27. package/docs/getting-started.md +192 -0
  28. package/docs/grafana-validation.md +71 -0
  29. package/docs/handsforbots-adapter.md +64 -0
  30. package/docs/handsforbots-roadmap.md +193 -0
  31. package/docs/metrics-roadmap.md +145 -0
  32. package/docs/publishing.md +55 -0
  33. package/docs/renaming.md +65 -0
  34. package/docs/roadmap.md +467 -0
  35. package/docs/tail-sampling.md +99 -0
  36. package/exporters/console.js +29 -0
  37. package/exporters/devPanel.js +204 -0
  38. package/exporters/faro.js +71 -0
  39. package/exporters/index.js +58 -0
  40. package/exporters/langfuse.js +161 -0
  41. package/exporters/langsmith.js +168 -0
  42. package/exporters/llmExporterState.js +84 -0
  43. package/exporters/memory.js +18 -0
  44. package/exporters/otel.js +236 -0
  45. package/exporters/otelTraceBackend.js +51 -0
  46. package/exporters/webVitals.js +73 -0
  47. package/grafana/semantic-event-observability.json +250 -0
  48. package/grafana/semantic-event-observability.lgtm.json +399 -0
  49. package/index.d.ts +312 -0
  50. package/index.js +31 -0
  51. package/package.json +83 -3
  52. package/packageIdentity.js +41 -0
  53. package/utils/id.js +10 -0
  54. package/utils/probeOptional.js +42 -0
  55. package/utils/safeJson.js +74 -0
@@ -0,0 +1,250 @@
1
+ {
2
+ "__inputs": [
3
+ {
4
+ "name": "DS_LOKI",
5
+ "label": "Loki",
6
+ "description": "Loki data source (Faro / structured logs)",
7
+ "type": "datasource",
8
+ "pluginId": "loki",
9
+ "pluginName": "Loki"
10
+ },
11
+ {
12
+ "name": "DS_TEMPO",
13
+ "label": "Tempo",
14
+ "description": "Tempo data source (OpenTelemetry traces)",
15
+ "type": "datasource",
16
+ "pluginId": "tempo",
17
+ "pluginName": "Tempo"
18
+ },
19
+ {
20
+ "name": "DS_PROM",
21
+ "label": "Prometheus",
22
+ "description": "Prometheus/Mimir metrics data source",
23
+ "type": "datasource",
24
+ "pluginId": "prometheus",
25
+ "pluginName": "Prometheus"
26
+ }
27
+ ],
28
+ "annotations": {
29
+ "list": [
30
+ {
31
+ "builtIn": 1,
32
+ "datasource": { "type": "grafana", "uid": "-- Grafana --" },
33
+ "enable": true,
34
+ "hide": true,
35
+ "iconColor": "rgba(0, 211, 255, 1)",
36
+ "name": "Annotations & Alerts",
37
+ "type": "dashboard"
38
+ }
39
+ ]
40
+ },
41
+ "editable": true,
42
+ "fiscalYearStartMonth": 0,
43
+ "graphTooltip": 1,
44
+ "id": null,
45
+ "links": [],
46
+ "liveNow": false,
47
+ "panels": [
48
+ {
49
+ "datasource": { "type": "loki", "uid": "${DS_LOKI}" },
50
+ "fieldConfig": { "defaults": {}, "overrides": [] },
51
+ "gridPos": { "h": 8, "w": 12, "x": 0, "y": 0 },
52
+ "id": 1,
53
+ "options": {
54
+ "dedupStrategy": "none",
55
+ "enableLogDetails": true,
56
+ "prettifyLogMessage": true,
57
+ "showCommonLabels": false,
58
+ "showLabels": false,
59
+ "showTime": true,
60
+ "sortOrder": "Descending",
61
+ "wrapLogMessage": true
62
+ },
63
+ "targets": [
64
+ {
65
+ "datasource": { "type": "loki", "uid": "${DS_LOKI}" },
66
+ "editorMode": "code",
67
+ "expr": "{service_name=\"semantic-event-observability\"} |= \"semantic_event\" | json | line_format \"{{.type}} {{.name}} turn={{.turnId}} queue={{.queueDepth}}\"",
68
+ "queryType": "range",
69
+ "refId": "A"
70
+ }
71
+ ],
72
+ "title": "Semantic events (Faro / Loki)",
73
+ "type": "logs"
74
+ },
75
+ {
76
+ "datasource": { "type": "loki", "uid": "${DS_LOKI}" },
77
+ "fieldConfig": { "defaults": {}, "overrides": [] },
78
+ "gridPos": { "h": 8, "w": 12, "x": 12, "y": 0 },
79
+ "id": 2,
80
+ "options": {
81
+ "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true },
82
+ "tooltip": { "mode": "single", "sort": "none" }
83
+ },
84
+ "targets": [
85
+ {
86
+ "datasource": { "type": "loki", "uid": "${DS_LOKI}" },
87
+ "editorMode": "code",
88
+ "expr": "sum by (name) (count_over_time({service_name=\"semantic-event-observability\"} |= \"semantic_event\" | json [5m]))",
89
+ "legendFormat": "{{name}}",
90
+ "queryType": "range",
91
+ "refId": "A"
92
+ }
93
+ ],
94
+ "title": "Event rate by name",
95
+ "type": "timeseries"
96
+ },
97
+ {
98
+ "datasource": { "type": "tempo", "uid": "${DS_TEMPO}" },
99
+ "fieldConfig": { "defaults": {}, "overrides": [] },
100
+ "gridPos": { "h": 8, "w": 12, "x": 0, "y": 8 },
101
+ "id": 3,
102
+ "targets": [
103
+ {
104
+ "datasource": { "type": "tempo", "uid": "${DS_TEMPO}" },
105
+ "query": "{ resource.service.name=\"semantic-event-observability\" && name=~\"turn:.*\" }",
106
+ "queryType": "traceql",
107
+ "refId": "A"
108
+ }
109
+ ],
110
+ "title": "Conversation turns (Tempo)",
111
+ "type": "traces"
112
+ },
113
+ {
114
+ "datasource": { "type": "prometheus", "uid": "${DS_PROM}" },
115
+ "fieldConfig": {
116
+ "defaults": {
117
+ "color": { "mode": "palette-classic" },
118
+ "unit": "ms"
119
+ },
120
+ "overrides": []
121
+ },
122
+ "gridPos": { "h": 8, "w": 12, "x": 12, "y": 8 },
123
+ "id": 4,
124
+ "targets": [
125
+ {
126
+ "datasource": { "type": "prometheus", "uid": "${DS_PROM}" },
127
+ "expr": "histogram_quantile(0.95, sum(rate(sevo_turn_duration_ms_bucket[5m])) by (le))",
128
+ "legendFormat": "p95 turn duration",
129
+ "refId": "A"
130
+ }
131
+ ],
132
+ "title": "Turn duration p95",
133
+ "type": "timeseries"
134
+ },
135
+ {
136
+ "datasource": { "type": "prometheus", "uid": "${DS_PROM}" },
137
+ "fieldConfig": { "defaults": {}, "overrides": [] },
138
+ "gridPos": { "h": 8, "w": 12, "x": 0, "y": 16 },
139
+ "id": 5,
140
+ "targets": [
141
+ {
142
+ "datasource": { "type": "prometheus", "uid": "${DS_PROM}" },
143
+ "expr": "avg(sevo_state_gauge{key=\"queueDepth\"})",
144
+ "legendFormat": "queue depth",
145
+ "refId": "A"
146
+ }
147
+ ],
148
+ "title": "Backend queue depth",
149
+ "type": "timeseries"
150
+ },
151
+ {
152
+ "datasource": { "type": "prometheus", "uid": "${DS_PROM}" },
153
+ "fieldConfig": { "defaults": {}, "overrides": [] },
154
+ "gridPos": { "h": 8, "w": 12, "x": 12, "y": 16 },
155
+ "id": 6,
156
+ "targets": [
157
+ {
158
+ "datasource": { "type": "prometheus", "uid": "${DS_PROM}" },
159
+ "expr": "sum(increase(sevo_events_dropped_total[5m])) by (reason)",
160
+ "legendFormat": "{{reason}}",
161
+ "refId": "A"
162
+ }
163
+ ],
164
+ "title": "Dropped telemetry (sampling / rate limit)",
165
+ "type": "timeseries"
166
+ },
167
+ {
168
+ "datasource": { "type": "prometheus", "uid": "${DS_PROM}" },
169
+ "fieldConfig": {
170
+ "defaults": { "unit": "ms" },
171
+ "overrides": []
172
+ },
173
+ "gridPos": { "h": 8, "w": 12, "x": 0, "y": 24 },
174
+ "id": 7,
175
+ "targets": [
176
+ {
177
+ "datasource": { "type": "prometheus", "uid": "${DS_PROM}" },
178
+ "expr": "histogram_quantile(0.95, sum(rate(sevo_phase_duration_ms_bucket[5m])) by (le, phase))",
179
+ "legendFormat": "p95 {{phase}}",
180
+ "refId": "A"
181
+ }
182
+ ],
183
+ "title": "Phase duration p95",
184
+ "type": "timeseries"
185
+ },
186
+ {
187
+ "datasource": { "type": "prometheus", "uid": "${DS_PROM}" },
188
+ "fieldConfig": {
189
+ "defaults": { "unit": "ms" },
190
+ "overrides": []
191
+ },
192
+ "gridPos": { "h": 8, "w": 12, "x": 12, "y": 24 },
193
+ "id": 8,
194
+ "targets": [
195
+ {
196
+ "datasource": { "type": "prometheus", "uid": "${DS_PROM}" },
197
+ "expr": "histogram_quantile(0.95, sum(rate(sevo_phase_wait_ms_bucket[5m])) by (le, phase))",
198
+ "legendFormat": "p95 wait {{phase}}",
199
+ "refId": "A"
200
+ }
201
+ ],
202
+ "title": "Phase wait p95 (turn start → phase start)",
203
+ "type": "timeseries"
204
+ },
205
+ {
206
+ "datasource": { "type": "prometheus", "uid": "${DS_PROM}" },
207
+ "fieldConfig": { "defaults": {}, "overrides": [] },
208
+ "gridPos": { "h": 8, "w": 12, "x": 0, "y": 32 },
209
+ "id": 9,
210
+ "targets": [
211
+ {
212
+ "datasource": { "type": "prometheus", "uid": "${DS_PROM}" },
213
+ "expr": "sum(rate(sevo_turns_total[5m])) by (status)",
214
+ "legendFormat": "{{status}}",
215
+ "refId": "A"
216
+ }
217
+ ],
218
+ "title": "Turn outcomes rate",
219
+ "type": "timeseries"
220
+ },
221
+ {
222
+ "datasource": { "type": "prometheus", "uid": "${DS_PROM}" },
223
+ "fieldConfig": { "defaults": {}, "overrides": [] },
224
+ "gridPos": { "h": 8, "w": 12, "x": 12, "y": 32 },
225
+ "id": 10,
226
+ "targets": [
227
+ {
228
+ "datasource": { "type": "prometheus", "uid": "${DS_PROM}" },
229
+ "expr": "topk(10, sum(rate(sevo_bus_events_total[5m])) by (event))",
230
+ "legendFormat": "{{event}}",
231
+ "refId": "A"
232
+ }
233
+ ],
234
+ "title": "Bus event rate (top 10)",
235
+ "type": "timeseries"
236
+ }
237
+ ],
238
+ "refresh": "30s",
239
+ "schemaVersion": 39,
240
+ "style": "dark",
241
+ "tags": ["semantic-event-observability", "async-events", "handsforbots"],
242
+ "templating": { "list": [] },
243
+ "time": { "from": "now-6h", "to": "now" },
244
+ "timepicker": {},
245
+ "timezone": "browser",
246
+ "title": "Semantic Event Observability",
247
+ "uid": "semantic-event-observability",
248
+ "version": 1,
249
+ "weekStart": ""
250
+ }
@@ -0,0 +1,399 @@
1
+ {
2
+ "annotations": {
3
+ "list": [
4
+ {
5
+ "builtIn": 1,
6
+ "datasource": { "type": "grafana", "uid": "-- Grafana --" },
7
+ "enable": true,
8
+ "hide": true,
9
+ "iconColor": "rgba(0, 211, 255, 1)",
10
+ "name": "Annotations & Alerts",
11
+ "type": "dashboard"
12
+ }
13
+ ]
14
+ },
15
+ "editable": true,
16
+ "fiscalYearStartMonth": 0,
17
+ "graphTooltip": 1,
18
+ "id": null,
19
+ "links": [],
20
+ "liveNow": false,
21
+ "panels": [
22
+ {
23
+ "datasource": { "type": "grafana", "uid": "-- Grafana --" },
24
+ "gridPos": { "h": 3, "w": 24, "x": 0, "y": 0 },
25
+ "id": 9,
26
+ "options": {
27
+ "code": { "language": "plaintext", "showLineNumbers": false, "showMiniMap": false },
28
+ "content": "Use the chat at **http://localhost**, then **click any cell in Recent turns** to load the trace below. Expand the row in **Turn waterfall** to see spans. For the classic Gantt waterfall, use **Waterfall in Explore** on the trace ID. You can also paste a trace ID in **Turn trace** (top bar) and press **Enter**.",
29
+ "mode": "markdown"
30
+ },
31
+ "title": "Semantic Event Observability",
32
+ "type": "text"
33
+ },
34
+ {
35
+ "datasource": { "type": "tempo", "uid": "tempo" },
36
+ "fieldConfig": {
37
+ "defaults": {
38
+ "custom": { "align": "auto", "cellOptions": { "type": "auto" }, "inspect": false },
39
+ "links": [
40
+ {
41
+ "targetBlank": true,
42
+ "title": "Waterfall in Explore",
43
+ "url": "/explore?schemaVersion=1&panes=%7B%22trace%22%3A%7B%22datasource%22%3A%22tempo%22%2C%22queries%22%3A%5B%7B%22refId%22%3A%22A%22%2C%22queryType%22%3A%22traceId%22%2C%22query%22%3A%22${__data.fields.traceID}%22%7D%5D%2C%22range%22%3A%7B%22from%22%3A%22now-1h%22%2C%22to%22%3A%22now%22%7D%7D%7D&orgId=1"
44
+ },
45
+ {
46
+ "targetBlank": false,
47
+ "title": "Show below",
48
+ "url": "/d/semantic-event-observability/semantic-event-observability?${__url_time_range}&var-traceId=${__data.fields.traceID}"
49
+ }
50
+ ],
51
+ "mappings": [],
52
+ "thresholds": { "mode": "absolute", "steps": [{ "color": "green", "value": null }] }
53
+ },
54
+ "overrides": [
55
+ {
56
+ "matcher": { "id": "byName", "options": "traceDuration" },
57
+ "properties": [{ "id": "unit", "value": "ms" }]
58
+ },
59
+ {
60
+ "matcher": { "id": "byName", "options": "traceID" },
61
+ "properties": [
62
+ {
63
+ "id": "custom.cellOptions",
64
+ "value": { "type": "color-text", "mode": "link" }
65
+ }
66
+ ]
67
+ }
68
+ ]
69
+ },
70
+ "gridPos": { "h": 8, "w": 24, "x": 0, "y": 3 },
71
+ "id": 11,
72
+ "options": {
73
+ "cellHeight": "md",
74
+ "footer": { "show": false },
75
+ "showHeader": true,
76
+ "sortBy": [{ "desc": true, "displayName": "startTime" }]
77
+ },
78
+ "pluginVersion": "13.0.1",
79
+ "targets": [
80
+ {
81
+ "datasource": { "type": "tempo", "uid": "tempo" },
82
+ "filters": [
83
+ {
84
+ "id": "service-name",
85
+ "operator": "=",
86
+ "scope": "resource",
87
+ "tag": "service.name",
88
+ "value": "semantic-event-observability",
89
+ "valueType": "string"
90
+ },
91
+ {
92
+ "id": "turn-name",
93
+ "operator": "=~",
94
+ "scope": "span",
95
+ "tag": "name",
96
+ "value": "turn:.*",
97
+ "valueType": "string"
98
+ }
99
+ ],
100
+ "limit": 30,
101
+ "queryType": "traceqlSearch",
102
+ "refId": "A",
103
+ "tableType": "traces"
104
+ }
105
+ ],
106
+ "title": "Recent turns",
107
+ "transformations": [
108
+ {
109
+ "id": "organize",
110
+ "options": {
111
+ "excludeByName": { "nested": true },
112
+ "renameByName": {
113
+ "traceDuration": "Total ms",
114
+ "traceName": "Turn",
115
+ "traceService": "Service"
116
+ }
117
+ }
118
+ }
119
+ ],
120
+ "type": "table"
121
+ },
122
+ {
123
+ "datasource": { "type": "tempo", "uid": "tempo" },
124
+ "fieldConfig": {
125
+ "defaults": {
126
+ "custom": { "align": "auto", "cellOptions": { "type": "auto" }, "inspect": false }
127
+ },
128
+ "overrides": []
129
+ },
130
+ "gridPos": { "h": 12, "w": 24, "x": 0, "y": 11 },
131
+ "id": 12,
132
+ "options": {
133
+ "cellHeight": "sm",
134
+ "footer": { "show": false },
135
+ "showHeader": true
136
+ },
137
+ "pluginVersion": "13.0.1",
138
+ "targets": [
139
+ {
140
+ "datasource": { "type": "tempo", "uid": "tempo" },
141
+ "query": "{ trace:id = \"${traceId}\" }",
142
+ "queryType": "traceql",
143
+ "refId": "A",
144
+ "tableType": "traces"
145
+ }
146
+ ],
147
+ "description": "Empty until you click a row in Recent turns or paste a trace ID above. Expand a row to see spans. For the classic waterfall view, click the trace ID link to open Explore.",
148
+ "title": "Turn waterfall",
149
+ "type": "table"
150
+ },
151
+ {
152
+ "datasource": { "type": "loki", "uid": "loki" },
153
+ "fieldConfig": { "defaults": {}, "overrides": [] },
154
+ "gridPos": { "h": 10, "w": 24, "x": 0, "y": 23 },
155
+ "id": 13,
156
+ "options": {
157
+ "dedupStrategy": "none",
158
+ "enableLogDetails": true,
159
+ "prettifyLogMessage": true,
160
+ "showCommonLabels": false,
161
+ "showLabels": false,
162
+ "showTime": true,
163
+ "sortOrder": "Ascending",
164
+ "wrapLogMessage": true
165
+ },
166
+ "targets": [
167
+ {
168
+ "datasource": { "type": "loki", "uid": "loki" },
169
+ "editorMode": "code",
170
+ "expr": "{service_name=\"semantic-event-observability\"} |= \"semantic_event\" | logfmt | line_format \"{{.event_data_name}} queue={{.event_data_queueDepth}} backend={{.event_data_callingBackend}}\"",
171
+ "queryType": "range",
172
+ "refId": "A"
173
+ }
174
+ ],
175
+ "title": "Event sequence (Faro / Loki)",
176
+ "type": "logs"
177
+ },
178
+ {
179
+ "datasource": { "type": "grafana", "uid": "-- Grafana --" },
180
+ "gridPos": { "h": 2, "w": 24, "x": 0, "y": 33 },
181
+ "id": 20,
182
+ "options": {
183
+ "code": { "language": "plaintext", "showLineNumbers": false, "showMiniMap": false },
184
+ "content": "### Volume & raw logs",
185
+ "mode": "markdown"
186
+ },
187
+ "title": "",
188
+ "type": "text"
189
+ },
190
+ {
191
+ "datasource": { "type": "loki", "uid": "loki" },
192
+ "fieldConfig": { "defaults": {}, "overrides": [] },
193
+ "gridPos": { "h": 8, "w": 12, "x": 0, "y": 35 },
194
+ "id": 5,
195
+ "options": {
196
+ "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true },
197
+ "tooltip": { "mode": "single", "sort": "none" }
198
+ },
199
+ "targets": [
200
+ {
201
+ "datasource": { "type": "loki", "uid": "loki" },
202
+ "editorMode": "code",
203
+ "expr": "sum(count_over_time({service_name=\"semantic-event-observability\"} |= \"semantic_event\" [5m]))",
204
+ "legendFormat": "events / 5m",
205
+ "queryType": "range",
206
+ "refId": "A"
207
+ }
208
+ ],
209
+ "title": "Event volume",
210
+ "type": "timeseries"
211
+ },
212
+ {
213
+ "datasource": { "type": "loki", "uid": "loki" },
214
+ "fieldConfig": { "defaults": {}, "overrides": [] },
215
+ "gridPos": { "h": 8, "w": 12, "x": 12, "y": 35 },
216
+ "id": 7,
217
+ "options": {
218
+ "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true },
219
+ "tooltip": { "mode": "single", "sort": "none" }
220
+ },
221
+ "targets": [
222
+ {
223
+ "datasource": { "type": "loki", "uid": "loki" },
224
+ "editorMode": "code",
225
+ "expr": "sum(count_over_time({service_name=\"semantic-event-observability\"} |= \"core.backend_responded\" [5m]))",
226
+ "legendFormat": "backend responses / 5m",
227
+ "queryType": "range",
228
+ "refId": "A"
229
+ }
230
+ ],
231
+ "title": "Backend response rate",
232
+ "type": "timeseries"
233
+ },
234
+ {
235
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
236
+ "fieldConfig": { "defaults": { "unit": "ms" }, "overrides": [] },
237
+ "gridPos": { "h": 8, "w": 12, "x": 0, "y": 43 },
238
+ "id": 11,
239
+ "targets": [
240
+ {
241
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
242
+ "expr": "histogram_quantile(0.95, sum(rate(sevo_turn_duration_ms_bucket[5m])) by (le))",
243
+ "legendFormat": "p95 turn",
244
+ "refId": "A"
245
+ }
246
+ ],
247
+ "title": "Turn duration p95",
248
+ "type": "timeseries"
249
+ },
250
+ {
251
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
252
+ "fieldConfig": { "defaults": { "unit": "ms" }, "overrides": [] },
253
+ "gridPos": { "h": 8, "w": 12, "x": 12, "y": 43 },
254
+ "id": 12,
255
+ "targets": [
256
+ {
257
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
258
+ "expr": "histogram_quantile(0.95, sum(rate(sevo_phase_duration_ms_bucket[5m])) by (le, phase))",
259
+ "legendFormat": "p95 {{phase}}",
260
+ "refId": "A"
261
+ }
262
+ ],
263
+ "title": "Phase duration p95",
264
+ "type": "timeseries"
265
+ },
266
+ {
267
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
268
+ "fieldConfig": { "defaults": { "unit": "ms" }, "overrides": [] },
269
+ "gridPos": { "h": 8, "w": 12, "x": 0, "y": 51 },
270
+ "id": 13,
271
+ "targets": [
272
+ {
273
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
274
+ "expr": "histogram_quantile(0.95, sum(rate(sevo_phase_wait_ms_bucket[5m])) by (le, phase))",
275
+ "legendFormat": "p95 wait {{phase}}",
276
+ "refId": "A"
277
+ }
278
+ ],
279
+ "title": "Phase wait p95",
280
+ "type": "timeseries"
281
+ },
282
+ {
283
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
284
+ "fieldConfig": { "defaults": {}, "overrides": [] },
285
+ "gridPos": { "h": 8, "w": 12, "x": 12, "y": 51 },
286
+ "id": 14,
287
+ "targets": [
288
+ {
289
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
290
+ "expr": "avg(sevo_state_gauge{key=\"queueDepth\"})",
291
+ "legendFormat": "queue depth",
292
+ "refId": "A"
293
+ }
294
+ ],
295
+ "title": "Backend queue depth",
296
+ "type": "timeseries"
297
+ },
298
+ {
299
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
300
+ "fieldConfig": { "defaults": {}, "overrides": [] },
301
+ "gridPos": { "h": 8, "w": 12, "x": 0, "y": 59 },
302
+ "id": 15,
303
+ "targets": [
304
+ {
305
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
306
+ "expr": "sum(rate(sevo_turns_total[5m])) by (status)",
307
+ "legendFormat": "{{status}}",
308
+ "refId": "A"
309
+ }
310
+ ],
311
+ "title": "Turn outcomes rate",
312
+ "type": "timeseries"
313
+ },
314
+ {
315
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
316
+ "fieldConfig": { "defaults": {}, "overrides": [] },
317
+ "gridPos": { "h": 8, "w": 12, "x": 12, "y": 59 },
318
+ "id": 16,
319
+ "targets": [
320
+ {
321
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
322
+ "expr": "sum(increase(sevo_events_dropped_total[5m])) by (reason)",
323
+ "legendFormat": "{{reason}}",
324
+ "refId": "A"
325
+ }
326
+ ],
327
+ "title": "Dropped telemetry",
328
+ "type": "timeseries"
329
+ },
330
+ {
331
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
332
+ "fieldConfig": { "defaults": {}, "overrides": [] },
333
+ "gridPos": { "h": 8, "w": 24, "x": 0, "y": 67 },
334
+ "id": 17,
335
+ "targets": [
336
+ {
337
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
338
+ "expr": "topk(10, sum(rate(sevo_bus_events_total[5m])) by (event))",
339
+ "legendFormat": "{{event}}",
340
+ "refId": "A"
341
+ }
342
+ ],
343
+ "title": "Bus event rate (top 10)",
344
+ "type": "timeseries"
345
+ },
346
+ {
347
+ "datasource": { "type": "loki", "uid": "loki" },
348
+ "fieldConfig": { "defaults": {}, "overrides": [] },
349
+ "gridPos": { "h": 10, "w": 24, "x": 0, "y": 75 },
350
+ "id": 4,
351
+ "options": {
352
+ "dedupStrategy": "none",
353
+ "enableLogDetails": true,
354
+ "prettifyLogMessage": true,
355
+ "showCommonLabels": false,
356
+ "showLabels": false,
357
+ "showTime": true,
358
+ "sortOrder": "Descending",
359
+ "wrapLogMessage": true
360
+ },
361
+ "targets": [
362
+ {
363
+ "datasource": { "type": "loki", "uid": "loki" },
364
+ "editorMode": "code",
365
+ "expr": "{service_name=\"semantic-event-observability\"} |= \"semantic_event\"",
366
+ "queryType": "range",
367
+ "refId": "A"
368
+ }
369
+ ],
370
+ "title": "Raw semantic events (Loki)",
371
+ "type": "logs"
372
+ }
373
+ ],
374
+ "refresh": "30s",
375
+ "schemaVersion": 39,
376
+ "style": "dark",
377
+ "tags": ["semantic-event-observability", "async-events", "handsforbots"],
378
+ "templating": {
379
+ "list": [
380
+ {
381
+ "current": { "selected": false, "text": "", "value": "" },
382
+ "hide": 0,
383
+ "label": "Turn trace",
384
+ "name": "traceId",
385
+ "options": [],
386
+ "query": "",
387
+ "skipUrlSync": false,
388
+ "type": "textbox"
389
+ }
390
+ ]
391
+ },
392
+ "time": { "from": "now-1h", "to": "now" },
393
+ "timepicker": {},
394
+ "timezone": "browser",
395
+ "title": "Semantic Event Observability",
396
+ "uid": "semantic-event-observability",
397
+ "version": 12,
398
+ "weekStart": ""
399
+ }