@devilsdev/rag-pipeline-utils 2.1.12 → 2.2.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 (113) hide show
  1. package/.ragrc.schema.json +218 -0
  2. package/README.md +178 -550
  3. package/bin/cli.js +8 -14
  4. package/contracts/reranker-contract.json +69 -0
  5. package/dist/index.d.ts +237 -0
  6. package/dist/index.mjs +22 -7
  7. package/package.json +18 -13
  8. package/src/ai/adaptive-retrieval.js +191 -0
  9. package/src/ai/federated-learning.js +214 -0
  10. package/src/ai/federation/federated-learning-coordinator.js +345 -0
  11. package/src/ai/federation.js +76 -0
  12. package/src/ai/index-fixed.js +509 -0
  13. package/src/ai/index.js +33 -0
  14. package/src/ai/model-trainer.js +217 -0
  15. package/src/ai/model-training.js +205 -0
  16. package/src/ai/module-template.js +37 -0
  17. package/src/ai/multimodal/multi-modal-processor.js +345 -0
  18. package/src/ai/multimodal-processing.js +268 -0
  19. package/src/ai/multimodal.js +71 -0
  20. package/src/ai/orchestrator.js +70 -0
  21. package/src/ai/retrieval/adaptive-retrieval-engine.js +398 -0
  22. package/src/ai/retrieval-engine.js +69 -0
  23. package/src/ai/training/model-training-orchestrator.js +228 -0
  24. package/src/ci/workflow-analyzer.js +71 -0
  25. package/src/cli/commands/ai-ml.js +967 -0
  26. package/src/cli/commands/docs.js +228 -0
  27. package/src/cli/commands/dx.js +538 -0
  28. package/src/cli/commands/plugin-hub.js +875 -0
  29. package/src/cli/doctor-command.js +639 -0
  30. package/src/cli/enhanced-cli-commands.js +945 -0
  31. package/src/cli/interactive-wizard.js +997 -0
  32. package/src/cli/plugin-marketplace-commands.js +869 -0
  33. package/src/cli.js +17 -0
  34. package/src/config/enhanced-ragrc-schema.js +632 -0
  35. package/src/config/load-config.js +54 -0
  36. package/src/config/load-plugin-config.js +69 -0
  37. package/src/config/normalize-config.js +105 -0
  38. package/src/config/schema-validator.js +315 -0
  39. package/src/config/validate-plugin-schema.js +35 -0
  40. package/src/config/validate-schema.js +113 -0
  41. package/src/contracts/plugin-contracts.js +33 -0
  42. package/src/core/create-pipeline.js +99 -0
  43. package/src/core/dependency-injection.js +242 -0
  44. package/src/core/observability/event-logger.js +241 -0
  45. package/src/core/observability/instrumented-pipeline.js +609 -0
  46. package/src/core/observability/metrics.js +497 -0
  47. package/src/core/observability/tracing.js +781 -0
  48. package/src/core/performance/benchmark.js +516 -0
  49. package/src/core/performance/parallel-processor.js +240 -0
  50. package/src/core/performance/streaming-safeguards.js +620 -0
  51. package/src/core/pipeline-factory.js +60 -0
  52. package/src/core/plugin-contracts.js +89 -0
  53. package/src/core/plugin-marketplace/plugin-metadata.js +485 -0
  54. package/src/core/plugin-marketplace/plugin-publisher.js +574 -0
  55. package/src/core/plugin-marketplace/plugin-registry-format.js +419 -0
  56. package/src/core/plugin-marketplace/version-resolver.js +61 -0
  57. package/src/core/plugin-registry.js +294 -0
  58. package/src/dag/dag-engine.js +954 -0
  59. package/src/dag/dag-node.js +76 -0
  60. package/src/dag/enhanced-dag-engine.js +822 -0
  61. package/src/dx/index.js +40 -0
  62. package/src/dx/integration-templates.js +665 -0
  63. package/src/dx/performance-profiler.js +968 -0
  64. package/src/dx/realtime-debugger.js +755 -0
  65. package/src/dx/visual-pipeline-builder.js +578 -0
  66. package/src/ecosystem/plugin-analytics-dashboard.js +778 -0
  67. package/src/ecosystem/plugin-certification.js +580 -0
  68. package/src/ecosystem/plugin-hub.js +821 -0
  69. package/src/enterprise/audit-logging.js +967 -0
  70. package/src/enterprise/data-governance.js +408 -0
  71. package/src/enterprise/multi-tenancy.js +496 -0
  72. package/src/enterprise/sso-integration.js +1030 -0
  73. package/src/evaluate/evaluator.js +52 -0
  74. package/src/evaluate/scoring.js +91 -0
  75. package/src/index.js +67 -0
  76. package/src/ingest.js +59 -0
  77. package/src/loader/csv-loader.js +38 -0
  78. package/src/loader/directory-loader.js +48 -0
  79. package/src/loader/html-loader.js +62 -0
  80. package/src/loader/markdown-loader.js +67 -0
  81. package/src/mocks/openai-embedder.js +119 -0
  82. package/src/mocks/openai-llm.js +77 -0
  83. package/src/mocks/pdf-loader.js +21 -0
  84. package/src/mocks/pinecone-retriever.js +106 -0
  85. package/src/observability/audit-logger.js +758 -0
  86. package/src/observability/dashboard-config.json +675 -0
  87. package/src/observability/event-logger.js +310 -0
  88. package/src/observability/metrics.js +691 -0
  89. package/src/observability/security-monitor.js +830 -0
  90. package/src/observability/slo-monitor.js +319 -0
  91. package/src/observability/telemetry.js +686 -0
  92. package/src/pipeline/pipeline.js +18 -0
  93. package/src/plugins/sample-embedder.js +53 -0
  94. package/src/plugins/sample-llm.js +30 -0
  95. package/src/plugins/sample-loader.js +24 -0
  96. package/src/plugins/sample-retriever.js +84 -0
  97. package/src/query.js +117 -0
  98. package/src/reranker/llm-reranker.js +111 -0
  99. package/src/scripts/script-utilities.js +36 -0
  100. package/src/security/plugin-sandbox.js +586 -0
  101. package/src/security/plugin-signature-verifier.js +414 -0
  102. package/src/security/validator.js +36 -0
  103. package/src/utils/ci/diagnostic-reporter.js +57 -0
  104. package/src/utils/logger.js +211 -0
  105. package/src/utils/performance-monitor.js +561 -0
  106. package/src/utils/plugin-scaffolder.js +447 -0
  107. package/src/utils/rate-limiter.js +244 -0
  108. package/src/utils/retry-policy.js +443 -0
  109. package/src/utils/retry.js +107 -0
  110. package/src/utils/safe-expression-evaluator.js +579 -0
  111. package/src/utils/secure-logging.js +338 -0
  112. package/src/utils/structured-logger.js +388 -0
  113. package/src/utils/validate-plugin-contract.js +42 -0
@@ -0,0 +1,675 @@
1
+ {
2
+ "dashboards": [
3
+ {
4
+ "id": "rag_pipeline_overview",
5
+ "title": "RAG Pipeline Overview",
6
+ "description": "High-level metrics and health status for the RAG pipeline system",
7
+ "category": "overview",
8
+ "tags": ["rag", "pipeline", "overview"],
9
+ "refresh": "30s",
10
+ "panels": [
11
+ {
12
+ "id": "system_health",
13
+ "title": "System Health Status",
14
+ "type": "stat",
15
+ "gridPos": { "x": 0, "y": 0, "w": 6, "h": 4 },
16
+ "targets": [
17
+ {
18
+ "expr": "up{job=\"rag-pipeline\"}",
19
+ "legendFormat": "Service Status"
20
+ }
21
+ ],
22
+ "fieldConfig": {
23
+ "defaults": {
24
+ "color": { "mode": "thresholds" },
25
+ "thresholds": {
26
+ "steps": [
27
+ { "color": "red", "value": 0 },
28
+ { "color": "green", "value": 1 }
29
+ ]
30
+ },
31
+ "mappings": [
32
+ {
33
+ "options": { "0": { "text": "Down" }, "1": { "text": "Up" } }
34
+ }
35
+ ]
36
+ }
37
+ }
38
+ },
39
+ {
40
+ "id": "request_rate",
41
+ "title": "Request Rate",
42
+ "type": "graph",
43
+ "gridPos": { "x": 6, "y": 0, "w": 12, "h": 8 },
44
+ "targets": [
45
+ {
46
+ "expr": "rate(rag_requests_total[5m])",
47
+ "legendFormat": "Requests/sec"
48
+ }
49
+ ],
50
+ "yAxes": [{ "label": "requests/sec", "min": 0 }]
51
+ },
52
+ {
53
+ "id": "error_rate",
54
+ "title": "Error Rate",
55
+ "type": "graph",
56
+ "gridPos": { "x": 18, "y": 0, "w": 6, "h": 8 },
57
+ "targets": [
58
+ {
59
+ "expr": "rate(rag_errors_total[5m]) / rate(rag_requests_total[5m]) * 100",
60
+ "legendFormat": "Error %"
61
+ }
62
+ ],
63
+ "yAxes": [{ "label": "percentage", "min": 0, "max": 100 }],
64
+ "alert": {
65
+ "conditions": [
66
+ {
67
+ "query": { "params": ["A", "5m", "now"] },
68
+ "reducer": { "type": "avg" },
69
+ "evaluator": { "params": [5], "type": "gt" }
70
+ }
71
+ ],
72
+ "executionErrorState": "alerting",
73
+ "for": "5m",
74
+ "frequency": "10s",
75
+ "handler": 1,
76
+ "name": "High Error Rate",
77
+ "noDataState": "no_data",
78
+ "notifications": []
79
+ }
80
+ },
81
+ {
82
+ "id": "response_time",
83
+ "title": "Response Time Distribution",
84
+ "type": "heatmap",
85
+ "gridPos": { "x": 0, "y": 8, "w": 24, "h": 8 },
86
+ "targets": [
87
+ {
88
+ "expr": "histogram_quantile(0.50, rate(rag_request_duration_bucket[5m]))",
89
+ "legendFormat": "50th percentile"
90
+ },
91
+ {
92
+ "expr": "histogram_quantile(0.95, rate(rag_request_duration_bucket[5m]))",
93
+ "legendFormat": "95th percentile"
94
+ },
95
+ {
96
+ "expr": "histogram_quantile(0.99, rate(rag_request_duration_bucket[5m]))",
97
+ "legendFormat": "99th percentile"
98
+ }
99
+ ]
100
+ }
101
+ ]
102
+ },
103
+ {
104
+ "id": "dag_performance",
105
+ "title": "DAG Engine Performance",
106
+ "description": "Detailed metrics for DAG execution and node performance",
107
+ "category": "performance",
108
+ "tags": ["dag", "performance", "execution"],
109
+ "refresh": "15s",
110
+ "panels": [
111
+ {
112
+ "id": "dag_executions",
113
+ "title": "DAG Executions",
114
+ "type": "graph",
115
+ "gridPos": { "x": 0, "y": 0, "w": 12, "h": 8 },
116
+ "targets": [
117
+ {
118
+ "expr": "rate(dag_execution_count[5m])",
119
+ "legendFormat": "Executions/sec"
120
+ }
121
+ ]
122
+ },
123
+ {
124
+ "id": "dag_duration",
125
+ "title": "DAG Execution Duration",
126
+ "type": "graph",
127
+ "gridPos": { "x": 12, "y": 0, "w": 12, "h": 8 },
128
+ "targets": [
129
+ {
130
+ "expr": "histogram_quantile(0.50, rate(dag_execution_duration_bucket[5m]))",
131
+ "legendFormat": "Median"
132
+ },
133
+ {
134
+ "expr": "histogram_quantile(0.95, rate(dag_execution_duration_bucket[5m]))",
135
+ "legendFormat": "95th percentile"
136
+ }
137
+ ],
138
+ "yAxes": [{ "label": "milliseconds", "min": 0 }]
139
+ },
140
+ {
141
+ "id": "node_execution_count",
142
+ "title": "Node Execution Rate by Type",
143
+ "type": "graph",
144
+ "gridPos": { "x": 0, "y": 8, "w": 12, "h": 8 },
145
+ "targets": [
146
+ {
147
+ "expr": "rate(dag_node_execution_count[5m])",
148
+ "legendFormat": "{{node_type}}"
149
+ }
150
+ ]
151
+ },
152
+ {
153
+ "id": "node_failures",
154
+ "title": "Node Failure Rate",
155
+ "type": "graph",
156
+ "gridPos": { "x": 12, "y": 8, "w": 12, "h": 8 },
157
+ "targets": [
158
+ {
159
+ "expr": "rate(dag_execution_errors[5m])",
160
+ "legendFormat": "{{error_type}}"
161
+ }
162
+ ],
163
+ "alert": {
164
+ "conditions": [
165
+ {
166
+ "query": { "params": ["A", "5m", "now"] },
167
+ "reducer": { "type": "avg" },
168
+ "evaluator": { "params": [0.1], "type": "gt" }
169
+ }
170
+ ],
171
+ "executionErrorState": "alerting",
172
+ "for": "2m",
173
+ "frequency": "10s",
174
+ "handler": 1,
175
+ "name": "High DAG Node Failure Rate",
176
+ "noDataState": "no_data"
177
+ }
178
+ },
179
+ {
180
+ "id": "concurrent_executions",
181
+ "title": "Concurrent DAG Executions",
182
+ "type": "stat",
183
+ "gridPos": { "x": 0, "y": 16, "w": 6, "h": 4 },
184
+ "targets": [
185
+ {
186
+ "expr": "dag_concurrent_executions",
187
+ "legendFormat": "Active"
188
+ }
189
+ ]
190
+ },
191
+ {
192
+ "id": "dag_memory_usage",
193
+ "title": "DAG Memory Usage",
194
+ "type": "graph",
195
+ "gridPos": { "x": 6, "y": 16, "w": 18, "h": 8 },
196
+ "targets": [
197
+ {
198
+ "expr": "dag_memory_usage_bytes",
199
+ "legendFormat": "Memory Usage"
200
+ }
201
+ ],
202
+ "yAxes": [{ "label": "bytes", "min": 0 }]
203
+ }
204
+ ]
205
+ },
206
+ {
207
+ "id": "security_monitoring",
208
+ "title": "Security Monitoring",
209
+ "description": "Security events, threats, and compliance monitoring",
210
+ "category": "security",
211
+ "tags": ["security", "compliance", "threats"],
212
+ "refresh": "10s",
213
+ "panels": [
214
+ {
215
+ "id": "security_events",
216
+ "title": "Security Events Rate",
217
+ "type": "graph",
218
+ "gridPos": { "x": 0, "y": 0, "w": 12, "h": 8 },
219
+ "targets": [
220
+ {
221
+ "expr": "rate(security_events_total[5m])",
222
+ "legendFormat": "{{severity}}"
223
+ }
224
+ ]
225
+ },
226
+ {
227
+ "id": "threats_detected",
228
+ "title": "Threats Detected",
229
+ "type": "stat",
230
+ "gridPos": { "x": 12, "y": 0, "w": 6, "h": 4 },
231
+ "targets": [
232
+ {
233
+ "expr": "threats_detected",
234
+ "legendFormat": "Active Threats"
235
+ }
236
+ ],
237
+ "fieldConfig": {
238
+ "defaults": {
239
+ "color": { "mode": "thresholds" },
240
+ "thresholds": {
241
+ "steps": [
242
+ { "color": "green", "value": 0 },
243
+ { "color": "yellow", "value": 1 },
244
+ { "color": "red", "value": 5 }
245
+ ]
246
+ }
247
+ }
248
+ }
249
+ },
250
+ {
251
+ "id": "blocked_entities",
252
+ "title": "Blocked Entities",
253
+ "type": "stat",
254
+ "gridPos": { "x": 18, "y": 0, "w": 6, "h": 4 },
255
+ "targets": [
256
+ {
257
+ "expr": "security_entities_blocked",
258
+ "legendFormat": "Blocked"
259
+ }
260
+ ]
261
+ },
262
+ {
263
+ "id": "audit_events",
264
+ "title": "Audit Events",
265
+ "type": "graph",
266
+ "gridPos": { "x": 12, "y": 4, "w": 12, "h": 8 },
267
+ "targets": [
268
+ {
269
+ "expr": "rate(audit_events_total[5m])",
270
+ "legendFormat": "{{category}}"
271
+ }
272
+ ]
273
+ },
274
+ {
275
+ "id": "security_violations",
276
+ "title": "Security Violations by Type",
277
+ "type": "piechart",
278
+ "gridPos": { "x": 0, "y": 8, "w": 12, "h": 8 },
279
+ "targets": [
280
+ {
281
+ "expr": "increase(plugin_sandbox_violations[1h])",
282
+ "legendFormat": "{{violation_type}}"
283
+ }
284
+ ]
285
+ },
286
+ {
287
+ "id": "compliance_status",
288
+ "title": "Compliance Framework Status",
289
+ "type": "table",
290
+ "gridPos": { "x": 12, "y": 12, "w": 12, "h": 8 },
291
+ "targets": [
292
+ {
293
+ "expr": "compliance_framework_status",
294
+ "legendFormat": "{{framework}}"
295
+ }
296
+ ]
297
+ }
298
+ ]
299
+ },
300
+ {
301
+ "id": "plugin_performance",
302
+ "title": "Plugin Performance",
303
+ "description": "Plugin execution metrics and sandbox monitoring",
304
+ "category": "plugins",
305
+ "tags": ["plugins", "sandbox", "performance"],
306
+ "refresh": "30s",
307
+ "panels": [
308
+ {
309
+ "id": "plugin_executions",
310
+ "title": "Plugin Execution Rate",
311
+ "type": "graph",
312
+ "gridPos": { "x": 0, "y": 0, "w": 12, "h": 8 },
313
+ "targets": [
314
+ {
315
+ "expr": "rate(plugin_execution_count[5m])",
316
+ "legendFormat": "{{plugin_type}}"
317
+ }
318
+ ]
319
+ },
320
+ {
321
+ "id": "plugin_duration",
322
+ "title": "Plugin Execution Duration",
323
+ "type": "graph",
324
+ "gridPos": { "x": 12, "y": 0, "w": 12, "h": 8 },
325
+ "targets": [
326
+ {
327
+ "expr": "histogram_quantile(0.95, rate(plugin_execution_duration_bucket[5m]))",
328
+ "legendFormat": "{{plugin_type}} 95th percentile"
329
+ }
330
+ ]
331
+ },
332
+ {
333
+ "id": "sandbox_violations",
334
+ "title": "Sandbox Security Violations",
335
+ "type": "graph",
336
+ "gridPos": { "x": 0, "y": 8, "w": 12, "h": 8 },
337
+ "targets": [
338
+ {
339
+ "expr": "rate(plugin_sandbox_violations[5m])",
340
+ "legendFormat": "{{violation_type}}"
341
+ }
342
+ ],
343
+ "alert": {
344
+ "conditions": [
345
+ {
346
+ "query": { "params": ["A", "5m", "now"] },
347
+ "reducer": { "type": "sum" },
348
+ "evaluator": { "params": [0], "type": "gt" }
349
+ }
350
+ ],
351
+ "executionErrorState": "alerting",
352
+ "for": "0m",
353
+ "frequency": "10s",
354
+ "handler": 1,
355
+ "name": "Plugin Sandbox Violations",
356
+ "noDataState": "no_data"
357
+ }
358
+ },
359
+ {
360
+ "id": "active_sandboxes",
361
+ "title": "Active Plugin Sandboxes",
362
+ "type": "stat",
363
+ "gridPos": { "x": 12, "y": 8, "w": 6, "h": 4 },
364
+ "targets": [
365
+ {
366
+ "expr": "plugin_sandboxes_active",
367
+ "legendFormat": "Active"
368
+ }
369
+ ]
370
+ },
371
+ {
372
+ "id": "plugin_resource_usage",
373
+ "title": "Plugin Resource Usage",
374
+ "type": "graph",
375
+ "gridPos": { "x": 18, "y": 8, "w": 6, "h": 8 },
376
+ "targets": [
377
+ {
378
+ "expr": "plugin_memory_usage_bytes",
379
+ "legendFormat": "Memory"
380
+ },
381
+ {
382
+ "expr": "plugin_cpu_usage_seconds",
383
+ "legendFormat": "CPU"
384
+ }
385
+ ]
386
+ }
387
+ ]
388
+ },
389
+ {
390
+ "id": "rag_quality_metrics",
391
+ "title": "RAG Quality Metrics",
392
+ "description": "Retrieval accuracy, embedding quality, and response metrics",
393
+ "category": "quality",
394
+ "tags": ["rag", "quality", "accuracy"],
395
+ "refresh": "1m",
396
+ "panels": [
397
+ {
398
+ "id": "retrieval_accuracy",
399
+ "title": "Retrieval Accuracy",
400
+ "type": "graph",
401
+ "gridPos": { "x": 0, "y": 0, "w": 12, "h": 8 },
402
+ "targets": [
403
+ {
404
+ "expr": "rag_retrieval_accuracy",
405
+ "legendFormat": "Accuracy Score"
406
+ }
407
+ ],
408
+ "yAxes": [{ "label": "score", "min": 0, "max": 1 }]
409
+ },
410
+ {
411
+ "id": "embedding_count",
412
+ "title": "Embeddings Generated",
413
+ "type": "graph",
414
+ "gridPos": { "x": 12, "y": 0, "w": 12, "h": 8 },
415
+ "targets": [
416
+ {
417
+ "expr": "rate(rag_embedding_count[5m])",
418
+ "legendFormat": "Embeddings/sec"
419
+ }
420
+ ]
421
+ },
422
+ {
423
+ "id": "query_processing_time",
424
+ "title": "Query Processing Time",
425
+ "type": "graph",
426
+ "gridPos": { "x": 0, "y": 8, "w": 12, "h": 8 },
427
+ "targets": [
428
+ {
429
+ "expr": "histogram_quantile(0.50, rate(rag_query_duration_bucket[5m]))",
430
+ "legendFormat": "Median"
431
+ },
432
+ {
433
+ "expr": "histogram_quantile(0.95, rate(rag_query_duration_bucket[5m]))",
434
+ "legendFormat": "95th percentile"
435
+ }
436
+ ]
437
+ },
438
+ {
439
+ "id": "document_relevance",
440
+ "title": "Document Relevance Score",
441
+ "type": "stat",
442
+ "gridPos": { "x": 12, "y": 8, "w": 6, "h": 4 },
443
+ "targets": [
444
+ {
445
+ "expr": "avg(rag_document_relevance_score)",
446
+ "legendFormat": "Avg Relevance"
447
+ }
448
+ ],
449
+ "fieldConfig": {
450
+ "defaults": {
451
+ "unit": "percent",
452
+ "min": 0,
453
+ "max": 100
454
+ }
455
+ }
456
+ },
457
+ {
458
+ "id": "semantic_similarity",
459
+ "title": "Semantic Similarity",
460
+ "type": "heatmap",
461
+ "gridPos": { "x": 18, "y": 8, "w": 6, "h": 8 },
462
+ "targets": [
463
+ {
464
+ "expr": "rag_semantic_similarity_score",
465
+ "legendFormat": "Similarity"
466
+ }
467
+ ]
468
+ }
469
+ ]
470
+ },
471
+ {
472
+ "id": "system_resources",
473
+ "title": "System Resources",
474
+ "description": "Infrastructure monitoring and resource utilization",
475
+ "category": "infrastructure",
476
+ "tags": ["system", "resources", "infrastructure"],
477
+ "refresh": "30s",
478
+ "panels": [
479
+ {
480
+ "id": "cpu_usage",
481
+ "title": "CPU Usage",
482
+ "type": "graph",
483
+ "gridPos": { "x": 0, "y": 0, "w": 12, "h": 8 },
484
+ "targets": [
485
+ {
486
+ "expr": "100 - (avg(irate(node_cpu_seconds_total{mode=\"idle\"}[5m])) * 100)",
487
+ "legendFormat": "CPU Usage %"
488
+ }
489
+ ],
490
+ "yAxes": [{ "label": "percentage", "min": 0, "max": 100 }]
491
+ },
492
+ {
493
+ "id": "memory_usage",
494
+ "title": "Memory Usage",
495
+ "type": "graph",
496
+ "gridPos": { "x": 12, "y": 0, "w": 12, "h": 8 },
497
+ "targets": [
498
+ {
499
+ "expr": "memory_usage",
500
+ "legendFormat": "Used Memory"
501
+ },
502
+ {
503
+ "expr": "node_memory_MemTotal_bytes",
504
+ "legendFormat": "Total Memory"
505
+ }
506
+ ],
507
+ "yAxes": [{ "label": "bytes", "min": 0 }]
508
+ },
509
+ {
510
+ "id": "network_io",
511
+ "title": "Network I/O",
512
+ "type": "graph",
513
+ "gridPos": { "x": 0, "y": 8, "w": 12, "h": 8 },
514
+ "targets": [
515
+ {
516
+ "expr": "rate(node_network_receive_bytes_total[5m])",
517
+ "legendFormat": "Received"
518
+ },
519
+ {
520
+ "expr": "rate(node_network_transmit_bytes_total[5m])",
521
+ "legendFormat": "Transmitted"
522
+ }
523
+ ]
524
+ },
525
+ {
526
+ "id": "disk_usage",
527
+ "title": "Disk Usage",
528
+ "type": "graph",
529
+ "gridPos": { "x": 12, "y": 8, "w": 12, "h": 8 },
530
+ "targets": [
531
+ {
532
+ "expr": "100 - ((node_filesystem_avail_bytes * 100) / node_filesystem_size_bytes)",
533
+ "legendFormat": "{{mountpoint}}"
534
+ }
535
+ ],
536
+ "yAxes": [{ "label": "percentage", "min": 0, "max": 100 }]
537
+ },
538
+ {
539
+ "id": "active_connections",
540
+ "title": "Active Connections",
541
+ "type": "stat",
542
+ "gridPos": { "x": 0, "y": 16, "w": 6, "h": 4 },
543
+ "targets": [
544
+ {
545
+ "expr": "active_connections",
546
+ "legendFormat": "Connections"
547
+ }
548
+ ]
549
+ },
550
+ {
551
+ "id": "file_descriptors",
552
+ "title": "File Descriptors",
553
+ "type": "graph",
554
+ "gridPos": { "x": 6, "y": 16, "w": 18, "h": 8 },
555
+ "targets": [
556
+ {
557
+ "expr": "node_filefd_allocated",
558
+ "legendFormat": "Allocated"
559
+ },
560
+ {
561
+ "expr": "node_filefd_maximum",
562
+ "legendFormat": "Maximum"
563
+ }
564
+ ]
565
+ }
566
+ ]
567
+ }
568
+ ],
569
+ "alerting": {
570
+ "rules": [
571
+ {
572
+ "alert": "ServiceDown",
573
+ "expr": "up{job=\"rag-pipeline\"} == 0",
574
+ "for": "1m",
575
+ "labels": {
576
+ "severity": "critical",
577
+ "service": "rag-pipeline"
578
+ },
579
+ "annotations": {
580
+ "summary": "RAG Pipeline service is down",
581
+ "description": "The RAG Pipeline service has been down for more than 1 minute."
582
+ }
583
+ },
584
+ {
585
+ "alert": "HighErrorRate",
586
+ "expr": "rate(rag_errors_total[5m]) / rate(rag_requests_total[5m]) * 100 > 5",
587
+ "for": "5m",
588
+ "labels": {
589
+ "severity": "warning",
590
+ "service": "rag-pipeline"
591
+ },
592
+ "annotations": {
593
+ "summary": "High error rate detected",
594
+ "description": "Error rate is above 5% for more than 5 minutes."
595
+ }
596
+ },
597
+ {
598
+ "alert": "HighResponseTime",
599
+ "expr": "histogram_quantile(0.95, rate(rag_request_duration_bucket[5m])) > 5000",
600
+ "for": "10m",
601
+ "labels": {
602
+ "severity": "warning",
603
+ "service": "rag-pipeline"
604
+ },
605
+ "annotations": {
606
+ "summary": "High response time",
607
+ "description": "95th percentile response time is above 5 seconds."
608
+ }
609
+ },
610
+ {
611
+ "alert": "SecurityViolation",
612
+ "expr": "rate(plugin_sandbox_violations[5m]) > 0",
613
+ "for": "0m",
614
+ "labels": {
615
+ "severity": "critical",
616
+ "service": "security"
617
+ },
618
+ "annotations": {
619
+ "summary": "Security violation detected",
620
+ "description": "Plugin sandbox security violation detected."
621
+ }
622
+ },
623
+ {
624
+ "alert": "HighMemoryUsage",
625
+ "expr": "memory_usage / node_memory_MemTotal_bytes * 100 > 85",
626
+ "for": "5m",
627
+ "labels": {
628
+ "severity": "warning",
629
+ "service": "infrastructure"
630
+ },
631
+ "annotations": {
632
+ "summary": "High memory usage",
633
+ "description": "Memory usage is above 85% for more than 5 minutes."
634
+ }
635
+ }
636
+ ]
637
+ },
638
+ "notifications": [
639
+ {
640
+ "name": "default-webhook",
641
+ "type": "webhook",
642
+ "settings": {
643
+ "url": "http://localhost:3000/api/alerts",
644
+ "httpMethod": "POST",
645
+ "title": "RAG Pipeline Alert",
646
+ "username": "rag-pipeline"
647
+ }
648
+ },
649
+ {
650
+ "name": "security-alerts",
651
+ "type": "webhook",
652
+ "settings": {
653
+ "url": "http://localhost:3000/api/security-alerts",
654
+ "httpMethod": "POST",
655
+ "title": "Security Alert",
656
+ "username": "security-monitor"
657
+ }
658
+ }
659
+ ],
660
+ "metadata": {
661
+ "version": "1.0.0",
662
+ "created": "2023-12-07T00:00:00Z",
663
+ "author": "DevilsDev Team",
664
+ "description": "Comprehensive observability dashboards for RAG Pipeline Utils",
665
+ "tags": ["rag", "observability", "monitoring", "security"],
666
+ "prometheus": {
667
+ "datasource": "prometheus",
668
+ "url": "http://localhost:9090"
669
+ },
670
+ "grafana": {
671
+ "version": ">=8.0.0",
672
+ "plugins": ["grafana-piechart-panel"]
673
+ }
674
+ }
675
+ }